29 #include "StTriggerData2013.h"
42 mYear=2013; mRun = run; mDebug = 0;
49 mYear=2013; mRun = run; mDebug = dbg;
50 if(mDebug==1) printf(
"StTriggerData2013 Constructor with trigger data block and byteswap option=%d\n",bs);
57 if (data==0) {copyflag=0;}
58 if(mDebug==1) printf(
"StTriggerData2013::readData copyflag=%d byteswap=%d data=%p mData=%p\n",copyflag,bs,data,mData);
61 unsigned int ver = data->FormatVersion;
64 if (ver == y13FORMAT_VERSION ) {
65 if (mDebug==1) printf(
"StTriggerData2013: version = 0x%x (0x%x or 0x08121140)\n",ver,y13FORMAT_VERSION);
68 mErrorFlag = mErrorFlag | 0x1;
69 printf(
"StTriggerData2013: version = 0x%x != (0x%x)\n",ver,y13FORMAT_VERSION);
73 unsigned int size = data->totalTriggerLength;
75 if (size > y13MAX_TRG_BLK_SIZE) {
76 gMessMgr->Warning() <<
"StTriggerData2013: Data length = " << size
77 <<
" is bigger than max = " << y13MAX_TRG_BLK_SIZE
81 if (mDebug==1) printf(
"StTriggerData2013: size = %d, maxsize = %d\n",size,y13MAX_TRG_BLK_SIZE);
82 memcpy(mData,data,size);
86 if (bs) swapDataBlk(mData);
88 printf(
"StTriggerData2013: version = 0x%x (0x%x)\n",mData->FormatVersion,y13FORMAT_VERSION);
89 printf(
"StTriggerData2013: size = %d, maxsize = %d\n",mData->totalTriggerLength,y13MAX_TRG_BLK_SIZE);
90 printf(
"EventDesc length=%10d offset=%10d\n",mData->EventDesc_ofl.length,mData->EventDesc_ofl.offset);
91 printf(
"L1_DSM length=%10d offset=%10d\n",mData->L1_DSM_ofl.length,mData->L1_DSM_ofl.offset);
92 printf(
"Summary length=%10d offset=%10d\n",mData->Summary_ofl.length,mData->Summary_ofl.offset);
95 EvtDesc=0; L1_DSM=0; TrgSum=0;
96 if (mData->EventDesc_ofl.length > 0) EvtDesc = (
EvtDescData2013*)((
char*)mData + mData->EventDesc_ofl.offset);
97 if (mData->L1_DSM_ofl.length > 0) L1_DSM = (
L1_DSM_Data2013*)((
char*)mData + mData->L1_DSM_ofl.offset);
98 if (mData->Summary_ofl.length > 0) TrgSum = (
TrgSumData2013* )((
char*)mData + mData->Summary_ofl.offset);
100 if (EvtDesc) swapEvtDesc(EvtDesc);
101 if (L1_DSM) swapL1_DSM(L1_DSM);
102 if (TrgSum) swapTrgSum(TrgSum);
104 if (EvtDesc==0 || L1_DSM==0 || TrgSum==0){
105 mErrorFlag = mErrorFlag | 0x1;
106 gMessMgr->Warning() <<
"StTriggerData2013: EvtDesc, L1_DSM or TrgSum is missing"
107 <<
" mErrorFlag="<<mErrorFlag<<endm;
110 int npre = numberOfPreXing();
111 int npost = numberOfPostXing();
112 if (npre<0 || npre>10 || npost<0 || npost>10){
113 mErrorFlag = mErrorFlag | 0x2;
114 gMessMgr->Warning() <<
"StTriggerData2013: Invalid npre/post = "<< npre <<
" / " << npost
115 <<
" mErrorFlag="<<mErrorFlag<<endm;
117 if (mDebug==1) printf(
"StTriggerData2013: pre=%d post=%d\n",npre,npost);
119 memset(mBC1,0,
sizeof(mBC1));
120 memset(mMXQ,0,
sizeof(mMXQ));
121 memset(mMIX,0,
sizeof(mMIX));
122 memset(mBCW,0,
sizeof(mBCW));
123 memset(mBCE,0,
sizeof(mBCE));
124 memset(mFEQ,0,
sizeof(mFEQ));
125 memset(mBBC,0,
sizeof(mBBC));
126 memset(mBBQ,0,
sizeof(mBBQ));
127 memset(mFMS,0,
sizeof(mFMS));
128 memset(mQT1,0,
sizeof(mQT1));
129 memset(mQT2,0,
sizeof(mQT2));
130 memset(mQT3,0,
sizeof(mQT3));
131 memset(mQT4,0,
sizeof(mQT4));
132 memset(mxq,0,
sizeof(mxq)); memset(tmxq,0,
sizeof(tmxq));
133 memset(feq,0,
sizeof(feq)); memset(tfeq,0,
sizeof(tfeq));
134 memset(bbq,0,
sizeof(bbq)); memset(tbbq,0,
sizeof(tbbq));
135 memset(qt1,0,
sizeof(qt1)); memset(tqt1,0,
sizeof(tqt1));
136 memset(qt2,0,
sizeof(qt2)); memset(tqt2,0,
sizeof(tqt2));
137 memset(qt3,0,
sizeof(qt3)); memset(tqt3,0,
sizeof(tqt3));
138 memset(qt4,0,
sizeof(qt4)); memset(tqt4,0,
sizeof(tqt4));
141 for (
int i=0; i<1+npre+npost; i++){
144 offlen = mData->MainX;
148 if (mData->PrePostList[i-1]==0)
continue;
149 offlen = (
TrgOfflen2013*) ((
char*)mData + mData->PrePostList[i-1]);
151 if (bs) swapRawDetOfflen(offlen);
152 for(
int k=0; k<y13MAX_OFFLEN; k++){
153 if(static_cast<unsigned int>(offlen[k].length + offlen[k].offset) > static_cast<unsigned int>(mData->totalTriggerLength)) {
154 mErrorFlag = mErrorFlag | (1 << k);
155 gMessMgr->Warning() <<
"StTriggerData2013: offset ("<<offlen[k].offset<<
") + length ("<<offlen[k].length
156 <<
") exceeds total size("<<mData->totalTriggerLength<<
") for data block id="<<k
157 <<
" mErrorFlag="<<mErrorFlag<<endm;
161 j=offlen[y13BC1_CONF_NUM].length;
if (j>0){mBC1[i] = (
BELayerBlock2013*)((
char*)mData + offlen[y13BC1_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mBC1[i],y13BC1_CONF_NUM,j,bs);}
162 j=offlen[y13MXQ_CONF_NUM].length;
if (j>0){mMXQ[i] = (
QTBlock2013* )((
char*)mData + offlen[y13MXQ_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mMXQ[i],y13MXQ_CONF_NUM,j,bs);}
163 j=offlen[y13MIX_CONF_NUM].length;
if (j>0){mMIX[i] = (
MIXBlock2013* )((
char*)mData + offlen[y13MIX_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mMIX[i],y13MIX_CONF_NUM,j,bs);}
164 j=offlen[y13BCW_CONF_NUM].length;
if (j>0){mBCW[i] = (
BWestBlock2013* )((
char*)mData + offlen[y13BCW_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mBCW[i],y13BCW_CONF_NUM,j,bs);}
165 j=offlen[y13BCE_CONF_NUM].length;
if (j>0){mBCE[i] = (
BEastBlock2013* )((
char*)mData + offlen[y13BCE_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mBCE[i],y13BCE_CONF_NUM,j,bs);}
166 j=offlen[y13FEQ_CONF_NUM].length;
if (j>0){mFEQ[i] = (
QTBlock2013* )((
char*)mData + offlen[y13FEQ_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mFEQ[i],y13FEQ_CONF_NUM,j,bs);}
167 j=offlen[y13BBC_CONF_NUM].length;
if (j>0){mBBC[i] = (
BBCBlock2013* )((
char*)mData + offlen[y13BBC_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mBBC[i],y13BBC_CONF_NUM,j,bs);}
168 j=offlen[y13BBQ_CONF_NUM].length;
if (j>0){mBBQ[i] = (
QTBlock2013* )((
char*)mData + offlen[y13BBQ_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mBBQ[i],y13BBQ_CONF_NUM,j,bs);}
169 j=offlen[y13FMS_CONF_NUM].length;
if (j>0){mFMS[i] = (
FMSBlock2013* )((
char*)mData + offlen[y13FMS_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mFMS[i],y13FMS_CONF_NUM,j,bs);}
170 j=offlen[y13QT1_CONF_NUM].length;
if (j>0){mQT1[i] = (
QTBlock2013* )((
char*)mData + offlen[y13QT1_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mQT1[i],y13QT1_CONF_NUM,j,bs);}
171 j=offlen[y13QT2_CONF_NUM].length;
if (j>0){mQT2[i] = (
QTBlock2013* )((
char*)mData + offlen[y13QT2_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mQT2[i],y13QT2_CONF_NUM,j,bs);}
172 j=offlen[y13QT3_CONF_NUM].length;
if (j>0){mQT3[i] = (
QTBlock2013* )((
char*)mData + offlen[y13QT3_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mQT3[i],y13QT3_CONF_NUM,j,bs);}
173 j=offlen[y13QT4_CONF_NUM].length;
if (j>0){mQT4[i] = (
QTBlock2013* )((
char*)mData + offlen[y13QT4_CONF_NUM].offset); swapRawDet((
DataBlock2013*)mQT4[i],y13QT4_CONF_NUM,j,bs);}
174 if (mMXQ[i]) decodeQT(mMXQ[i]->length/4, mMXQ[i]->data, mxq[i], tmxq[i]);
175 if (mFEQ[i]) decodeQT(mFEQ[i]->length/4, mFEQ[i]->data, feq[i], tfeq[i]);
176 if (mBBQ[i]) decodeQT(mBBQ[i]->length/4, mBBQ[i]->data, bbq[i], tbbq[i]);
177 if (mQT1[i]) decodeQT(mQT1[i]->length/4, mQT1[i]->data, qt1[i], tqt1[i]);
178 if (mQT2[i]) decodeQT(mQT2[i]->length/4, mQT2[i]->data, qt2[i], tqt2[i]);
179 if (mQT3[i]) decodeQT(mQT3[i]->length/4, mQT3[i]->data, qt3[i], tqt3[i]);
180 if (mQT4[i]) decodeQT(mQT4[i]->length/4, mQT4[i]->data, qt4[i], tqt4[i]);
182 if (mDebug==1) dump();
185 StTriggerData2013::~StTriggerData2013() {
delete mData;}
187 unsigned int StTriggerData2013::version()
const
189 return EvtDesc->TrgDataFmtVer;
192 unsigned int StTriggerData2013::eventNumber()
const
194 return mData->eventNumber;
197 unsigned int StTriggerData2013::token()
const
199 return EvtDesc->TrgToken;
202 unsigned int StTriggerData2013::triggerWord()
const
204 return EvtDesc->TriggerWord;
207 unsigned int StTriggerData2013::actionWord()
const
210 ( (
unsigned short)(EvtDesc->actionWdTrgCommand) * 16 * 16 * 16 ) +
211 ( (
unsigned short)(EvtDesc->actionWdDaqCommand) * 16 * 16 ) +
212 ( EvtDesc->actionWdDetectorBitMask & 0x00ff );
215 unsigned int StTriggerData2013::numberOfPreXing()
const
217 return EvtDesc->npre;
220 unsigned int StTriggerData2013::numberOfPostXing()
const
222 return EvtDesc->npost;
225 unsigned short StTriggerData2013::busyStatus()
const{
226 return EvtDesc->internalBusy;
229 unsigned short StTriggerData2013::dsmInput()
const{
230 return EvtDesc->DSMInput;
233 unsigned short StTriggerData2013::trgToken()
const{
234 return EvtDesc->TrgToken;
237 unsigned short StTriggerData2013::dsmAddress()
const{
238 return EvtDesc->DSMAddress;
241 unsigned short StTriggerData2013::mAddBits()
const{
242 return EvtDesc->addBits;
245 unsigned short StTriggerData2013::bcData(
int channel)
const{
246 return L1_DSM->BCdata[channel];
249 unsigned short StTriggerData2013::lastDSM(
int channel)
const{
250 return L1_DSM->lastDSM[channel];
253 unsigned short StTriggerData2013::tcuBits()
const
255 return EvtDesc->DSMInput;
258 unsigned int StTriggerData2013::bunchCounterHigh()
const
260 return EvtDesc->bunchXing_hi;
263 unsigned int StTriggerData2013::bunchCounterLow()
const
265 return EvtDesc->bunchXing_lo;
268 unsigned int StTriggerData2013::bunchId48Bit()
const
270 unsigned long long bxinghi,bxing1,bxinglo, bx;
271 bxinghi = L1_DSM->BCdata[3];
272 bxing1 = L1_DSM->BCdata[10];
273 bxinglo = (bxing1 << 16) + L1_DSM->BCdata[11];
274 bx = (bxinghi << 32) + bxinglo;
275 return (
int)(bx % 120);
278 unsigned int StTriggerData2013::bunchId7Bit()
const
281 b7dat = L1_DSM->BCdata[2];
286 unsigned int StTriggerData2013::spinBit()
const
289 return (L1_DSM->lastDSM[7]/16)%256;
291 return (L1_DSM->lastDSM[4]/16)%256;
295 unsigned int StTriggerData2013::spinBitYellowFilled()
const
297 unsigned int sb = spinBit();
301 unsigned int StTriggerData2013::spinBitYellowUp()
const
303 unsigned int sb = spinBit();
307 unsigned int StTriggerData2013::spinBitYellowDown()
const
309 unsigned int sb = spinBit();
313 unsigned int StTriggerData2013::spinBitYellowUnpol()
const
315 unsigned int sb = spinBit();
319 unsigned int StTriggerData2013::spinBitBlueFilled()
const
321 unsigned int sb = spinBit();
325 unsigned int StTriggerData2013::spinBitBlueUp()
const
327 unsigned int sb = spinBit();
331 unsigned int StTriggerData2013::spinBitBlueDown()
const
333 unsigned int sb = spinBit();
337 unsigned int StTriggerData2013::spinBitBlueUnpol()
const
339 unsigned int sb = spinBit();
343 unsigned short StTriggerData2013::bbcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
345 const int addrmap[2][24] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
346 4, 4, 4, 4, 4, 4, 4, 4},
347 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
348 4, 4, 4, 4, 4, 4, 4, 4} };
349 const int chmap[2][24] = { { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
350 0, 1, 2, 3, 8, 9,10,11},
351 { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
352 16,17,18,19,24,25,26,27} };
353 int buffer = prepostAddress(prepost);
354 if (buffer >= 0 && pmt>=1 && pmt<=24)
return bbq[buffer][addrmap[eastwest][pmt-1]][chmap[eastwest][pmt-1]];
358 unsigned short StTriggerData2013::bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
360 const int addrmap[2][24] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
361 4, 4, 4, 4, 4, 4, 4, 4},
362 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
363 4, 4, 4, 4, 4, 4, 4, 4} };
364 const int chmap[2][24] = { { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
365 0, 1, 2, 3, 8, 9,10,11},
366 { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
367 16,17,18,19,24,25,26,27} };
368 int buffer = prepostAddress(prepost);
369 if (buffer >= 0 && pmt>=1 && pmt<=24)
return bbq[buffer][addrmap[eastwest][pmt-1]][chmap[eastwest][pmt-1]+4];
373 unsigned short StTriggerData2013::bbcADCSum(StBeamDirection eastwest,
int prepost)
const
375 unsigned short sum=0;
376 int buffer = prepostAddress(prepost);
380 if(eastwest==east) { sum = mBBC[buffer]->BBClayer1[3]; }
381 else { sum = mBBC[buffer]->BBClayer1[1]; }
387 unsigned short StTriggerData2013::bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost)
const
389 unsigned short sum=0;
390 int buffer = prepostAddress(prepost);
391 if (buffer >= 0)
for(
int i=17; i<=24; i++) {sum+=bbcADC(eastwest,i,prepost);}
395 unsigned short StTriggerData2013::bbcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
397 int buffer = prepostAddress(prepost);
400 if (eastwest==east) {
return mBBC[buffer]->BBClayer1[2]%4096;}
401 else {
return mBBC[buffer]->BBClayer1[0]%4096;}
407 unsigned short StTriggerData2013::bbcTimeDifference()
const
409 return L1_DSM->VTX[3]%8192;
412 unsigned short StTriggerData2013::bbcEarliestTDCLarge(StBeamDirection eastwest,
int prepost)
const
414 int buffer = prepostAddress(prepost);
417 if (eastwest==east) {
return mBBC[buffer]->BBClayer1[11] & 0x0fff;}
418 else {
return ((mBBC[buffer]->BBClayer1[11] & 0xf000) >> 12)
419 +((mBBC[buffer]->BBClayer1[10] & 0x00ff) << 4 );}
425 unsigned short StTriggerData2013::bbcTimeDifferenceLarge()
const
427 return L1_DSM->VTX[2]%8192;
431 unsigned short StTriggerData2013::fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost)
const
436 unsigned short StTriggerData2013::fpdSum(StBeamDirection eastwest,
int module)
const
441 unsigned short StTriggerData2013::fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost)
const{
442 int buffer = prepostAddress(prepost);
444 if (eastwest==east) {
if (mMIX[buffer])
return mMIX[buffer]->FPDEastNSLayer1[channel]; }
445 else {
if (mFMS[buffer])
return mFMS[buffer]->FMS[channel]; }
450 unsigned short StTriggerData2013::fpdLayer2DSMRaw(
int channel)
const{
451 if (channel<8)
return L1_DSM->FPD[channel];
455 bool StTriggerData2013::zdcPresent(
int prepost)
const
457 int buffer = prepostAddress(prepost);
458 if (buffer >= 0)
return mBBQ[buffer];
462 unsigned short StTriggerData2013::zdcAtChannel(
int channel,
int prepost)
const
464 int buffer = prepostAddress(prepost);
465 if (buffer >= 0 && channel>=0 && channel<32)
return bbq[buffer][14][channel];
469 unsigned short StTriggerData2013::zdcAtAddress(
int address,
int prepost)
const
471 return zdcAtChannel(address,prepost);
474 unsigned short StTriggerData2013::zdcUnAttenuated(StBeamDirection eastwest,
int prepost)
const
476 int buffer = prepostAddress(prepost);
478 if (eastwest == east)
return bbq[buffer][14][2];
479 else return bbq[buffer][14][18];
484 unsigned short StTriggerData2013::zdcAttenuated(StBeamDirection eastwest,
int prepost)
const
486 int buffer = prepostAddress(prepost);
488 if (eastwest == east)
return bbq[buffer][14][3];
489 else return bbq[buffer][14][19];
494 unsigned short StTriggerData2013::zdcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
496 int buffer = prepostAddress(prepost);
497 if (buffer >= 0 && pmt>=1 && pmt<=3) {
498 if (eastwest == east) {
499 if (pmt == 1)
return bbq[buffer][14][0];
500 if (pmt == 2)
return bbq[buffer][14][8];
501 if (pmt == 3)
return bbq[buffer][14][9];
504 if (pmt == 1)
return bbq[buffer][14][16];
505 if (pmt == 2)
return bbq[buffer][14][24];
506 if (pmt == 3)
return bbq[buffer][14][25];
512 unsigned short StTriggerData2013::zdcTDC(StBeamDirection eastwest,
int prepost)
const
514 int buffer = prepostAddress(prepost);
516 if (eastwest == east)
return bbq[buffer][14][6];
517 else return bbq[buffer][14][22];
522 unsigned short StTriggerData2013::zdcPmtTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
524 int buffer = prepostAddress(prepost);
525 if (buffer >= 0 && pmt>=1 && pmt<=3) {
526 if (eastwest == east) {
527 if (pmt == 1)
return bbq[buffer][14][4];
528 if (pmt == 2)
return bbq[buffer][14][12];
529 if (pmt == 3)
return bbq[buffer][14][13];
532 if (pmt == 1)
return bbq[buffer][14][20];
533 if (pmt == 2)
return bbq[buffer][14][28];
534 if (pmt == 3)
return bbq[buffer][14][29];
540 unsigned short StTriggerData2013::zdcHardwareSum(
int prepost)
const
542 int buffer = prepostAddress(prepost);
543 if (buffer >= 0)
return bbq[buffer][14][11];
547 bool StTriggerData2013::zdcSMDPresent(
int prepost)
const
549 int buffer = prepostAddress(prepost);
550 if (buffer >= 0)
return mMXQ[buffer];
554 unsigned short StTriggerData2013::zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost)
const
556 static const int zdcsmd_map[2][2][8] ={
557 { { 31, 30, 29, 28, 27, 26, 25, 19} ,
558 { 24, 23, 22, 21, 20, 16, 18, 17} } ,
559 { { 15, 14, 13, 12, 11, 10, 9, 2} ,
560 { 8, 7, 6, 5, 4, 3, 0, 1} }
562 static const int zdcsmd_map2011[2][2][8] ={
563 { {24, 25, 26, 27, 28, 29, 30, 31} ,
564 {16, 17, 18, 19, 20, 21, 22, 23} } ,
565 { {8, 9, 10, 11, 12, 13, 14, 15} ,
566 {0, 1, 2, 3, 4, 5, 6, 7} }
568 if (verthori<0 || verthori>1)
return 0;
569 if (strip<1 || strip>8)
return 0;
570 int buffer = prepostAddress(prepost);
573 return mxq[buffer][4][zdcsmd_map[eastwest][verthori][strip-1]];
575 return mxq[buffer][4][zdcsmd_map2011[eastwest][verthori][strip-1]];
581 unsigned short StTriggerData2013::zdcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
583 int buffer = prepostAddress(prepost);
587 if (eastwest==east) {
return ((mBBC[buffer]->ZDClayer1[3] >> 12) % 16) | ((mBBC[buffer]->ZDClayer1[2] % 256) << 4);}
588 else {
return (mBBC[buffer]->ZDClayer1[3]) % 4096;}
590 if (eastwest==east) {
return ((mBBC[buffer]->ZDClayer1[3] >> 10) % 64) | ((mBBC[buffer]->ZDClayer1[2] % 16) << 6);}
591 else {
return (mBBC[buffer]->ZDClayer1[3]) % 1024;}
598 bool StTriggerData2013::zdcSumADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
599 int buffer = prepostAddress(prepost);
603 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (27-16));}
604 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (24-16));}
606 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (25-16));}
607 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (22-16));}
614 bool StTriggerData2013::zdcFrontADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
615 int buffer = prepostAddress(prepost);
619 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (29-16));}
620 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (26-16));}
622 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (23-16));}
623 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (20-16));}
630 bool StTriggerData2013::zdcBackADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
631 int buffer = prepostAddress(prepost);
635 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (28-16));}
636 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (25-16));}
638 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (24-16));}
639 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (21-16));}
646 unsigned short StTriggerData2013::zdcTimeDifference()
const
648 return L1_DSM->VTX[1]%1024;
651 bool StTriggerData2013::zdcSumADCaboveThresholdL2(StBeamDirection eastwest)
const {
652 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 10 : 11));
655 bool StTriggerData2013::zdcFrontADCaboveThresholdL2(StBeamDirection eastwest)
const {
656 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 12 : 14));
659 bool StTriggerData2013::zdcBackADCaboveThresholdL2(StBeamDirection eastwest)
const {
660 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 13 : 15));
663 bool StTriggerData2013::zdcSumADCaboveThresholdL3(StBeamDirection eastwest)
const {
664 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 7 : 8)); }
665 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 7 : 8)); }
668 bool StTriggerData2013::zdcFrontADCaboveThresholdL3(StBeamDirection eastwest)
const {
669 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 9 : 11)); }
670 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 9 : 11)); }
673 bool StTriggerData2013::zdcBackADCaboveThresholdL3(StBeamDirection eastwest)
const {
674 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 10 : 12)); }
675 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 10 : 12)); }
678 bool StTriggerData2013::zdcTimeDifferenceInWindow()
const
680 if(mRun<12000000){
return lastDSM(2) & (1 << 6); }
681 else {
return lastDSM(1) & (1 << 6); }
684 unsigned short StTriggerData2013::zdcSMDHighestStrip(StBeamDirection eastwest,
int verthori,
int prepost)
const
686 if(mRun<12000000)
return 0;
688 int buffer = prepostAddress(prepost);
691 if (eastwest==east) {
return (mBBC[buffer]->ZDClayer1[1] >> (verthori ? 6 : 9)) % 8;}
692 else {
return (mBBC[buffer]->ZDClayer1[1] >> (verthori ? 0 : 3)) % 8;}
698 unsigned short StTriggerData2013::zdcTruncatedSum(StBeamDirection eastwest,
int prepost)
const
700 if(mRun<12000000)
return 0;
701 int buffer = prepostAddress(prepost);
704 if (eastwest==east) {
return (mBBC[buffer]->ZDClayer1[2] >> (26-16)) % 8;}
705 else {
return (mBBC[buffer]->ZDClayer1[2] >> (29-16)) % 8;}
711 unsigned short StTriggerData2013::pp2ppADC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost)
const
713 static const int map[2][2][2][2] ={ { { { 0, 1}, { 2, 3} } , { {16,17}, {18,19} } , } ,
714 { { { 8, 9}, {10,11} } , { {24,25}, {26,27} } , } };
715 if (vh<0 || vh>1)
return 0;
716 if (udio<0 || udio>1)
return 0;
717 if (ch<0 || ch>1)
return 0;
718 int buffer = prepostAddress(prepost);
719 if (buffer >= 0)
return mxq[buffer][2][map[eastwest][vh][udio][ch]];
723 unsigned short StTriggerData2013::pp2ppTAC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost)
const
725 static const int map[2][2][2][2] ={ { { { 0, 1}, { 2, 3} } , { {16,17}, {18,19} } , } ,
726 { { { 8, 9}, {10,11} } , { {24,25}, {26,27} } , } };
727 if (vh<0 || vh>1)
return 0;
728 if (udio<0 || udio>1)
return 0;
729 if (ch<0 || ch>1)
return 0;
730 int buffer = prepostAddress(prepost);
731 if (buffer >= 0)
return mxq[buffer][2][map[eastwest][vh][udio][ch]+4];
735 unsigned long StTriggerData2013::pp2ppDSM(
int prepost)
const {
736 if (prepost!=0)
return 0;
737 return L1_DSM->TOF[7];
740 unsigned short StTriggerData2013::bemcLayer1DSM(
int channel,
int prepost)
const {
741 const int n_bemc_layer1=48;
742 if (channel<0 || channel >=n_bemc_layer1) {
743 gMessMgr->Warning() <<
"Barrel DSM layer 1 out of range (" << channel <<
")" << endm;
746 int buffer = prepostAddress(prepost);
747 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->BEMClayer1[channel];
751 unsigned short StTriggerData2013::eemcLayer1DSM(
int channel,
int prepost)
const {
752 const int n_eemc_layer1=16;
753 if (channel<0 || channel >=n_eemc_layer1) {
754 gMessMgr->Warning() <<
"Endap DSM layer 1 out of range (" << channel <<
")" << endm;
757 int buffer = prepostAddress(prepost);
758 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMClayer1[channel];
762 unsigned short StTriggerData2013::emcLayer2DSM(
int channel)
const {
763 const int n_emc_layer2=8;
764 if (channel<0 || channel >=n_emc_layer2) {
765 gMessMgr->Warning() <<
"EMC DSM layer 2 out of range (" << channel <<
")" << endm;
768 return L1_DSM->EMC[channel];
771 unsigned short StTriggerData2013::tpcMaskDSM(
int channel)
const {
772 const int n_tpcMask=8;
773 if (channel<0 || channel >=n_tpcMask) {
774 gMessMgr->Warning() <<
"TPCMask DSM out of range (" << channel <<
")" << endm;
777 return L1_DSM->TPCMask[channel];
780 unsigned char StTriggerData2013::bemcHighTower(
int patch_id,
int prepost)
const {
782 const int m_max_patch=300;
783 if ( patch_id < 0 || patch_id >= m_max_patch) {
784 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
787 int buffer = prepostAddress(prepost);
790 int channel=patch_id%10;
791 unsigned short trg_word;
794 trg_word=decodeEmc12bit(dsm-15,channel,mBCE[buffer]->BEMCEast);
800 trg_word=decodeEmc12bit(dsm,channel,mBCW[buffer]->BEMCWest);
804 return trg_word & 0x3F;
809 unsigned char StTriggerData2013::bemcJetPatch (
int patch_id,
int prepost)
const
812 const int m_max_patch=300;
813 if ( patch_id < 0 || patch_id >= m_max_patch) {
814 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
817 int buffer = prepostAddress(prepost);
820 int channel=patch_id%10;
821 unsigned short trg_word;
824 trg_word=decodeEmc12bit(dsm-15,channel,mBCE[buffer]->BEMCEast);
830 trg_word=decodeEmc12bit(dsm,channel,mBCW[buffer]->BEMCWest);
834 return trg_word >> 6;
840 unsigned char StTriggerData2013::eemcHighTower(
int patch_id,
int prepost)
const
843 const int m_max_patch=90;
844 if ( patch_id < 0 || patch_id >= m_max_patch) {
845 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
848 int buffer = prepostAddress(prepost);
849 if (buffer >= 0 && mBC1[buffer]) {
851 int channel=patch_id%10;
852 unsigned short trg_word = decodeEmc12bit(dsm,channel,mBC1[buffer]->EEMC);
853 return trg_word & 0x3F;
858 unsigned char StTriggerData2013::eemcJetPatch (
int patch_id,
int prepost)
const
861 const int m_max_patch=90;
862 if ( patch_id < 0 || patch_id >= m_max_patch) {
863 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
866 int buffer = prepostAddress(prepost);
867 if (buffer >= 0 && mBC1[buffer]) {
869 int channel=patch_id%10;
870 unsigned short trg_word = decodeEmc12bit(dsm,channel,mBC1[buffer]->EEMC);
871 return trg_word >> 6;
876 unsigned char StTriggerData2013::bemcHighestTowerADC(
int prepost)
const {
878 const int m_max_patch=300;
880 for (
int i=1; i<m_max_patch; i++){
881 unsigned char hh=bemcHighTower(i,prepost);
887 unsigned char StTriggerData2013::eemcHighestTowerADC(
int prepost)
const {
889 const int m_max_patch=90;
891 for (
int i=1; i<m_max_patch; i++){
892 unsigned char hh=eemcHighTower(i,prepost);
898 char* StTriggerData2013::getTriggerStructure()
900 return (
char*) mData;
908 int StTriggerData2013::getRawSize()
const
910 return mData->totalTriggerLength;
913 unsigned char* StTriggerData2013::getDsm0_BEMCE(
int prepost)
const {
914 int buffer = prepostAddress(prepost);
915 if (buffer >= 0)
if (mBCE[buffer])
return mBCE[buffer]->BEMCEast;
919 unsigned char* StTriggerData2013::getDsm0_BEMCW(
int prepost)
const {
920 int buffer = prepostAddress(prepost);
921 if (buffer >= 0)
if (mBCW[buffer])
return mBCW[buffer]->BEMCWest;
925 unsigned short* StTriggerData2013::getDsm1_BEMC(
int prepost)
const {
926 int buffer = prepostAddress(prepost);
927 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->BEMClayer1;
931 unsigned char* StTriggerData2013::getDsm0_EEMC(
int prepost)
const {
932 int buffer = prepostAddress(prepost);
933 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMC;
937 unsigned short* StTriggerData2013::getDsm1_EEMC(
int prepost)
const{
938 int buffer = prepostAddress(prepost);
939 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMClayer1;
943 unsigned short* StTriggerData2013::getDsm2_EMC()
const{
947 unsigned short* StTriggerData2013::getDsm3()
const{
948 return L1_DSM->lastDSM;
951 int StTriggerData2013::L2ResultsOffset(StL2AlgorithmId
id)
const
954 default:
return -999999999;
958 bool StTriggerData2013::isL2Triggered(StL2TriggerResultType
id)
const
963 unsigned int StTriggerData2013::l2ResultLength()
const
965 return sizeof(TrgSum->L2Result)/
sizeof(
unsigned int);
968 const unsigned int* StTriggerData2013::l2Result()
const
970 return TrgSum->L2Result;
973 unsigned long long StTriggerData2013::l2sum()
const
977 unsigned long long hi = TrgSum->L2Sum[1];
978 unsigned long long lo = TrgSum->L2Sum[0];
979 unsigned long long mask=(hi<<32) | lo;
983 unsigned short StTriggerData2013::vpdADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
985 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
986 if (pmt<1 || pmt>16)
return 0;
987 int buffer = prepostAddress(prepost);
989 if (mRun<=12003001) {
return bbq[buffer][10+(int)eastwest*2][map[pmt-1]];}
990 else {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]];}
995 unsigned short StTriggerData2013::vpdTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
997 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
998 if (pmt<1 || pmt>16)
return 0;
999 int buffer = prepostAddress(prepost);
1001 if (mRun<=12003001) {
return bbq[buffer][10+(int)eastwest*2][map[pmt-1]+4];}
1002 else {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]+4];}
1007 unsigned short StTriggerData2013::vpdADCHighThr(StBeamDirection eastwest,
int pmt,
int prepost)
const
1009 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1010 if (pmt<1 || pmt>16)
return 0;
1011 int buffer = prepostAddress(prepost);
1013 if (mRun<=12003001) {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]];}
1014 else {
return mxq[buffer][6+(int)eastwest*2][map[pmt-1]];}
1019 unsigned short StTriggerData2013::vpdTDCHighThr(StBeamDirection eastwest,
int pmt,
int prepost)
const
1021 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1022 if (pmt<1 || pmt>16)
return 0;
1023 int buffer = prepostAddress(prepost);
1025 if (mRun<=12003001) {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]+4];}
1026 else {
return mxq[buffer][6+(int)eastwest*2][map[pmt-1]+4];};
1031 unsigned short StTriggerData2013::vpdEarliestTDC(StBeamDirection eastwest,
int prepost)
const
1033 int buffer = prepostAddress(prepost);
1036 if (mRun<=10096084){
1037 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1038 else {
return mBBC[buffer]->VPD[4]%4096;}
1040 else if(mRun<=12003001) {
1041 if (eastwest==east) {
return mBBC[buffer]->VPD[2]%4096;}
1042 else {
return mBBC[buffer]->VPD[0]%4096;}
1045 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1046 else {
return mBBC[buffer]->VPD[4]%4096;}
1054 unsigned short StTriggerData2013::vpdEarliestTDCHighThr(StBeamDirection eastwest,
int prepost)
const
1056 int buffer = prepostAddress(prepost);
1058 if (mRun<=10365999){
1061 else if(mRun<=12003001) {
1063 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1064 else {
return mBBC[buffer]->VPD[4]%4096;}
1066 }
else if(mRun<=14001001){
1068 if (eastwest==east) {
return mMIX[buffer]->MTD_P2PLayer1[13] + ((mMIX[buffer]->MTD_P2PLayer1[12]&0x0f)<<8);}
1069 else {
return mMIX[buffer]->MTD_P2PLayer1[9] + ((mMIX[buffer]->MTD_P2PLayer1[8]&0x0f)<<8);}
1073 if (eastwest==east) {
return mMIX[buffer]->MTD_P2PLayer1[11] + ((mMIX[buffer]->MTD_P2PLayer1[10]&0xf)<<8);}
1074 else {
return (mMIX[buffer]->MTD_P2PLayer1[10]>>4) + ((mMIX[buffer]->MTD_P2PLayer1[9]&0xff)<<4);}
1081 unsigned short StTriggerData2013::vpdTimeDifference()
const
1083 return L1_DSM->VTX[7]%8192;
1086 unsigned short StTriggerData2013::dsmTF201Ch(
int ch)
const
1088 int map[8]={3, 2, 1, 0, 7, 6, 5, 4};
1089 return L1_DSM->TOF[map[ch]];
1092 unsigned short StTriggerData2013::mtd4AtAddress(
int address,
int prepost)
const
1094 if (mRun<=15001001)
return 0;
1095 int buffer = prepostAddress(prepost);
1096 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][14][address];
1100 unsigned short StTriggerData2013::nQTdata(
int prepost)
const
1105 unsigned int* StTriggerData2013::QTdata(
int prepost)
const
1110 unsigned short StTriggerData2013::fmsADC(
int crt,
int adr,
int ch,
int prepost)
const
1112 int buffer = prepostAddress(prepost);
1113 if (buffer >= 0 && crt>=1 && crt<=5 && adr>=0 && adr<16 && ch>=0 && ch<=31){
1115 case 1:
return qt1[buffer][adr][ch];
1116 case 2:
return qt2[buffer][adr][ch];
1117 case 3:
return qt3[buffer][adr][ch];
1118 case 4:
return qt4[buffer][adr][ch];
1119 case 5:
return feq[buffer][adr][ch];
1125 unsigned short StTriggerData2013::fmsTDC(
int crt,
int adr,
int ch,
int prepost)
const
1127 int buffer = prepostAddress(prepost);
1128 if (buffer >= 0 && crt>=1 && crt<=5 && adr>=0 && adr<16 && ch>=0 && ch<=31){
1130 case 1:
return tqt1[buffer][adr][ch];
1131 case 2:
return tqt2[buffer][adr][ch];
1132 case 3:
return tqt3[buffer][adr][ch];
1133 case 4:
return tqt4[buffer][adr][ch];
1134 case 5:
return tfeq[buffer][adr][ch];
1140 unsigned char* StTriggerData2013::getDsm_FMS(
int prepost)
const
1142 int buffer = prepostAddress(prepost);
1143 if (buffer >= 0)
if (mFMS[buffer])
return mFMS[buffer]->FMS;
1147 unsigned short* StTriggerData2013::getDsm1_FMS(
int prepost)
const
1149 int buffer = prepostAddress(prepost);
1150 if (buffer >= 0)
if (mMIX[buffer])
return mMIX[buffer]->FPDEastNSLayer1;
1154 unsigned short* StTriggerData2013::getDsm2_FMS()
const {
return L1_DSM->FPD;}
1156 unsigned short StTriggerData2013::mxqAtSlotAddress(
int address,
int prepost,
int slot)
const
1158 int buffer = prepostAddress(prepost);
1159 if (buffer >= 0 && address>=0 && address<32){
1160 if (slot >= 0 && slot<16){
1161 return mxq[buffer][slot][address];
1167 unsigned short StTriggerData2013::mtdAtAddress(
int address,
int prepost)
const
1169 int buffer = prepostAddress(prepost);
1170 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][0][address];
1174 unsigned short StTriggerData2013::mtdgemAtAddress(
int address,
int prepost)
const
1176 if (mRun<=12003001)
return 0;
1177 int buffer = prepostAddress(prepost);
1178 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][10][address];
1182 unsigned short StTriggerData2013::mtd3AtAddress(
int address,
int prepost)
const
1184 if (mRun<=14001001)
return 0;
1185 int buffer = prepostAddress(prepost);
1186 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][12][address];
1191 unsigned short StTriggerData2013::mtdAdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
1194 int buffer = prepostAddress(prepost);
1195 if (buffer >= 0 && pmt==0){
1196 if (eastwest==east) {
1197 if (mRun<=10133008)
return mxq[buffer][0][0];
1198 else return mxq[buffer][0][24];
1200 if (eastwest==west)
return mxq[buffer][0][8];
1205 unsigned short StTriggerData2013::mtdTdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
1208 int buffer = prepostAddress(prepost);
1209 if (buffer >= 0 && pmt==0){
1210 if (eastwest==east) {
1211 if (mRun<=10133008)
return mxq[buffer][0][4];
1212 else return mxq[buffer][0][28];
1214 if (eastwest==west)
return mxq[buffer][0][12];
1219 unsigned char StTriggerData2013::mtdDsmAtCh(
int ch,
int prepost)
const
1221 int map[16] = {7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8};
1222 int buffer = prepostAddress(prepost);
1223 if (buffer >= 0 && ch>=0 && ch<16){
1224 if (mMIX[buffer])
return mMIX[buffer]->MTD_P2PLayer1[map[ch]];
1229 bool StTriggerData2013::mtdDsmHit(
int pmt,
int prepost)
const
1232 int buffer = prepostAddress(prepost);
1235 if(mRun<10133008 && mRun<11000000){
1236 if( (mMIX[buffer]->MTD_P2PLayer1[5] & 0x1) && (mMIX[buffer]->MTD_P2PLayer1[5] & 0x10) )
return true;
1239 if(prepost!=0)
return false;
1240 return (L1_DSM->TOF[3] & 0x1);
1247 unsigned short StTriggerData2013::mtdVpdTacDiff()
const
1249 return (L1_DSM->TOF[3] & 0x3fff);
1252 unsigned short StTriggerData2013::tofAtAddress(
int address,
int prepost)
const
1254 int buffer = prepostAddress(prepost);
1255 if (buffer>=0 && address>=0 && address<48) {
1256 if (mMIX[buffer])
return mMIX[buffer]->TOF[address];
1261 unsigned short StTriggerData2013::tofTrayMultiplicity(
int tray,
int prepost)
const
1263 int dsmmap[8] = {3,2,1,0,7,6,5,4};
1264 int traydsm[120] = { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5,
1265 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3,
1266 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
1267 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
1268 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
1269 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
1270 int traych[120] = { 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1271 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1272 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1273 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17,
1274 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17,
1275 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17};
1276 int buffer = prepostAddress(prepost);
1277 if (buffer>=0 && tray>=1 && tray<=120) {
1279 int address = traydsm[tray-1]*8 + dsmmap[traych[tray-1]/3];
1280 int ch = traych[tray-1]%3;
1281 return (mMIX[buffer]->TOF[address] >> (5*ch)) & 0x1f;
1287 unsigned short StTriggerData2013::tofMultiplicity(
int prepost)
const
1289 if (prepost==0)
return L1_DSM->TOF[1]%8192;
1293 void StTriggerData2013::dump()
const
1295 printf(
"***** StTriggerData Dump *****\n");
1296 printf(
" mDebug=%d mData=%p\n",mDebug,mData);
1297 printf(
" Year=%d Version=%x\n",year(),version());
1298 printf(
" Run#=%d Event#=%d\n",mRun,eventNumber());
1299 printf(
" %d pre and %d post crossing data available\n",numberOfPreXing(),numberOfPostXing());
1300 printf(
" Token=%d TriggerWord=%x ActionWord=%x BusyStatus=%x\n",
1301 token(), triggerWord(), actionWord(), busyStatus());
1302 printf(
" TUC Bits=%d : ",tcuBits());
1303 for (
int i=0; i<16; i++) {printf(
" %d",(tcuBits()>>(15-i))%2);}; printf(
"\n");
1304 printf(
" BunchId 7bit=%d 48bit=%d\n",bunchId7Bit(), bunchId48Bit());
1305 printf(
" Spin Bits=%d : ",spinBit());
1306 for (
int i=0; i<8; i++) {printf(
" %d",(spinBit()>>(7-i))%2);}; printf(
"\n");
1308 printf(
" BBC East ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(east,i,0)); }; printf(
"\n");
1309 printf(
" BBC West ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(west,i,0)); }; printf(
"\n");
1310 printf(
" BBC East TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(east,i,0)); }; printf(
"\n");
1311 printf(
" BBC West TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(west,i,0)); }; printf(
"\n");
1312 for (
int i=-numberOfPreXing(); i<=static_cast<int>(numberOfPostXing()); i++){
1313 printf(
" BBC Sums %d xing : ",i);
1314 printf(
"East=%d West=%d Large tile East=%d West=%d\n",
1315 bbcADCSum(east,i),bbcADCSum(west,i),
1316 bbcADCSumLargeTile(east,i),bbcADCSumLargeTile(west,i));
1318 printf(
" BBC Earilest : "); printf(
"East=%d West=%d Difference+256=%d\n",
1319 bbcEarliestTDC(east,0),bbcEarliestTDC(west,0),bbcTimeDifference());
1320 printf(
" ZDC Earilest : "); printf(
"East=%d West=%d Difference=%d\n",
1321 zdcEarliestTDC(east,0),zdcEarliestTDC(west,0),zdcTimeDifference());
1333 printf(
" ZDC Sum(A) East : ");printf(
"%d ",zdcAttenuated(east)); printf(
"\n");
1334 printf(
" ZDC Sum(A) West : ");printf(
"%d ",zdcAttenuated(west)); printf(
"\n");
1335 printf(
" ZDC Sum(UA) East : ");printf(
"%d ",zdcUnAttenuated(east)); printf(
"\n");
1336 printf(
" ZDC Sum(UA) West : ");printf(
"%d ",zdcUnAttenuated(west)); printf(
"\n");
1337 printf(
" VPD E Earliest TAC : %d\n", vpdEarliestTDC(east));
1338 printf(
" VPD W Earliest TAC : %d\n", vpdEarliestTDC(west));
1339 printf(
" VPD TimeDifference : %d\n", vpdTimeDifference());
1340 printf(
" L2 result : \n");
1341 for (
int j=0; j<4 ;j++) {
for (
int k=0; k<16; k++) {printf(
"%u ",*(l2Result()+j*16+k)); } printf(
"\n");}
1342 printf(
"BBClayer1:");
1343 int buffer = prepostAddress(0);
1346 for (
int i = 0;i < 16;i++) printf(
" %1x %04X", i, mBBC[buffer]->BBClayer1[i]);
1350 printf(
"ZDClayer1:");
1353 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, mBBC[buffer]->ZDClayer1[i]);
1357 printf(
"VPDlayer1:");
1360 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, mBBC[buffer]->VPD[i]);
1366 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, L1_DSM->VTX[i]);
1369 printf(
"Last DSM:");
1371 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, L1_DSM->lastDSM[i]);
1374 printf(
"***** End StTriggerData Dump *****\n");
1377 void StTriggerData2013::killFMS(){
1379 int npre = numberOfPreXing();
1380 int npost = numberOfPostXing();
1381 for (
int i=0; i<1+npre+npost; i++){
1383 {offlen = mData->MainX;}
1385 if (mData->PrePostList[i-1]==0)
continue;
1386 offlen = (
TrgOfflen2013*) ((
char*)mData + mData->PrePostList[i-1]);
1389 j=offlen[y13FEQ_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y13FEQ_CONF_NUM].offset, 0, j); offlen[y13FEQ_CONF_NUM].length=0;};
1390 j=offlen[y13QT1_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y13QT1_CONF_NUM].offset, 0, j); offlen[y13QT1_CONF_NUM].length=0;};
1391 j=offlen[y13QT2_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y13QT2_CONF_NUM].offset, 0, j); offlen[y13QT2_CONF_NUM].length=0;};
1392 j=offlen[y13QT3_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y13QT3_CONF_NUM].offset, 0, j); offlen[y13QT3_CONF_NUM].length=0;};
1393 j=offlen[y13QT4_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y13QT4_CONF_NUM].offset, 0, j); offlen[y13QT4_CONF_NUM].length=0;};
1397 void StTriggerData2013::swapRawDet(
DataBlock2013* data,
int name,
int hlength,
int bs)
1403 int header_length = 8;
1404 if(bs) swapI((
unsigned int*)&data->length);
1406 case y13MXQ_CONF_NUM :
case y13FEQ_CONF_NUM :
case y13BBQ_CONF_NUM :
1407 case y13QT1_CONF_NUM :
case y13QT2_CONF_NUM :
case y13QT3_CONF_NUM :
case y13QT4_CONF_NUM :
1408 header_length = 12;
break;
1410 if (hlength != data->length + header_length){
1411 mErrorFlag = mErrorFlag | (1 << name);
1412 printf(
"StTriggerData2013: Error reading Block=%2d [%1c%1c%1c%1c] length %d != %d + %d\n",
1413 name,data->name[0],data->name[1],data->name[2],data->name[3],
1414 hlength,data->length,header_length);
1415 printf(
"StTriggerData2013: Droping the data block =%2d [%1c%1c%1c%1c] with ErrorFlag=0x%x\n",
1416 name,data->name[0],data->name[1],data->name[2],data->name[3],mErrorFlag);
1422 case y13BC1_CONF_NUM :
1424 swapSSn((
unsigned int*)bc1->BEMClayer1,48);
1425 swapSSn((
unsigned int*)bc1->EEMClayer1,16);
1427 case y13MIX_CONF_NUM :
1429 swapSSn((
unsigned int*)mix->FPDEastNSLayer1,8);
1430 swapSSn((
unsigned int*)mix->TOFLayer1,8+48);
1432 case y13BCW_CONF_NUM :
1435 case y13BCE_CONF_NUM :
1438 case y13BBC_CONF_NUM :
1440 swapSSn((
unsigned int*)bbc->BBClayer1,16+8+8);
1442 case y13FMS_CONF_NUM :
1445 case y13MXQ_CONF_NUM :
1446 case y13FEQ_CONF_NUM :
1447 case y13BBQ_CONF_NUM :
1448 case y13QT1_CONF_NUM :
1449 case y13QT2_CONF_NUM :
1450 case y13QT3_CONF_NUM :
1451 case y13QT4_CONF_NUM :
1453 swapI((
unsigned int*)&qtdata->dataLoss);
1454 swapIn(qtdata->data, qtdata->length/4);
1459 printf(
"Read id=%2d name=%1c%1c%1c%1c length=%d\n",
1460 name,data->name[0],data->name[1],data->name[2],data->name[3],data->length);
1463 void StTriggerData2013::Streamer(TBuffer &R__b)
1467 if (R__b.IsReading()) {
1468 R__b.ReadClassBuffer(StTriggerData2013::Class(),
this);
1470 if(mData) readData();
1473 R__b.WriteClassBuffer(StTriggerData2013::Class(),
this);