30 #include "StTriggerData2016.h"
43 mYear=2016; mRun = run; mDebug = 0;
50 mYear=2016; mRun = run; mDebug = dbg;
51 if(mDebug==1) printf(
"StTriggerData2016 Constructor with trigger data block and byteswap option=%d\n",bs);
58 if (data==0) {copyflag=0;}
59 if(mDebug==1) printf(
"StTriggerData2016::readData copyflag=%d byteswap=%d data=%p mData=%p\n",copyflag,bs,data,mData);
62 unsigned int ver = data->FormatVersion;
65 if (ver == y16FORMAT_VERSION ) {
66 if (mDebug==1) printf(
"StTriggerData2016: version = 0x%x (0x%x or 0x08121140)\n",ver,y16FORMAT_VERSION);
69 mErrorFlag = mErrorFlag | 0x1;
70 printf(
"StTriggerData2016: version = 0x%x != (0x%x)\n",ver,y16FORMAT_VERSION);
74 unsigned int size = data->totalTriggerLength;
76 if (size > y16MAX_TRG_BLK_SIZE) {
77 gMessMgr->Warning() <<
"StTriggerData2016: Data length = " << size
78 <<
" is bigger than max = " << y16MAX_TRG_BLK_SIZE
82 if (mDebug==1) printf(
"StTriggerData2016: size = %d, maxsize = %d\n",size,y16MAX_TRG_BLK_SIZE);
83 memcpy(mData,data,size);
87 if (bs) swapDataBlk(mData);
89 printf(
"StTriggerData2016: version = 0x%x (0x%x)\n",mData->FormatVersion,y16FORMAT_VERSION);
90 printf(
"StTriggerData2016: size = %d, maxsize = %d\n",mData->totalTriggerLength,y16MAX_TRG_BLK_SIZE);
91 printf(
"EventDesc length=%10d offset=%10d\n",mData->EventDesc_ofl.length,mData->EventDesc_ofl.offset);
92 printf(
"L1_DSM length=%10d offset=%10d\n",mData->L1_DSM_ofl.length,mData->L1_DSM_ofl.offset);
93 printf(
"Summary length=%10d offset=%10d\n",mData->Summary_ofl.length,mData->Summary_ofl.offset);
96 EvtDesc=0; L1_DSM=0; TrgSum=0;
97 if (mData->EventDesc_ofl.length > 0) EvtDesc = (
EvtDescData2016*)((
char*)mData + mData->EventDesc_ofl.offset);
98 if (mData->L1_DSM_ofl.length > 0) L1_DSM = (
L1_DSM_Data2016*)((
char*)mData + mData->L1_DSM_ofl.offset);
99 if (mData->Summary_ofl.length > 0) TrgSum = (
TrgSumData2016* )((
char*)mData + mData->Summary_ofl.offset);
101 if (EvtDesc) swapEvtDesc(EvtDesc);
102 if (L1_DSM) swapL1_DSM(L1_DSM);
103 if (TrgSum) swapTrgSum(TrgSum);
105 if (EvtDesc==0 || L1_DSM==0 || TrgSum==0){
106 mErrorFlag = mErrorFlag | 0x1;
107 gMessMgr->Warning() <<
"StTriggerData2016: EvtDesc, L1_DSM or TrgSum is missing"
108 <<
" mErrorFlag="<<mErrorFlag<<endm;
111 int npre = numberOfPreXing();
112 int npost = numberOfPostXing();
113 if (npre<0 || npre>10 || npost<0 || npost>10){
114 mErrorFlag = mErrorFlag | 0x2;
115 gMessMgr->Warning() <<
"StTriggerData2016: Invalid npre/post = "<< npre <<
" / " << npost
116 <<
" mErrorFlag="<<mErrorFlag<<endm;
118 if (mDebug==1) printf(
"StTriggerData2016: pre=%d post=%d\n",npre,npost);
120 memset(mBC1,0,
sizeof(mBC1));
121 memset(mMXQ,0,
sizeof(mMXQ));
122 memset(mMIX,0,
sizeof(mMIX));
123 memset(mBCW,0,
sizeof(mBCW));
124 memset(mBCE,0,
sizeof(mBCE));
125 memset(mFEQ,0,
sizeof(mFEQ));
126 memset(mBBC,0,
sizeof(mBBC));
127 memset(mBBQ,0,
sizeof(mBBQ));
128 memset(mFMS,0,
sizeof(mFMS));
129 memset(mQT1,0,
sizeof(mQT1));
130 memset(mQT2,0,
sizeof(mQT2));
131 memset(mQT3,0,
sizeof(mQT3));
132 memset(mQT4,0,
sizeof(mQT4));
133 memset(mxq,0,
sizeof(mxq)); memset(tmxq,0,
sizeof(tmxq));
134 memset(feq,0,
sizeof(feq)); memset(tfeq,0,
sizeof(tfeq));
135 memset(bbq,0,
sizeof(bbq)); memset(tbbq,0,
sizeof(tbbq));
136 memset(qt1,0,
sizeof(qt1)); memset(tqt1,0,
sizeof(tqt1));
137 memset(qt2,0,
sizeof(qt2)); memset(tqt2,0,
sizeof(tqt2));
138 memset(qt3,0,
sizeof(qt3)); memset(tqt3,0,
sizeof(tqt3));
139 memset(qt4,0,
sizeof(qt4)); memset(tqt4,0,
sizeof(tqt4));
142 for (
int i=0; i<1+npre+npost; i++){
145 offlen = mData->MainX;
149 if (mData->PrePostList[i-1]==0)
continue;
150 offlen = (
TrgOfflen2016*) ((
char*)mData + mData->PrePostList[i-1]);
152 if (bs) swapRawDetOfflen(offlen);
153 for(
int k=0; k<y16MAX_OFFLEN; k++){
154 if(static_cast<unsigned int>(offlen[k].length + offlen[k].offset) > static_cast<unsigned int>(mData->totalTriggerLength)) {
155 mErrorFlag = mErrorFlag | (1 << k);
156 gMessMgr->Warning() <<
"StTriggerData2016: offset ("<<offlen[k].offset<<
") + length ("<<offlen[k].length
157 <<
") exceeds total size("<<mData->totalTriggerLength<<
") for data block id="<<k
158 <<
" mErrorFlag="<<mErrorFlag<<endm;
162 j=offlen[y16BC1_CONF_NUM].length;
if (j>0){mBC1[i] = (
BELayerBlock2016*)((
char*)mData + offlen[y16BC1_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mBC1[i],y16BC1_CONF_NUM,j,bs);}
163 j=offlen[y16MXQ_CONF_NUM].length;
if (j>0){mMXQ[i] = (
QTBlock2016* )((
char*)mData + offlen[y16MXQ_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mMXQ[i],y16MXQ_CONF_NUM,j,bs);}
164 j=offlen[y16MIX_CONF_NUM].length;
if (j>0){mMIX[i] = (
MIXBlock2016* )((
char*)mData + offlen[y16MIX_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mMIX[i],y16MIX_CONF_NUM,j,bs);}
165 j=offlen[y16BCW_CONF_NUM].length;
if (j>0){mBCW[i] = (
BWestBlock2016* )((
char*)mData + offlen[y16BCW_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mBCW[i],y16BCW_CONF_NUM,j,bs);}
166 j=offlen[y16BCE_CONF_NUM].length;
if (j>0){mBCE[i] = (
BEastBlock2016* )((
char*)mData + offlen[y16BCE_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mBCE[i],y16BCE_CONF_NUM,j,bs);}
167 j=offlen[y16FEQ_CONF_NUM].length;
if (j>0){mFEQ[i] = (
QTBlock2016* )((
char*)mData + offlen[y16FEQ_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mFEQ[i],y16FEQ_CONF_NUM,j,bs);}
168 j=offlen[y16BBC_CONF_NUM].length;
if (j>0){mBBC[i] = (
BBCBlock2016* )((
char*)mData + offlen[y16BBC_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mBBC[i],y16BBC_CONF_NUM,j,bs);}
169 j=offlen[y16BBQ_CONF_NUM].length;
if (j>0){mBBQ[i] = (
QTBlock2016* )((
char*)mData + offlen[y16BBQ_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mBBQ[i],y16BBQ_CONF_NUM,j,bs);}
170 j=offlen[y16FMS_CONF_NUM].length;
if (j>0){mFMS[i] = (
FMSBlock2016* )((
char*)mData + offlen[y16FMS_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mFMS[i],y16FMS_CONF_NUM,j,bs);}
171 j=offlen[y16QT1_CONF_NUM].length;
if (j>0){mQT1[i] = (
QTBlock2016* )((
char*)mData + offlen[y16QT1_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mQT1[i],y16QT1_CONF_NUM,j,bs);}
172 j=offlen[y16QT2_CONF_NUM].length;
if (j>0){mQT2[i] = (
QTBlock2016* )((
char*)mData + offlen[y16QT2_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mQT2[i],y16QT2_CONF_NUM,j,bs);}
173 j=offlen[y16QT3_CONF_NUM].length;
if (j>0){mQT3[i] = (
QTBlock2016* )((
char*)mData + offlen[y16QT3_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mQT3[i],y16QT3_CONF_NUM,j,bs);}
174 j=offlen[y16QT4_CONF_NUM].length;
if (j>0){mQT4[i] = (
QTBlock2016* )((
char*)mData + offlen[y16QT4_CONF_NUM].offset); swapRawDet((
DataBlock2016*)mQT4[i],y16QT4_CONF_NUM,j,bs);}
175 if (mMXQ[i]) decodeQT(mMXQ[i]->length/4, mMXQ[i]->data, mxq[i], tmxq[i]);
176 if (mFEQ[i]) decodeQT(mFEQ[i]->length/4, mFEQ[i]->data, feq[i], tfeq[i]);
177 if (mBBQ[i]) decodeQT(mBBQ[i]->length/4, mBBQ[i]->data, bbq[i], tbbq[i]);
178 if (mQT1[i]) decodeQT(mQT1[i]->length/4, mQT1[i]->data, qt1[i], tqt1[i]);
179 if (mQT2[i]) decodeQT(mQT2[i]->length/4, mQT2[i]->data, qt2[i], tqt2[i]);
180 if (mQT3[i]) decodeQT(mQT3[i]->length/4, mQT3[i]->data, qt3[i], tqt3[i]);
181 if (mQT4[i]) decodeQT(mQT4[i]->length/4, mQT4[i]->data, qt4[i], tqt4[i]);
183 if (mDebug==1) dump();
186 StTriggerData2016::~StTriggerData2016() {
delete mData;}
188 unsigned int StTriggerData2016::version()
const
190 return EvtDesc->TrgDataFmtVer;
193 unsigned int StTriggerData2016::eventNumber()
const
195 return mData->eventNumber;
198 unsigned int StTriggerData2016::token()
const
200 return EvtDesc->TrgToken;
203 unsigned int StTriggerData2016::triggerWord()
const
205 return EvtDesc->TriggerWord;
208 unsigned int StTriggerData2016::actionWord()
const
211 ( (
unsigned short)(EvtDesc->actionWdTrgCommand) * 16 * 16 * 16 ) +
212 ( (
unsigned short)(EvtDesc->actionWdDaqCommand) * 16 * 16 ) +
213 ( EvtDesc->actionWdDetectorBitMask & 0x00ff );
216 unsigned int StTriggerData2016::numberOfPreXing()
const
218 return EvtDesc->npre & 0xf;
221 unsigned int StTriggerData2016::numberOfPostXing()
const
223 return EvtDesc->npost & 0xf;
226 unsigned short StTriggerData2016::busyStatus()
const
228 return EvtDesc->internalBusy;
231 unsigned short StTriggerData2016::dsmInput()
const
233 return EvtDesc->DSMInput;
236 unsigned short StTriggerData2016::trgToken()
const
238 return EvtDesc->TrgToken;
241 unsigned short StTriggerData2016::dsmAddress()
const
243 return EvtDesc->DSMAddress;
246 unsigned short StTriggerData2016::mAddBits()
const
248 return EvtDesc->addBits;
251 unsigned short StTriggerData2016::bcData(
int channel)
const
253 return L1_DSM->BCdata[channel];
256 unsigned short StTriggerData2016::lastDSM(
int channel)
const
258 return L1_DSM->lastDSM[channel];
261 unsigned short StTriggerData2016::tcuBits()
const
263 return EvtDesc->DSMInput;
267 unsigned int StTriggerData2016::tcuCounter()
const
269 unsigned int p = EvtDesc->physicsWord;
270 unsigned int t = EvtDesc->TriggerWord;
275 unsigned int StTriggerData2016::rccCounter(
int crate)
const
277 if(crate >= y16L1_CONF_NUM && crate <= y16QT4_CONF_NUM){
278 return TrgSum->LocalClocks[crate];
283 unsigned long long StTriggerData2016::bunchCounter()
const
285 unsigned long long bxinghi,bxing1,bxinglo, bx;
286 bxinghi = L1_DSM->BCdata[3];
287 bxing1 = L1_DSM->BCdata[10];
288 bxinglo = (bxing1 << 16) + L1_DSM->BCdata[11];
289 bx = (bxinghi << 32) + bxinglo;
293 unsigned int StTriggerData2016::bunchCounterHigh()
const
295 return EvtDesc->bunchXing_hi;
298 unsigned int StTriggerData2016::bunchCounterLow()
const
300 return EvtDesc->bunchXing_lo;
303 unsigned int StTriggerData2016::bunchId48Bit()
const
305 return (
int)(bunchCounter() % 120);
308 unsigned int StTriggerData2016::bunchId7Bit()
const
311 b7dat = L1_DSM->BCdata[2];
316 unsigned int StTriggerData2016::spinBit()
const
319 return (L1_DSM->lastDSM[7]/16)%256;
321 return (L1_DSM->lastDSM[4]/16)%256;
325 unsigned int StTriggerData2016::spinBitYellowFilled()
const
327 unsigned int sb = spinBit();
331 unsigned int StTriggerData2016::spinBitYellowUp()
const
333 unsigned int sb = spinBit();
337 unsigned int StTriggerData2016::spinBitYellowDown()
const
339 unsigned int sb = spinBit();
343 unsigned int StTriggerData2016::spinBitYellowUnpol()
const
345 unsigned int sb = spinBit();
349 unsigned int StTriggerData2016::spinBitBlueFilled()
const
351 unsigned int sb = spinBit();
355 unsigned int StTriggerData2016::spinBitBlueUp()
const
357 unsigned int sb = spinBit();
361 unsigned int StTriggerData2016::spinBitBlueDown()
const
363 unsigned int sb = spinBit();
367 unsigned int StTriggerData2016::spinBitBlueUnpol()
const
369 unsigned int sb = spinBit();
373 unsigned short StTriggerData2016::bbcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
375 const int addrmap[2][24] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
376 4, 4, 4, 4, 4, 4, 4, 4},
377 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
378 4, 4, 4, 4, 4, 4, 4, 4} };
379 const int chmap[2][24] = { { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
380 0, 1, 2, 3, 8, 9,10,11},
381 { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
382 16,17,18,19,24,25,26,27} };
383 int buffer = prepostAddress(prepost);
384 if (buffer >= 0 && pmt>=1 && pmt<=24)
return bbq[buffer][addrmap[eastwest][pmt-1]][chmap[eastwest][pmt-1]];
388 unsigned short StTriggerData2016::bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
390 const int addrmap[2][24] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
391 4, 4, 4, 4, 4, 4, 4, 4},
392 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 4, 4, 4, 4, 4, 4, 4, 4} };
394 const int chmap[2][24] = { { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
395 0, 1, 2, 3, 8, 9,10,11},
396 { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
397 16,17,18,19,24,25,26,27} };
398 int buffer = prepostAddress(prepost);
399 if (buffer >= 0 && pmt>=1 && pmt<=24)
return bbq[buffer][addrmap[eastwest][pmt-1]][chmap[eastwest][pmt-1]+4];
403 unsigned short StTriggerData2016::bbcADCSum(StBeamDirection eastwest,
int prepost)
const
405 unsigned short sum=0;
406 int buffer = prepostAddress(prepost);
410 if(eastwest==east) { sum = mBBC[buffer]->BBClayer1[3]; }
411 else { sum = mBBC[buffer]->BBClayer1[1]; }
417 unsigned short StTriggerData2016::bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost)
const
419 unsigned short sum=0;
420 int buffer = prepostAddress(prepost);
421 if (buffer >= 0)
for(
int i=17; i<=24; i++) {sum+=bbcADC(eastwest,i,prepost);}
425 unsigned short StTriggerData2016::bbcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
427 int buffer = prepostAddress(prepost);
430 if (eastwest==east) {
return mBBC[buffer]->BBClayer1[2]%4096;}
431 else {
return mBBC[buffer]->BBClayer1[0]%4096;}
437 unsigned short StTriggerData2016::bbcTimeDifference()
const
439 return L1_DSM->VTX[3]%8192;
442 unsigned short StTriggerData2016::bbcTacSum()
const
444 return (((L1_DSM->VTX[3]) >> 13) & 0x1);
447 unsigned short StTriggerData2016::bbcEarliestTDCLarge(StBeamDirection eastwest,
int prepost)
const
449 int buffer = prepostAddress(prepost);
452 if (eastwest==east) {
return mBBC[buffer]->BBClayer1[11] & 0x0fff;}
453 else {
return ((mBBC[buffer]->BBClayer1[11] & 0xf000) >> 12)
454 +((mBBC[buffer]->BBClayer1[10] & 0x00ff) << 4 );}
460 unsigned short StTriggerData2016::bbcTimeDifferenceLarge()
const
462 return L1_DSM->VTX[2]%8192;
466 unsigned short StTriggerData2016::fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost)
const
471 unsigned short StTriggerData2016::fpdSum(StBeamDirection eastwest,
int module)
const
476 unsigned short StTriggerData2016::fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost)
const{
477 int buffer = prepostAddress(prepost);
479 if (eastwest==east) {
if (mMIX[buffer])
return mMIX[buffer]->FPDEastNSLayer1[channel]; }
480 else {
if (mFMS[buffer])
return mFMS[buffer]->FMS[channel]; }
485 unsigned short StTriggerData2016::fpdLayer2DSMRaw(
int channel)
const{
486 if (channel<8)
return L1_DSM->FPD[channel];
490 bool StTriggerData2016::zdcPresent(
int prepost)
const
492 int buffer = prepostAddress(prepost);
493 if (buffer >= 0)
return mBBQ[buffer];
497 unsigned short StTriggerData2016::zdcAtChannel(
int channel,
int prepost)
const
499 int buffer = prepostAddress(prepost);
500 if (buffer >= 0 && channel>=0 && channel<32)
return bbq[buffer][14][channel];
504 unsigned short StTriggerData2016::zdcAtAddress(
int address,
int prepost)
const
506 return zdcAtChannel(address,prepost);
509 unsigned short StTriggerData2016::zdcUnAttenuated(StBeamDirection eastwest,
int prepost)
const
511 int buffer = prepostAddress(prepost);
513 if (eastwest == east)
return bbq[buffer][14][2];
514 else return bbq[buffer][14][18];
519 unsigned short StTriggerData2016::zdcAttenuated(StBeamDirection eastwest,
int prepost)
const
521 int buffer = prepostAddress(prepost);
523 if (eastwest == east)
return bbq[buffer][14][3];
524 else return bbq[buffer][14][19];
529 unsigned short StTriggerData2016::zdcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
531 int buffer = prepostAddress(prepost);
532 if (buffer >= 0 && pmt>=1 && pmt<=3) {
533 if (eastwest == east) {
534 if (pmt == 1)
return bbq[buffer][14][0];
535 if (pmt == 2)
return bbq[buffer][14][8];
536 if (pmt == 3)
return bbq[buffer][14][9];
539 if (pmt == 1)
return bbq[buffer][14][16];
540 if (pmt == 2)
return bbq[buffer][14][24];
541 if (pmt == 3)
return bbq[buffer][14][25];
547 unsigned short StTriggerData2016::zdcTDC(StBeamDirection eastwest,
int prepost)
const
549 int buffer = prepostAddress(prepost);
551 if (eastwest == east)
return bbq[buffer][14][6];
552 else return bbq[buffer][14][22];
557 unsigned short StTriggerData2016::zdcPmtTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
559 int buffer = prepostAddress(prepost);
560 if (buffer >= 0 && pmt>=1 && pmt<=3) {
561 if (eastwest == east) {
562 if (pmt == 1)
return bbq[buffer][14][4];
563 if (pmt == 2)
return bbq[buffer][14][12];
564 if (pmt == 3)
return bbq[buffer][14][13];
567 if (pmt == 1)
return bbq[buffer][14][20];
568 if (pmt == 2)
return bbq[buffer][14][28];
569 if (pmt == 3)
return bbq[buffer][14][29];
575 unsigned short StTriggerData2016::zdcHardwareSum(
int prepost)
const
577 int buffer = prepostAddress(prepost);
578 if (buffer >= 0)
return bbq[buffer][14][11];
582 bool StTriggerData2016::zdcSMDPresent(
int prepost)
const
584 int buffer = prepostAddress(prepost);
585 if (buffer >= 0)
return mMXQ[buffer];
589 unsigned short StTriggerData2016::zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost)
const
591 static const int zdcsmd_map[2][2][8] ={
592 { { 31, 30, 29, 28, 27, 26, 25, 19} ,
593 { 24, 23, 22, 21, 20, 16, 18, 17} } ,
594 { { 15, 14, 13, 12, 11, 10, 9, 2} ,
595 { 8, 7, 6, 5, 4, 3, 0, 1} }
597 static const int zdcsmd_map2011[2][2][8] ={
598 { {24, 25, 26, 27, 28, 29, 30, 31} ,
599 {16, 17, 18, 19, 20, 21, 22, 23} } ,
600 { {8, 9, 10, 11, 12, 13, 14, 15} ,
601 {0, 1, 2, 3, 4, 5, 6, 7} }
603 if (verthori<0 || verthori>1)
return 0;
604 if (strip<1 || strip>8)
return 0;
605 int buffer = prepostAddress(prepost);
608 return mxq[buffer][4][zdcsmd_map[eastwest][verthori][strip-1]];
610 return mxq[buffer][4][zdcsmd_map2011[eastwest][verthori][strip-1]];
616 unsigned short StTriggerData2016::zdcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
618 int buffer = prepostAddress(prepost);
622 if (eastwest==east) {
return ((mBBC[buffer]->ZDClayer1[3] >> 12) % 16) | ((mBBC[buffer]->ZDClayer1[2] % 256) << 4);}
623 else {
return (mBBC[buffer]->ZDClayer1[3]) % 4096;}
625 if (eastwest==east) {
return ((mBBC[buffer]->ZDClayer1[3] >> 10) % 64) | ((mBBC[buffer]->ZDClayer1[2] % 16) << 6);}
626 else {
return (mBBC[buffer]->ZDClayer1[3]) % 1024;}
633 bool StTriggerData2016::zdcSumADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
634 int buffer = prepostAddress(prepost);
638 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (27-16));}
639 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (24-16));}
641 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (25-16));}
642 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (22-16));}
649 bool StTriggerData2016::zdcFrontADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
650 int buffer = prepostAddress(prepost);
654 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (29-16));}
655 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (26-16));}
657 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (23-16));}
658 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (20-16));}
665 bool StTriggerData2016::zdcBackADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
666 int buffer = prepostAddress(prepost);
670 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (28-16));}
671 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (25-16));}
673 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (24-16));}
674 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (21-16));}
681 unsigned short StTriggerData2016::zdcTimeDifference()
const
683 return L1_DSM->VTX[1]%1024;
686 bool StTriggerData2016::zdcSumADCaboveThresholdL2(StBeamDirection eastwest)
const {
687 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 10 : 11));
690 bool StTriggerData2016::zdcFrontADCaboveThresholdL2(StBeamDirection eastwest)
const {
691 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 12 : 14));
694 bool StTriggerData2016::zdcBackADCaboveThresholdL2(StBeamDirection eastwest)
const {
695 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 13 : 15));
698 bool StTriggerData2016::zdcSumADCaboveThresholdL3(StBeamDirection eastwest)
const {
699 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 7 : 8)); }
700 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 7 : 8)); }
703 bool StTriggerData2016::zdcFrontADCaboveThresholdL3(StBeamDirection eastwest)
const {
704 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 9 : 11)); }
705 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 9 : 11)); }
708 bool StTriggerData2016::zdcBackADCaboveThresholdL3(StBeamDirection eastwest)
const {
709 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 10 : 12)); }
710 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 10 : 12)); }
713 bool StTriggerData2016::zdcTimeDifferenceInWindow()
const
715 if(mRun<12000000){
return lastDSM(2) & (1 << 6); }
716 else {
return lastDSM(1) & (1 << 6); }
719 unsigned short StTriggerData2016::zdcSMDHighestStrip(StBeamDirection eastwest,
int verthori,
int prepost)
const
721 if(mRun<12000000)
return 0;
723 int buffer = prepostAddress(prepost);
726 if (eastwest==east) {
return (mBBC[buffer]->ZDClayer1[1] >> (verthori ? 6 : 9)) % 8;}
727 else {
return (mBBC[buffer]->ZDClayer1[1] >> (verthori ? 0 : 3)) % 8;}
733 unsigned short StTriggerData2016::zdcTruncatedSum(StBeamDirection eastwest,
int prepost)
const
735 if(mRun<12000000)
return 0;
736 int buffer = prepostAddress(prepost);
739 if (eastwest==east) {
return (mBBC[buffer]->ZDClayer1[2] >> (26-16)) % 8;}
740 else {
return (mBBC[buffer]->ZDClayer1[2] >> (29-16)) % 8;}
746 unsigned short StTriggerData2016::pp2ppADC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost)
const
748 static const int map[2][2][2][2] ={ { { { 0, 1}, { 2, 3} } , { {16,17}, {18,19} } , } ,
749 { { { 8, 9}, {10,11} } , { {24,25}, {26,27} } , } };
750 if (vh<0 || vh>1)
return 0;
751 if (udio<0 || udio>1)
return 0;
752 if (ch<0 || ch>1)
return 0;
753 int buffer = prepostAddress(prepost);
754 if (buffer >= 0)
return mxq[buffer][2][map[eastwest][vh][udio][ch]];
758 unsigned short StTriggerData2016::pp2ppTAC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost)
const
760 static const int map[2][2][2][2] ={ { { { 0, 1}, { 2, 3} } , { {16,17}, {18,19} } , } ,
761 { { { 8, 9}, {10,11} } , { {24,25}, {26,27} } , } };
762 if (vh<0 || vh>1)
return 0;
763 if (udio<0 || udio>1)
return 0;
764 if (ch<0 || ch>1)
return 0;
765 int buffer = prepostAddress(prepost);
766 if (buffer >= 0)
return mxq[buffer][2][map[eastwest][vh][udio][ch]+4];
770 unsigned long StTriggerData2016::pp2ppDSM(
int prepost)
const {
771 if (prepost!=0)
return 0;
772 return L1_DSM->TOF[7];
775 unsigned short StTriggerData2016::bemcLayer1DSM(
int channel,
int prepost)
const {
776 const int n_bemc_layer1=48;
777 if (channel<0 || channel >=n_bemc_layer1) {
778 gMessMgr->Warning() <<
"Barrel DSM layer 1 out of range (" << channel <<
")" << endm;
781 int buffer = prepostAddress(prepost);
782 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->BEMClayer1[channel];
786 unsigned short StTriggerData2016::eemcLayer1DSM(
int channel,
int prepost)
const {
787 const int n_eemc_layer1=16;
788 if (channel<0 || channel >=n_eemc_layer1) {
789 gMessMgr->Warning() <<
"Endap DSM layer 1 out of range (" << channel <<
")" << endm;
792 int buffer = prepostAddress(prepost);
793 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMClayer1[channel];
797 unsigned short StTriggerData2016::emcLayer2DSM(
int channel)
const {
798 const int n_emc_layer2=8;
799 if (channel<0 || channel >=n_emc_layer2) {
800 gMessMgr->Warning() <<
"EMC DSM layer 2 out of range (" << channel <<
")" << endm;
803 return L1_DSM->EMC[channel];
806 unsigned short StTriggerData2016::tpcMaskDSM(
int channel)
const {
807 const int n_tpcMask=8;
808 if (channel<0 || channel >=n_tpcMask) {
809 gMessMgr->Warning() <<
"TPCMask DSM out of range (" << channel <<
")" << endm;
812 return L1_DSM->TPCMask[channel];
815 unsigned char StTriggerData2016::bemcHighTower(
int patch_id,
int prepost)
const {
817 const int m_max_patch=300;
818 if ( patch_id < 0 || patch_id >= m_max_patch) {
819 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
822 int buffer = prepostAddress(prepost);
825 int channel=patch_id%10;
826 unsigned short trg_word;
829 trg_word=decodeEmc12bit(dsm-15,channel,mBCE[buffer]->BEMCEast);
835 trg_word=decodeEmc12bit(dsm,channel,mBCW[buffer]->BEMCWest);
839 return trg_word & 0x3F;
844 unsigned char StTriggerData2016::bemcJetPatch (
int patch_id,
int prepost)
const
847 const int m_max_patch=300;
848 if ( patch_id < 0 || patch_id >= m_max_patch) {
849 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
852 int buffer = prepostAddress(prepost);
855 int channel=patch_id%10;
856 unsigned short trg_word;
859 trg_word=decodeEmc12bit(dsm-15,channel,mBCE[buffer]->BEMCEast);
865 trg_word=decodeEmc12bit(dsm,channel,mBCW[buffer]->BEMCWest);
869 return trg_word >> 6;
875 unsigned char StTriggerData2016::eemcHighTower(
int patch_id,
int prepost)
const
878 const int m_max_patch=90;
879 if ( patch_id < 0 || patch_id >= m_max_patch) {
880 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
883 int buffer = prepostAddress(prepost);
884 if (buffer >= 0 && mBC1[buffer]) {
886 int channel=patch_id%10;
887 unsigned short trg_word = decodeEmc12bit(dsm,channel,mBC1[buffer]->EEMC);
888 return trg_word & 0x3F;
893 unsigned char StTriggerData2016::eemcJetPatch (
int patch_id,
int prepost)
const
896 const int m_max_patch=90;
897 if ( patch_id < 0 || patch_id >= m_max_patch) {
898 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
901 int buffer = prepostAddress(prepost);
902 if (buffer >= 0 && mBC1[buffer]) {
904 int channel=patch_id%10;
905 unsigned short trg_word = decodeEmc12bit(dsm,channel,mBC1[buffer]->EEMC);
906 return trg_word >> 6;
911 unsigned char StTriggerData2016::bemcHighestTowerADC(
int prepost)
const {
913 const int m_max_patch=300;
915 for (
int i=1; i<m_max_patch; i++){
916 unsigned char hh=bemcHighTower(i,prepost);
922 unsigned char StTriggerData2016::eemcHighestTowerADC(
int prepost)
const {
924 const int m_max_patch=90;
926 for (
int i=1; i<m_max_patch; i++){
927 unsigned char hh=eemcHighTower(i,prepost);
933 char* StTriggerData2016::getTriggerStructure()
935 return (
char*) mData;
943 int StTriggerData2016::getRawSize()
const
945 return mData->totalTriggerLength;
948 unsigned char* StTriggerData2016::getDsm0_BEMCE(
int prepost)
const {
949 int buffer = prepostAddress(prepost);
950 if (buffer >= 0)
if (mBCE[buffer])
return mBCE[buffer]->BEMCEast;
954 unsigned char* StTriggerData2016::getDsm0_BEMCW(
int prepost)
const {
955 int buffer = prepostAddress(prepost);
956 if (buffer >= 0)
if (mBCW[buffer])
return mBCW[buffer]->BEMCWest;
960 unsigned short* StTriggerData2016::getDsm1_BEMC(
int prepost)
const {
961 int buffer = prepostAddress(prepost);
962 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->BEMClayer1;
966 unsigned char* StTriggerData2016::getDsm0_EEMC(
int prepost)
const {
967 int buffer = prepostAddress(prepost);
968 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMC;
972 unsigned short* StTriggerData2016::getDsm1_EEMC(
int prepost)
const{
973 int buffer = prepostAddress(prepost);
974 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMClayer1;
978 unsigned short* StTriggerData2016::getDsm2_EMC()
const{
982 unsigned short* StTriggerData2016::getDsm3()
const{
983 return L1_DSM->lastDSM;
986 int StTriggerData2016::L2ResultsOffset(StL2AlgorithmId
id)
const
989 default:
return -999999999;
993 bool StTriggerData2016::isL2Triggered(StL2TriggerResultType
id)
const
998 unsigned int StTriggerData2016::l2ResultLength()
const
1000 return sizeof(TrgSum->L2Result)/
sizeof(
unsigned int);
1003 const unsigned int* StTriggerData2016::l2Result()
const
1005 return TrgSum->L2Result;
1008 unsigned long long StTriggerData2016::l2sum()
const
1012 unsigned long long hi = TrgSum->L2Sum[1];
1013 unsigned long long lo = TrgSum->L2Sum[0];
1014 unsigned long long mask=(hi<<32) | lo;
1018 unsigned short StTriggerData2016::vpdADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
1020 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1021 if (pmt<1 || pmt>16)
return 0;
1022 int buffer = prepostAddress(prepost);
1024 if (mRun<=12003001) {
return bbq[buffer][10+(int)eastwest*2][map[pmt-1]];}
1025 else {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]];}
1030 unsigned short StTriggerData2016::vpdTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
1032 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1033 if (pmt<1 || pmt>16)
return 0;
1034 int buffer = prepostAddress(prepost);
1036 if (mRun<=12003001) {
return bbq[buffer][10+(int)eastwest*2][map[pmt-1]+4];}
1037 else {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]+4];}
1042 unsigned short StTriggerData2016::vpdADCHighThr(StBeamDirection eastwest,
int pmt,
int prepost)
const
1044 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1045 if (pmt<1 || pmt>16)
return 0;
1046 int buffer = prepostAddress(prepost);
1048 if (mRun<=12003001) {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]];}
1049 else {
return mxq[buffer][6+(int)eastwest*2][map[pmt-1]];}
1054 unsigned short StTriggerData2016::vpdTDCHighThr(StBeamDirection eastwest,
int pmt,
int prepost)
const
1056 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1057 if (pmt<1 || pmt>16)
return 0;
1058 int buffer = prepostAddress(prepost);
1060 if (mRun<=12003001) {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]+4];}
1061 else {
return mxq[buffer][6+(int)eastwest*2][map[pmt-1]+4];};
1066 unsigned short StTriggerData2016::vpdEarliestTDC(StBeamDirection eastwest,
int prepost)
const
1068 int buffer = prepostAddress(prepost);
1071 if (mRun<=10096084){
1072 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1073 else {
return mBBC[buffer]->VPD[4]%4096;}
1075 else if(mRun<=12003001) {
1076 if (eastwest==east) {
return mBBC[buffer]->VPD[2]%4096;}
1077 else {
return mBBC[buffer]->VPD[0]%4096;}
1080 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1081 else {
return mBBC[buffer]->VPD[4]%4096;}
1089 unsigned short StTriggerData2016::vpdEarliestTDCHighThr(StBeamDirection eastwest,
int prepost)
const
1091 int buffer = prepostAddress(prepost);
1093 if (mRun<=10365999){
1096 else if(mRun<=12003001) {
1098 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1099 else {
return mBBC[buffer]->VPD[4]%4096;}
1101 }
else if(mRun<=14001001){
1103 if (eastwest==east) {
return mMIX[buffer]->MTD_P2PLayer1[13] + ((mMIX[buffer]->MTD_P2PLayer1[12]&0x0f)<<8);}
1104 else {
return mMIX[buffer]->MTD_P2PLayer1[9] + ((mMIX[buffer]->MTD_P2PLayer1[8]&0x0f)<<8);}
1108 if (eastwest==east) {
return mMIX[buffer]->MTD_P2PLayer1[11] + ((mMIX[buffer]->MTD_P2PLayer1[10]&0xf)<<8);}
1109 else {
return (mMIX[buffer]->MTD_P2PLayer1[10]>>4) + ((mMIX[buffer]->MTD_P2PLayer1[9]&0xff)<<4);}
1116 unsigned short StTriggerData2016::vpdTimeDifference()
const
1118 return L1_DSM->VTX[7]%8192;
1122 unsigned short StTriggerData2016::bbcVP101(
int ch,
int prepost)
const
1124 int map[8]={3, 2, 1, 0, 7, 6, 5, 4};
1125 if(ch<0 || ch>7)
return 0;
1126 int buffer = prepostAddress(prepost);
1127 if (buffer >= 0 && mBBC[buffer]){
1128 return mBBC[buffer]->VPD[map[ch]];
1134 unsigned short StTriggerData2016::dsmTF201Ch(
int ch)
const
1136 int map[8]={3, 2, 1, 0, 7, 6, 5, 4};
1137 return L1_DSM->TOF[map[ch]];
1140 unsigned short StTriggerData2016::mtd4AtAddress(
int address,
int prepost)
const
1142 if (mRun<=15001001)
return 0;
1143 int buffer = prepostAddress(prepost);
1144 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][14][address];
1148 unsigned short StTriggerData2016::nQTdata(
int prepost)
const
1153 unsigned int* StTriggerData2016::QTdata(
int prepost)
const
1158 unsigned short StTriggerData2016::fmsADC(
int crt,
int adr,
int ch,
int prepost)
const
1160 int buffer = prepostAddress(prepost);
1161 if (buffer >= 0 && crt>=1 && crt<=5 && adr>=0 && adr<16 && ch>=0 && ch<=31){
1163 case 1:
return qt1[buffer][adr][ch];
1164 case 2:
return qt2[buffer][adr][ch];
1165 case 3:
return qt3[buffer][adr][ch];
1166 case 4:
return qt4[buffer][adr][ch];
1167 case 5:
return feq[buffer][adr][ch];
1173 unsigned short StTriggerData2016::fmsTDC(
int crt,
int adr,
int ch,
int prepost)
const
1175 int buffer = prepostAddress(prepost);
1176 if (buffer >= 0 && crt>=1 && crt<=5 && adr>=0 && adr<16 && ch>=0 && ch<=31){
1178 case 1:
return tqt1[buffer][adr][ch];
1179 case 2:
return tqt2[buffer][adr][ch];
1180 case 3:
return tqt3[buffer][adr][ch];
1181 case 4:
return tqt4[buffer][adr][ch];
1182 case 5:
return tfeq[buffer][adr][ch];
1188 unsigned char* StTriggerData2016::getDsm_FMS(
int prepost)
const
1190 int buffer = prepostAddress(prepost);
1191 if (buffer >= 0)
if (mFMS[buffer])
return mFMS[buffer]->FMS;
1195 unsigned short* StTriggerData2016::getDsm1_FMS(
int prepost)
const
1197 int buffer = prepostAddress(prepost);
1198 if (buffer >= 0)
if (mMIX[buffer])
return mMIX[buffer]->FPDEastNSLayer1;
1202 unsigned short* StTriggerData2016::getDsm2_FMS()
const {
return L1_DSM->FPD;}
1204 unsigned short StTriggerData2016::mxqAtSlotAddress(
int address,
int prepost,
int slot)
const
1206 int buffer = prepostAddress(prepost);
1207 if (buffer >= 0 && address>=0 && address<32){
1208 if (slot >= 0 && slot<16){
1209 return mxq[buffer][slot][address];
1215 unsigned short StTriggerData2016::mtdQtAtCh(
int qtid,
int address,
int prepost)
const
1217 int map1[4] = {0, 10, 12, 14};
1218 int map2[8] = {0, 9, 10, 11, 12, 13, 14, 15};
1220 int buffer = prepostAddress(prepost);
1221 if(buffer>=0 && qtid>0 && address>=0 && address<32){
1223 if(qtid>1)
return 0;
1224 else return mxq[buffer][map1[qtid-1]][address];
1226 else if(mRun<=14001001){
1227 if(qtid>2)
return 0;
1228 else return mxq[buffer][map1[qtid-1]][address];
1230 else if(mRun<=15001001){
1231 if(qtid>3)
return 0;
1232 else return mxq[buffer][map1[qtid-1]][address];
1234 else if(mRun<=17001001){
1235 if(qtid>4)
return 0;
1236 else return mxq[buffer][map1[qtid-1]][address];
1239 if(qtid>8)
return 0;
1240 else return mxq[buffer][map2[qtid-1]][address];
1247 unsigned short StTriggerData2016::mtdAtAddress(
int address,
int prepost)
const
1249 int buffer = prepostAddress(prepost);
1250 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][0][address];
1254 unsigned short StTriggerData2016::mtdgemAtAddress(
int address,
int prepost)
const
1256 if (mRun<=12003001)
return 0;
1257 int buffer = prepostAddress(prepost);
1258 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][10][address];
1262 unsigned short StTriggerData2016::mtd3AtAddress(
int address,
int prepost)
const
1264 if (mRun<=14001001)
return 0;
1265 int buffer = prepostAddress(prepost);
1266 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][12][address];
1271 unsigned short StTriggerData2016::mtdAdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
1274 int buffer = prepostAddress(prepost);
1275 if (buffer >= 0 && pmt==0){
1276 if (eastwest==east) {
1277 if (mRun<=10133008)
return mxq[buffer][0][0];
1278 else return mxq[buffer][0][24];
1280 if (eastwest==west)
return mxq[buffer][0][8];
1285 unsigned short StTriggerData2016::mtdTdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
1288 int buffer = prepostAddress(prepost);
1289 if (buffer >= 0 && pmt==0){
1290 if (eastwest==east) {
1291 if (mRun<=10133008)
return mxq[buffer][0][4];
1292 else return mxq[buffer][0][28];
1294 if (eastwest==west)
return mxq[buffer][0][12];
1299 unsigned char StTriggerData2016::mtdDsmAtCh(
int ch,
int prepost)
const
1301 int map[16] = {7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8};
1302 int map2[8] = {3, 2, 1, 0, 7, 6, 5, 4};
1303 int buffer = prepostAddress(prepost);
1304 if (buffer >= 0 && ch>=0){
1307 return mMIX[buffer]->MTD_P2PLayer1[map[ch]];
1309 int add= 8 + map2[(ch-16)/2];
1311 if(ch%2==0){ v=(
unsigned char)((mMIX[buffer]->TPCpreMask[add] & 0xff00)>>8);}
1312 else { v=(
unsigned char)((mMIX[buffer]->TPCpreMask[add] & 0x00ff) );}
1320 bool StTriggerData2016::mtdDsmHit(
int pmt,
int prepost)
const
1323 int buffer = prepostAddress(prepost);
1326 if(mRun<10133008 && mRun<11000000){
1327 if( (mMIX[buffer]->MTD_P2PLayer1[5] & 0x1) && (mMIX[buffer]->MTD_P2PLayer1[5] & 0x10) )
return true;
1330 if(prepost!=0)
return false;
1331 return (L1_DSM->TOF[3] & 0x1);
1338 unsigned short StTriggerData2016::mtdVpdTacDiff()
const
1340 return (L1_DSM->TOF[3] & 0x3fff);
1343 unsigned short StTriggerData2016::tofAtAddress(
int address,
int prepost)
const
1345 int buffer = prepostAddress(prepost);
1346 if (buffer>=0 && address>=0 && address<48) {
1347 if (mMIX[buffer])
return mMIX[buffer]->TOF[address];
1352 unsigned short StTriggerData2016::tofTrayMultiplicity(
int tray,
int prepost)
const
1354 int dsmmap[8] = {3,2,1,0,7,6,5,4};
1355 int traydsm[120] = { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5,
1356 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3,
1357 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
1358 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
1359 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
1360 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
1361 int traych[120] = { 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1362 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1363 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1364 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17,
1365 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17,
1366 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17};
1367 int buffer = prepostAddress(prepost);
1368 if (buffer>=0 && tray>=1 && tray<=120) {
1370 int address = traydsm[tray-1]*8 + dsmmap[traych[tray-1]/3];
1371 int ch = traych[tray-1]%3;
1372 return (mMIX[buffer]->TOF[address] >> (5*ch)) & 0x1f;
1378 unsigned short StTriggerData2016::tofMultiplicity(
int prepost)
const
1380 if (prepost==0)
return L1_DSM->TOF[1]%8192;
1384 void StTriggerData2016::dump()
const
1386 printf(
"***** StTriggerData Dump *****\n");
1387 printf(
" mDebug=%d mData=%p\n",mDebug,mData);
1388 printf(
" Year=%d Version=%x\n",year(),version());
1389 printf(
" Run#=%d Event#=%d\n",mRun,eventNumber());
1390 printf(
" %d pre and %d post crossing data available\n",numberOfPreXing(),numberOfPostXing());
1391 printf(
" Token=%d TriggerWord=%x ActionWord=%x BusyStatus=%x\n",
1392 token(), triggerWord(), actionWord(), busyStatus());
1393 printf(
" TUC Bits=%d : ",tcuBits());
1394 for (
int i=0; i<16; i++) {printf(
" %d",(tcuBits()>>(15-i))%2);}; printf(
"\n");
1395 printf(
" BunchId 7bit=%d 48bit=%d\n",bunchId7Bit(), bunchId48Bit());
1396 printf(
" Spin Bits=%d : ",spinBit());
1397 for (
int i=0; i<8; i++) {printf(
" %d",(spinBit()>>(7-i))%2);}; printf(
"\n");
1399 printf(
" BBC East ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(east,i,0)); }; printf(
"\n");
1400 printf(
" BBC West ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(west,i,0)); }; printf(
"\n");
1401 printf(
" BBC East TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(east,i,0)); }; printf(
"\n");
1402 printf(
" BBC West TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(west,i,0)); }; printf(
"\n");
1403 for (
int i=-numberOfPreXing(); i<=static_cast<int>(numberOfPostXing()); i++){
1404 printf(
" BBC Sums %d xing : ",i);
1405 printf(
"East=%d West=%d Large tile East=%d West=%d\n",
1406 bbcADCSum(east,i),bbcADCSum(west,i),
1407 bbcADCSumLargeTile(east,i),bbcADCSumLargeTile(west,i));
1409 printf(
" BBC Earilest : "); printf(
"East=%d West=%d Difference+256=%d\n",
1410 bbcEarliestTDC(east,0),bbcEarliestTDC(west,0),bbcTimeDifference());
1411 printf(
" ZDC Earilest : "); printf(
"East=%d West=%d Difference=%d\n",
1412 zdcEarliestTDC(east,0),zdcEarliestTDC(west,0),zdcTimeDifference());
1424 printf(
" ZDC Sum(A) East : ");printf(
"%d ",zdcAttenuated(east)); printf(
"\n");
1425 printf(
" ZDC Sum(A) West : ");printf(
"%d ",zdcAttenuated(west)); printf(
"\n");
1426 printf(
" ZDC Sum(UA) East : ");printf(
"%d ",zdcUnAttenuated(east)); printf(
"\n");
1427 printf(
" ZDC Sum(UA) West : ");printf(
"%d ",zdcUnAttenuated(west)); printf(
"\n");
1428 printf(
" VPD E Earliest TAC : %d\n", vpdEarliestTDC(east));
1429 printf(
" VPD W Earliest TAC : %d\n", vpdEarliestTDC(west));
1430 printf(
" VPD TimeDifference : %d\n", vpdTimeDifference());
1431 printf(
" L2 result : \n");
1432 for (
int j=0; j<4 ;j++) {
for (
int k=0; k<16; k++) {printf(
"%u ",*(l2Result()+j*16+k)); } printf(
"\n");}
1433 printf(
"BBClayer1:");
1434 int buffer = prepostAddress(0);
1437 for (
int i = 0;i < 16;i++) printf(
" %1x %04X", i, mBBC[buffer]->BBClayer1[i]);
1441 printf(
"ZDClayer1:");
1444 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, mBBC[buffer]->ZDClayer1[i]);
1448 printf(
"VPDlayer1:");
1451 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, mBBC[buffer]->VPD[i]);
1457 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, L1_DSM->VTX[i]);
1460 printf(
"Last DSM:");
1462 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, L1_DSM->lastDSM[i]);
1465 printf(
"***** End StTriggerData Dump *****\n");
1468 void StTriggerData2016::killFMS(){
1470 int npre = numberOfPreXing();
1471 int npost = numberOfPostXing();
1472 for (
int i=0; i<1+npre+npost; i++){
1474 {offlen = mData->MainX;}
1476 if (mData->PrePostList[i-1]==0)
continue;
1477 offlen = (
TrgOfflen2016*) ((
char*)mData + mData->PrePostList[i-1]);
1480 j=offlen[y16FEQ_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y16FEQ_CONF_NUM].offset, 0, j); offlen[y16FEQ_CONF_NUM].length=0;};
1481 j=offlen[y16QT1_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y16QT1_CONF_NUM].offset, 0, j); offlen[y16QT1_CONF_NUM].length=0;};
1482 j=offlen[y16QT2_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y16QT2_CONF_NUM].offset, 0, j); offlen[y16QT2_CONF_NUM].length=0;};
1483 j=offlen[y16QT3_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y16QT3_CONF_NUM].offset, 0, j); offlen[y16QT3_CONF_NUM].length=0;};
1484 j=offlen[y16QT4_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y16QT4_CONF_NUM].offset, 0, j); offlen[y16QT4_CONF_NUM].length=0;};
1488 void StTriggerData2016::swapRawDet(
DataBlock2016* data,
int name,
int hlength,
int bs)
1494 int header_length = 8;
1495 if(bs) swapI((
unsigned int*)&data->length);
1497 case y16MXQ_CONF_NUM :
case y16FEQ_CONF_NUM :
case y16BBQ_CONF_NUM :
1498 case y16QT1_CONF_NUM :
case y16QT2_CONF_NUM :
case y16QT3_CONF_NUM :
case y16QT4_CONF_NUM :
1499 header_length = 12;
break;
1501 if (hlength != data->length + header_length){
1502 mErrorFlag = mErrorFlag | (1 << name);
1503 printf(
"StTriggerData2016: Error reading Block=%2d [%1c%1c%1c%1c] length %d != %d + %d\n",
1504 name,data->name[0],data->name[1],data->name[2],data->name[3],
1505 hlength,data->length,header_length);
1506 printf(
"StTriggerData2016: Droping the data block =%2d [%1c%1c%1c%1c] with ErrorFlag=0x%x\n",
1507 name,data->name[0],data->name[1],data->name[2],data->name[3],mErrorFlag);
1513 case y16BC1_CONF_NUM :
1515 swapSSn((
unsigned int*)bc1->BEMClayer1,48);
1516 swapSSn((
unsigned int*)bc1->EEMClayer1,16);
1518 case y16MIX_CONF_NUM :
1520 swapSSn((
unsigned int*)mix->FPDEastNSLayer1,8);
1521 swapSSn((
unsigned int*)mix->TOFLayer1,8+48);
1523 case y16BCW_CONF_NUM :
1526 case y16BCE_CONF_NUM :
1529 case y16BBC_CONF_NUM :
1531 swapSSn((
unsigned int*)bbc->BBClayer1,16+8+8);
1533 case y16FMS_CONF_NUM :
1536 case y16MXQ_CONF_NUM :
1537 case y16FEQ_CONF_NUM :
1538 case y16BBQ_CONF_NUM :
1539 case y16QT1_CONF_NUM :
1540 case y16QT2_CONF_NUM :
1541 case y16QT3_CONF_NUM :
1542 case y16QT4_CONF_NUM :
1544 swapI((
unsigned int*)&qtdata->dataLoss);
1545 swapIn(qtdata->data, qtdata->length/4);
1550 printf(
"Read id=%2d name=%1c%1c%1c%1c length=%d\n",
1551 name,data->name[0],data->name[1],data->name[2],data->name[3],data->length);
1554 void StTriggerData2016::Streamer(TBuffer &R__b)
1558 if (R__b.IsReading()) {
1559 R__b.ReadClassBuffer(StTriggerData2016::Class(),
this);
1561 if(mData) readData();
1564 R__b.WriteClassBuffer(StTriggerData2016::Class(),
this);