30 #include "StTriggerData2012.h"
43 mYear=2012; mRun = run; mDebug = 0;
50 mYear=2012; mRun = run; mDebug = dbg;
51 if(mDebug==1) printf(
"StTriggerData2012 Constructor with trigger data block and byteswap option=%d\n",bs);
58 if (data==0) {copyflag=0;}
59 if(mDebug==1) printf(
"StTriggerData2012::readData copyflag=%d byteswap=%d data=%p mData=%p\n",copyflag,bs,data,mData);
62 unsigned int ver = data->FormatVersion;
65 if (ver == y12FORMAT_VERSION || ver == 0x08121140) {
66 if (mDebug==1) printf(
"StTriggerData2012: version = 0x%x (0x%x or 0x08121140)\n",ver,y12FORMAT_VERSION);
69 mErrorFlag = mErrorFlag | 0x1;
70 printf(
"StTriggerData2012: version = 0x%x != (0x%x or 0x08121140)\n",ver,y12FORMAT_VERSION);
74 unsigned int size = data->totalTriggerLength;
76 if (size > y12MAX_TRG_BLK_SIZE) {
77 gMessMgr->Warning() <<
"StTriggerData2012: Data length = " << size
78 <<
" is bigger than max = " << y12MAX_TRG_BLK_SIZE
82 if (mDebug==1) printf(
"StTriggerData2012: size = %d, maxsize = %d\n",size,y12MAX_TRG_BLK_SIZE);
83 memcpy(mData,data,size);
87 if (bs) swapDataBlk(mData);
89 printf(
"StTriggerData2012: version = 0x%x (0x%x or 0x08121140)\n",mData->FormatVersion,y12FORMAT_VERSION);
90 printf(
"StTriggerData2012: size = %d, maxsize = %d\n",mData->totalTriggerLength,y12MAX_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 = (
EvtDescData2012*)((
char*)mData + mData->EventDesc_ofl.offset);
98 if (mData->L1_DSM_ofl.length > 0) L1_DSM = (
L1_DSM_Data2012*)((
char*)mData + mData->L1_DSM_ofl.offset);
99 if (mData->Summary_ofl.length > 0) TrgSum = (
TrgSumData2012* )((
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() <<
"StTriggerData2012: 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() <<
"StTriggerData2012: Invalid npre/post = "<< npre <<
" / " << npost
116 <<
" mErrorFlag="<<mErrorFlag<<endm;
118 if (mDebug==1) printf(
"StTriggerData2012: 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 = (
TrgOfflen2012*) ((
char*)mData + mData->PrePostList[i-1]);
152 if (bs) swapRawDetOfflen(offlen);
153 for(
int k=0; k<y12MAX_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() <<
"StTriggerData2012: 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[y12BC1_CONF_NUM].length;
if (j>0){mBC1[i] = (
BELayerBlock2012*)((
char*)mData + offlen[y12BC1_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mBC1[i],y12BC1_CONF_NUM,j,bs);}
163 j=offlen[y12MXQ_CONF_NUM].length;
if (j>0){mMXQ[i] = (
QTBlock2012* )((
char*)mData + offlen[y12MXQ_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mMXQ[i],y12MXQ_CONF_NUM,j,bs);}
164 j=offlen[y12MIX_CONF_NUM].length;
if (j>0){mMIX[i] = (
MIXBlock2012* )((
char*)mData + offlen[y12MIX_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mMIX[i],y12MIX_CONF_NUM,j,bs);}
165 j=offlen[y12BCW_CONF_NUM].length;
if (j>0){mBCW[i] = (
BWestBlock2012* )((
char*)mData + offlen[y12BCW_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mBCW[i],y12BCW_CONF_NUM,j,bs);}
166 j=offlen[y12BCE_CONF_NUM].length;
if (j>0){mBCE[i] = (
BEastBlock2012* )((
char*)mData + offlen[y12BCE_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mBCE[i],y12BCE_CONF_NUM,j,bs);}
167 j=offlen[y12FEQ_CONF_NUM].length;
if (j>0){mFEQ[i] = (
QTBlock2012* )((
char*)mData + offlen[y12FEQ_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mFEQ[i],y12FEQ_CONF_NUM,j,bs);}
168 j=offlen[y12BBC_CONF_NUM].length;
if (j>0){mBBC[i] = (
BBCBlock2012* )((
char*)mData + offlen[y12BBC_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mBBC[i],y12BBC_CONF_NUM,j,bs);}
169 j=offlen[y12BBQ_CONF_NUM].length;
if (j>0){mBBQ[i] = (
QTBlock2012* )((
char*)mData + offlen[y12BBQ_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mBBQ[i],y12BBQ_CONF_NUM,j,bs);}
170 j=offlen[y12FMS_CONF_NUM].length;
if (j>0){mFMS[i] = (
FMSBlock2012* )((
char*)mData + offlen[y12FMS_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mFMS[i],y12FMS_CONF_NUM,j,bs);}
171 j=offlen[y12QT1_CONF_NUM].length;
if (j>0){mQT1[i] = (
QTBlock2012* )((
char*)mData + offlen[y12QT1_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mQT1[i],y12QT1_CONF_NUM,j,bs);}
172 j=offlen[y12QT2_CONF_NUM].length;
if (j>0){mQT2[i] = (
QTBlock2012* )((
char*)mData + offlen[y12QT2_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mQT2[i],y12QT2_CONF_NUM,j,bs);}
173 j=offlen[y12QT3_CONF_NUM].length;
if (j>0){mQT3[i] = (
QTBlock2012* )((
char*)mData + offlen[y12QT3_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mQT3[i],y12QT3_CONF_NUM,j,bs);}
174 j=offlen[y12QT4_CONF_NUM].length;
if (j>0){mQT4[i] = (
QTBlock2012* )((
char*)mData + offlen[y12QT4_CONF_NUM].offset); swapRawDet((
DataBlock2012*)mQT4[i],y12QT4_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 StTriggerData2012::~StTriggerData2012() {
delete mData;}
188 unsigned int StTriggerData2012::version()
const
190 return EvtDesc->TrgDataFmtVer;
193 unsigned int StTriggerData2012::eventNumber()
const
195 return mData->eventNumber;
198 unsigned int StTriggerData2012::token()
const
200 return EvtDesc->TrgToken;
203 unsigned int StTriggerData2012::triggerWord()
const
205 return EvtDesc->TriggerWord;
208 unsigned int StTriggerData2012::actionWord()
const
211 ( (
unsigned short)(EvtDesc->actionWdTrgCommand) * 16 * 16 * 16 ) +
212 ( (
unsigned short)(EvtDesc->actionWdDaqCommand) * 16 * 16 ) +
213 ( EvtDesc->actionWdDetectorBitMask & 0x00ff );
216 unsigned int StTriggerData2012::numberOfPreXing()
const
218 return EvtDesc->npre;
221 unsigned int StTriggerData2012::numberOfPostXing()
const
223 return EvtDesc->npost;
226 unsigned short StTriggerData2012::busyStatus()
const{
227 return EvtDesc->internalBusy;
230 unsigned short StTriggerData2012::dsmInput()
const{
231 return EvtDesc->DSMInput;
234 unsigned short StTriggerData2012::trgToken()
const{
235 return EvtDesc->TrgToken;
238 unsigned short StTriggerData2012::dsmAddress()
const{
239 return EvtDesc->DSMAddress;
242 unsigned short StTriggerData2012::mAddBits()
const{
243 return EvtDesc->addBits;
246 unsigned short StTriggerData2012::bcData(
int channel)
const{
247 return L1_DSM->BCdata[channel];
250 unsigned short StTriggerData2012::lastDSM(
int channel)
const{
251 return L1_DSM->lastDSM[channel];
254 unsigned short StTriggerData2012::tcuBits()
const
256 return EvtDesc->DSMInput;
259 unsigned int StTriggerData2012::bunchCounterHigh()
const
261 return EvtDesc->bunchXing_hi;
264 unsigned int StTriggerData2012::bunchCounterLow()
const
266 return EvtDesc->bunchXing_lo;
269 unsigned int StTriggerData2012::bunchId48Bit()
const
271 unsigned long long bxinghi,bxing1,bxinglo, bx;
272 bxinghi = L1_DSM->BCdata[3];
273 bxing1 = L1_DSM->BCdata[10];
274 bxinglo = (bxing1 << 16) + L1_DSM->BCdata[11];
275 bx = (bxinghi << 32) + bxinglo;
276 return (
int)(bx % 120);
279 unsigned int StTriggerData2012::bunchId7Bit()
const
282 b7dat = L1_DSM->BCdata[2];
287 unsigned int StTriggerData2012::spinBit()
const
290 return (L1_DSM->lastDSM[7]/16)%256;
292 return (L1_DSM->lastDSM[4]/16)%256;
296 unsigned int StTriggerData2012::spinBitYellowFilled()
const
298 unsigned int sb = spinBit();
302 unsigned int StTriggerData2012::spinBitYellowUp()
const
304 unsigned int sb = spinBit();
308 unsigned int StTriggerData2012::spinBitYellowDown()
const
310 unsigned int sb = spinBit();
314 unsigned int StTriggerData2012::spinBitYellowUnpol()
const
316 unsigned int sb = spinBit();
320 unsigned int StTriggerData2012::spinBitBlueFilled()
const
322 unsigned int sb = spinBit();
326 unsigned int StTriggerData2012::spinBitBlueUp()
const
328 unsigned int sb = spinBit();
332 unsigned int StTriggerData2012::spinBitBlueDown()
const
334 unsigned int sb = spinBit();
338 unsigned int StTriggerData2012::spinBitBlueUnpol()
const
340 unsigned int sb = spinBit();
344 unsigned short StTriggerData2012::bbcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
346 const int addrmap[2][24] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
347 4, 4, 4, 4, 4, 4, 4, 4},
348 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
349 4, 4, 4, 4, 4, 4, 4, 4} };
350 const int chmap[2][24] = { { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
351 0, 1, 2, 3, 8, 9,10,11},
352 { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
353 16,17,18,19,24,25,26,27} };
354 int buffer = prepostAddress(prepost);
355 if (buffer >= 0 && pmt>=1 && pmt<=24)
return bbq[buffer][addrmap[eastwest][pmt-1]][chmap[eastwest][pmt-1]];
359 unsigned short StTriggerData2012::bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
361 const int addrmap[2][24] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
362 4, 4, 4, 4, 4, 4, 4, 4},
363 { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
364 4, 4, 4, 4, 4, 4, 4, 4} };
365 const int chmap[2][24] = { { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
366 0, 1, 2, 3, 8, 9,10,11},
367 { 0, 3, 8,16,19,24, 1, 2, 9,10,11,17,18,25,26,27,
368 16,17,18,19,24,25,26,27} };
369 int buffer = prepostAddress(prepost);
370 if (buffer >= 0 && pmt>=1 && pmt<=24)
return bbq[buffer][addrmap[eastwest][pmt-1]][chmap[eastwest][pmt-1]+4];
374 unsigned short StTriggerData2012::bbcADCSum(StBeamDirection eastwest,
int prepost)
const
376 unsigned short sum=0;
377 int buffer = prepostAddress(prepost);
378 if (buffer >= 0)
for(
int i=1; i<=16; i++) {sum+=bbcADC(eastwest,i,prepost);}
382 unsigned short StTriggerData2012::bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost)
const
384 unsigned short sum=0;
385 int buffer = prepostAddress(prepost);
386 if (buffer >= 0)
for(
int i=17; i<=24; i++) {sum+=bbcADC(eastwest,i,prepost);}
390 unsigned short StTriggerData2012::bbcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
392 int buffer = prepostAddress(prepost);
395 if (eastwest==east) {
return mBBC[buffer]->BBClayer1[2]%4096;}
396 else {
return mBBC[buffer]->BBClayer1[0]%4096;}
402 unsigned short StTriggerData2012::bbcTimeDifference()
const
404 return L1_DSM->VTX[3]%8192;
407 unsigned short StTriggerData2012::bbcEarliestTDCLarge(StBeamDirection eastwest,
int prepost)
const
409 int buffer = prepostAddress(prepost);
412 if (eastwest==east) {
return mBBC[buffer]->BBClayer1[11] & 0x0fff;}
413 else {
return ((mBBC[buffer]->BBClayer1[11] & 0xf000) >> 12)
414 +((mBBC[buffer]->BBClayer1[10] & 0x00ff) << 4 );}
420 unsigned short StTriggerData2012::bbcTimeDifferenceLarge()
const
422 return L1_DSM->VTX[2]%8192;
426 unsigned short StTriggerData2012::fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost)
const
431 unsigned short StTriggerData2012::fpdSum(StBeamDirection eastwest,
int module)
const
436 unsigned short StTriggerData2012::fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost)
const{
437 int buffer = prepostAddress(prepost);
439 if (eastwest==east) {
if (mMIX[buffer])
return mMIX[buffer]->FPDEastNSLayer1[channel]; }
440 else {
if (mFMS[buffer])
return mFMS[buffer]->FMS[channel]; }
445 unsigned short StTriggerData2012::fpdLayer2DSMRaw(
int channel)
const{
446 if (channel<8)
return L1_DSM->FPD[channel];
450 bool StTriggerData2012::zdcPresent(
int prepost)
const
452 int buffer = prepostAddress(prepost);
453 if (buffer >= 0)
return mBBQ[buffer];
457 unsigned short StTriggerData2012::zdcAtChannel(
int channel,
int prepost)
const
459 int buffer = prepostAddress(prepost);
460 if (buffer >= 0 && channel>=0 && channel<32)
return bbq[buffer][14][channel];
464 unsigned short StTriggerData2012::zdcAtAddress(
int address,
int prepost)
const
466 return zdcAtChannel(address,prepost);
469 unsigned short StTriggerData2012::zdcUnAttenuated(StBeamDirection eastwest,
int prepost)
const
471 int buffer = prepostAddress(prepost);
473 if (eastwest == east)
return bbq[buffer][14][2];
474 else return bbq[buffer][14][18];
479 unsigned short StTriggerData2012::zdcAttenuated(StBeamDirection eastwest,
int prepost)
const
481 int buffer = prepostAddress(prepost);
483 if (eastwest == east)
return bbq[buffer][14][3];
484 else return bbq[buffer][14][19];
489 unsigned short StTriggerData2012::zdcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
491 int buffer = prepostAddress(prepost);
492 if (buffer >= 0 && pmt>=1 && pmt<=3) {
493 if (eastwest == east) {
494 if (pmt == 1)
return bbq[buffer][14][0];
495 if (pmt == 2)
return bbq[buffer][14][8];
496 if (pmt == 3)
return bbq[buffer][14][9];
499 if (pmt == 1)
return bbq[buffer][14][16];
500 if (pmt == 2)
return bbq[buffer][14][24];
501 if (pmt == 3)
return bbq[buffer][14][25];
507 unsigned short StTriggerData2012::zdcTDC(StBeamDirection eastwest,
int prepost)
const
509 int buffer = prepostAddress(prepost);
511 if (eastwest == east)
return bbq[buffer][14][6];
512 else return bbq[buffer][14][22];
517 unsigned short StTriggerData2012::zdcPmtTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
519 int buffer = prepostAddress(prepost);
520 if (buffer >= 0 && pmt>=1 && pmt<=3) {
521 if (eastwest == east) {
522 if (pmt == 1)
return bbq[buffer][14][4];
523 if (pmt == 2)
return bbq[buffer][14][12];
524 if (pmt == 3)
return bbq[buffer][14][13];
527 if (pmt == 1)
return bbq[buffer][14][20];
528 if (pmt == 2)
return bbq[buffer][14][28];
529 if (pmt == 3)
return bbq[buffer][14][29];
535 unsigned short StTriggerData2012::zdcHardwareSum(
int prepost)
const
537 int buffer = prepostAddress(prepost);
538 if (buffer >= 0)
return bbq[buffer][14][11];
542 bool StTriggerData2012::zdcSMDPresent(
int prepost)
const
544 int buffer = prepostAddress(prepost);
545 if (buffer >= 0)
return mMXQ[buffer];
549 unsigned short StTriggerData2012::zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost)
const
551 static const int zdcsmd_map[2][2][8] ={
552 { { 31, 30, 29, 28, 27, 26, 25, 19} ,
553 { 24, 23, 22, 21, 20, 16, 18, 17} } ,
554 { { 15, 14, 13, 12, 11, 10, 9, 2} ,
555 { 8, 7, 6, 5, 4, 3, 0, 1} }
557 static const int zdcsmd_map2011[2][2][8] ={
558 { {24, 25, 26, 27, 28, 29, 30, 31} ,
559 {16, 17, 18, 19, 20, 21, 22, 23} } ,
560 { {8, 9, 10, 11, 12, 13, 14, 15} ,
561 {0, 1, 2, 3, 4, 5, 6, 7} }
563 if (verthori<0 || verthori>1)
return 0;
564 if (strip<1 || strip>8)
return 0;
565 int buffer = prepostAddress(prepost);
568 return mxq[buffer][4][zdcsmd_map[eastwest][verthori][strip-1]];
570 return mxq[buffer][4][zdcsmd_map2011[eastwest][verthori][strip-1]];
576 unsigned short StTriggerData2012::zdcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
578 int buffer = prepostAddress(prepost);
582 if (eastwest==east) {
return ((mBBC[buffer]->ZDClayer1[3] >> 12) % 16) | ((mBBC[buffer]->ZDClayer1[2] % 256) << 4);}
583 else {
return (mBBC[buffer]->ZDClayer1[3]) % 4096;}
585 if (eastwest==east) {
return ((mBBC[buffer]->ZDClayer1[3] >> 10) % 64) | ((mBBC[buffer]->ZDClayer1[2] % 16) << 6);}
586 else {
return (mBBC[buffer]->ZDClayer1[3]) % 1024;}
593 bool StTriggerData2012::zdcSumADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
594 int buffer = prepostAddress(prepost);
598 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (27-16));}
599 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (24-16));}
601 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (25-16));}
602 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (22-16));}
609 bool StTriggerData2012::zdcFrontADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
610 int buffer = prepostAddress(prepost);
614 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (29-16));}
615 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (26-16));}
617 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (23-16));}
618 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (20-16));}
625 bool StTriggerData2012::zdcBackADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
626 int buffer = prepostAddress(prepost);
630 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (28-16));}
631 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (25-16));}
633 if (eastwest==east) {
return mBBC[buffer]->ZDClayer1[2] & (1 << (24-16));}
634 else {
return mBBC[buffer]->ZDClayer1[2] & (1 << (21-16));}
641 unsigned short StTriggerData2012::zdcTimeDifference()
const
643 return L1_DSM->VTX[1]%1024;
646 bool StTriggerData2012::zdcSumADCaboveThresholdL2(StBeamDirection eastwest)
const {
647 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 10 : 11));
650 bool StTriggerData2012::zdcFrontADCaboveThresholdL2(StBeamDirection eastwest)
const {
651 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 12 : 14));
654 bool StTriggerData2012::zdcBackADCaboveThresholdL2(StBeamDirection eastwest)
const {
655 return L1_DSM->VTX[1] & (1 << ((eastwest==east) ? 13 : 15));
658 bool StTriggerData2012::zdcSumADCaboveThresholdL3(StBeamDirection eastwest)
const {
659 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 7 : 8)); }
660 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 7 : 8)); }
663 bool StTriggerData2012::zdcFrontADCaboveThresholdL3(StBeamDirection eastwest)
const {
664 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 9 : 11)); }
665 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 9 : 11)); }
668 bool StTriggerData2012::zdcBackADCaboveThresholdL3(StBeamDirection eastwest)
const {
669 if(mRun<12000000){
return lastDSM(2) & (1 << ((eastwest==east) ? 10 : 12)); }
670 else {
return lastDSM(1) & (1 << ((eastwest==east) ? 10 : 12)); }
673 bool StTriggerData2012::zdcTimeDifferenceInWindow()
const
675 if(mRun<12000000){
return lastDSM(2) & (1 << 6); }
676 else {
return lastDSM(1) & (1 << 6); }
679 unsigned short StTriggerData2012::zdcSMDHighestStrip(StBeamDirection eastwest,
int verthori,
int prepost)
const
681 if(mRun<12000000)
return 0;
683 int buffer = prepostAddress(prepost);
686 if (eastwest==east) {
return (mBBC[buffer]->ZDClayer1[1] >> (verthori ? 6 : 9)) % 8;}
687 else {
return (mBBC[buffer]->ZDClayer1[1] >> (verthori ? 0 : 3)) % 8;}
693 unsigned short StTriggerData2012::zdcTruncatedSum(StBeamDirection eastwest,
int prepost)
const
695 if(mRun<12000000)
return 0;
696 int buffer = prepostAddress(prepost);
699 if (eastwest==east) {
return (mBBC[buffer]->ZDClayer1[2] >> (26-16)) % 8;}
700 else {
return (mBBC[buffer]->ZDClayer1[2] >> (29-16)) % 8;}
706 unsigned short StTriggerData2012::pp2ppADC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost)
const
708 static const int map[2][2][2][2] ={ { { { 0, 1}, { 2, 3} } , { {16,17}, {18,19} } , } ,
709 { { { 8, 9}, {10,11} } , { {24,25}, {26,27} } , } };
710 if (vh<0 || vh>1)
return 0;
711 if (udio<0 || udio>1)
return 0;
712 if (ch<0 || ch>1)
return 0;
713 int buffer = prepostAddress(prepost);
714 if (buffer >= 0)
return mxq[buffer][2][map[eastwest][vh][udio][ch]];
718 unsigned short StTriggerData2012::pp2ppTAC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost)
const
720 static const int map[2][2][2][2] ={ { { { 0, 1}, { 2, 3} } , { {16,17}, {18,19} } , } ,
721 { { { 8, 9}, {10,11} } , { {24,25}, {26,27} } , } };
722 if (vh<0 || vh>1)
return 0;
723 if (udio<0 || udio>1)
return 0;
724 if (ch<0 || ch>1)
return 0;
725 int buffer = prepostAddress(prepost);
726 if (buffer >= 0)
return mxq[buffer][2][map[eastwest][vh][udio][ch]+4];
730 unsigned long StTriggerData2012::pp2ppDSM(
int prepost)
const {
731 if (prepost!=0)
return 0;
732 return L1_DSM->TOF[7];
735 unsigned short StTriggerData2012::bemcLayer1DSM(
int channel,
int prepost)
const {
736 const int n_bemc_layer1=48;
737 if (channel<0 || channel >=n_bemc_layer1) {
738 gMessMgr->Warning() <<
"Barrel DSM layer 1 out of range (" << channel <<
")" << endm;
741 int buffer = prepostAddress(prepost);
742 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->BEMClayer1[channel];
746 unsigned short StTriggerData2012::eemcLayer1DSM(
int channel,
int prepost)
const {
747 const int n_eemc_layer1=16;
748 if (channel<0 || channel >=n_eemc_layer1) {
749 gMessMgr->Warning() <<
"Endap DSM layer 1 out of range (" << channel <<
")" << endm;
752 int buffer = prepostAddress(prepost);
753 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMClayer1[channel];
757 unsigned short StTriggerData2012::emcLayer2DSM(
int channel)
const {
758 const int n_emc_layer2=8;
759 if (channel<0 || channel >=n_emc_layer2) {
760 gMessMgr->Warning() <<
"EMC DSM layer 2 out of range (" << channel <<
")" << endm;
763 return L1_DSM->EMC[channel];
766 unsigned short StTriggerData2012::tpcMaskDSM(
int channel)
const {
767 const int n_tpcMask=8;
768 if (channel<0 || channel >=n_tpcMask) {
769 gMessMgr->Warning() <<
"TPCMask DSM out of range (" << channel <<
")" << endm;
772 return L1_DSM->TPCMask[channel];
775 unsigned char StTriggerData2012::bemcHighTower(
int patch_id,
int prepost)
const {
777 const int m_max_patch=300;
778 if ( patch_id < 0 || patch_id >= m_max_patch) {
779 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
782 int buffer = prepostAddress(prepost);
785 int channel=patch_id%10;
786 unsigned short trg_word;
789 trg_word=decodeEmc12bit(dsm-15,channel,mBCE[buffer]->BEMCEast);
795 trg_word=decodeEmc12bit(dsm,channel,mBCW[buffer]->BEMCWest);
799 return trg_word & 0x3F;
804 unsigned char StTriggerData2012::bemcJetPatch (
int patch_id,
int prepost)
const
807 const int m_max_patch=300;
808 if ( patch_id < 0 || patch_id >= m_max_patch) {
809 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
812 int buffer = prepostAddress(prepost);
815 int channel=patch_id%10;
816 unsigned short trg_word;
819 trg_word=decodeEmc12bit(dsm-15,channel,mBCE[buffer]->BEMCEast);
825 trg_word=decodeEmc12bit(dsm,channel,mBCW[buffer]->BEMCWest);
829 return trg_word >> 6;
835 unsigned char StTriggerData2012::eemcHighTower(
int patch_id,
int prepost)
const
838 const int m_max_patch=90;
839 if ( patch_id < 0 || patch_id >= m_max_patch) {
840 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
843 int buffer = prepostAddress(prepost);
844 if (buffer >= 0 && mBC1[buffer]) {
846 int channel=patch_id%10;
847 unsigned short trg_word = decodeEmc12bit(dsm,channel,mBC1[buffer]->EEMC);
848 return trg_word & 0x3F;
853 unsigned char StTriggerData2012::eemcJetPatch (
int patch_id,
int prepost)
const
856 const int m_max_patch=90;
857 if ( patch_id < 0 || patch_id >= m_max_patch) {
858 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
861 int buffer = prepostAddress(prepost);
862 if (buffer >= 0 && mBC1[buffer]) {
864 int channel=patch_id%10;
865 unsigned short trg_word = decodeEmc12bit(dsm,channel,mBC1[buffer]->EEMC);
866 return trg_word >> 6;
871 unsigned char StTriggerData2012::bemcHighestTowerADC(
int prepost)
const {
873 const int m_max_patch=300;
875 for (
int i=1; i<m_max_patch; i++){
876 unsigned char hh=bemcHighTower(i,prepost);
882 unsigned char StTriggerData2012::eemcHighestTowerADC(
int prepost)
const {
884 const int m_max_patch=90;
886 for (
int i=1; i<m_max_patch; i++){
887 unsigned char hh=eemcHighTower(i,prepost);
893 char* StTriggerData2012::getTriggerStructure()
895 return (
char*) mData;
903 int StTriggerData2012::getRawSize()
const
905 return mData->totalTriggerLength;
908 unsigned char* StTriggerData2012::getDsm0_BEMCE(
int prepost)
const {
909 int buffer = prepostAddress(prepost);
910 if (buffer >= 0)
if (mBCE[buffer])
return mBCE[buffer]->BEMCEast;
914 unsigned char* StTriggerData2012::getDsm0_BEMCW(
int prepost)
const {
915 int buffer = prepostAddress(prepost);
916 if (buffer >= 0)
if (mBCW[buffer])
return mBCW[buffer]->BEMCWest;
920 unsigned short* StTriggerData2012::getDsm1_BEMC(
int prepost)
const {
921 int buffer = prepostAddress(prepost);
922 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->BEMClayer1;
926 unsigned char* StTriggerData2012::getDsm0_EEMC(
int prepost)
const {
927 int buffer = prepostAddress(prepost);
928 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMC;
932 unsigned short* StTriggerData2012::getDsm1_EEMC(
int prepost)
const{
933 int buffer = prepostAddress(prepost);
934 if (buffer >= 0)
if (mBC1[buffer])
return mBC1[buffer]->EEMClayer1;
938 unsigned short* StTriggerData2012::getDsm2_EMC()
const{
942 unsigned short* StTriggerData2012::getDsm3()
const{
943 return L1_DSM->lastDSM;
946 int StTriggerData2012::L2ResultsOffset(StL2AlgorithmId
id)
const
949 default:
return -999999999;
953 bool StTriggerData2012::isL2Triggered(StL2TriggerResultType
id)
const
958 unsigned int StTriggerData2012::l2ResultLength()
const
960 return sizeof(TrgSum->L2Result)/
sizeof(
unsigned int);
963 const unsigned int* StTriggerData2012::l2Result()
const
965 return TrgSum->L2Result;
968 unsigned long long StTriggerData2012::l2sum()
const
972 unsigned long long hi = TrgSum->L2Sum[1];
973 unsigned long long lo = TrgSum->L2Sum[0];
974 unsigned long long mask=(hi<<32) | lo;
978 unsigned short StTriggerData2012::vpdADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
980 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
981 if (pmt<1 || pmt>16)
return 0;
982 int buffer = prepostAddress(prepost);
984 if (mRun<=12003001) {
return bbq[buffer][10+(int)eastwest*2][map[pmt-1]];}
985 else {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]];}
990 unsigned short StTriggerData2012::vpdTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
992 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
993 if (pmt<1 || pmt>16)
return 0;
994 int buffer = prepostAddress(prepost);
996 if (mRun<=12003001) {
return bbq[buffer][10+(int)eastwest*2][map[pmt-1]+4];}
997 else {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]+4];}
1002 unsigned short StTriggerData2012::vpdADCHighThr(StBeamDirection eastwest,
int pmt,
int prepost)
const
1004 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1005 if (pmt<1 || pmt>16)
return 0;
1006 int buffer = prepostAddress(prepost);
1008 if (mRun<=12003001) {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]];}
1009 else {
return mxq[buffer][6+(int)eastwest*2][map[pmt-1]];}
1014 unsigned short StTriggerData2012::vpdTDCHighThr(StBeamDirection eastwest,
int pmt,
int prepost)
const
1016 static const int map[16] = {0, 1, 2, 3, 8, 9,10,11,16,17,18,19,24,25,26,27};
1017 if (pmt<1 || pmt>16)
return 0;
1018 int buffer = prepostAddress(prepost);
1020 if (mRun<=12003001) {
return bbq[buffer][6+(int)eastwest*2][map[pmt-1]+4];}
1021 else {
return mxq[buffer][6+(int)eastwest*2][map[pmt-1]+4];};
1026 unsigned short StTriggerData2012::vpdEarliestTDC(StBeamDirection eastwest,
int prepost)
const
1028 int buffer = prepostAddress(prepost);
1031 if (mRun<=10096084){
1032 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1033 else {
return mBBC[buffer]->VPD[4]%4096;}
1035 else if(mRun<=12003001) {
1036 if (eastwest==east) {
return mBBC[buffer]->VPD[2]%4096;}
1037 else {
return mBBC[buffer]->VPD[0]%4096;}
1040 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1041 else {
return mBBC[buffer]->VPD[4]%4096;}
1049 unsigned short StTriggerData2012::vpdEarliestTDCHighThr(StBeamDirection eastwest,
int prepost)
const
1051 int buffer = prepostAddress(prepost);
1053 if (mRun<=10365999){
1056 else if(mRun<=12003001) {
1058 if (eastwest==east) {
return mBBC[buffer]->VPD[6]%4096;}
1059 else {
return mBBC[buffer]->VPD[4]%4096;}
1063 if (eastwest==east) {
return mMIX[buffer]->MTD_P2PLayer1[13] + ((mMIX[buffer]->MTD_P2PLayer1[12]&0x0f)<<8);}
1064 else {
return mMIX[buffer]->MTD_P2PLayer1[9] + ((mMIX[buffer]->MTD_P2PLayer1[8]&0x0f)<<8);}
1071 unsigned short StTriggerData2012::vpdTimeDifference()
const
1073 return L1_DSM->VTX[7]%8192;
1076 unsigned short StTriggerData2012::nQTdata(
int prepost)
const
1081 unsigned int* StTriggerData2012::QTdata(
int prepost)
const
1086 unsigned short StTriggerData2012::fmsADC(
int crt,
int adr,
int ch,
int prepost)
const
1088 int buffer = prepostAddress(prepost);
1089 if (buffer >= 0 && crt>=1 && crt<=5 && adr>=0 && adr<16 && ch>=0 && ch<=31){
1091 case 1:
return qt1[buffer][adr][ch];
1092 case 2:
return qt2[buffer][adr][ch];
1093 case 3:
return qt3[buffer][adr][ch];
1094 case 4:
return qt4[buffer][adr][ch];
1095 case 5:
return feq[buffer][adr][ch];
1101 unsigned short StTriggerData2012::fmsTDC(
int crt,
int adr,
int ch,
int prepost)
const
1103 int buffer = prepostAddress(prepost);
1104 if (buffer >= 0 && crt>=1 && crt<=5 && adr>=0 && adr<16 && ch>=0 && ch<=31){
1106 case 1:
return tqt1[buffer][adr][ch];
1107 case 2:
return tqt2[buffer][adr][ch];
1108 case 3:
return tqt3[buffer][adr][ch];
1109 case 4:
return tqt4[buffer][adr][ch];
1110 case 5:
return tfeq[buffer][adr][ch];
1116 unsigned char* StTriggerData2012::getDsm_FMS(
int prepost)
const
1118 int buffer = prepostAddress(prepost);
1119 if (buffer >= 0)
if (mFMS[buffer])
return mFMS[buffer]->FMS;
1123 unsigned short* StTriggerData2012::getDsm1_FMS(
int prepost)
const
1125 int buffer = prepostAddress(prepost);
1126 if (buffer >= 0)
if (mMIX[buffer])
return mMIX[buffer]->FPDEastNSLayer1;
1130 unsigned short* StTriggerData2012::getDsm2_FMS()
const {
return L1_DSM->FPD;}
1132 unsigned short StTriggerData2012::mtdAtAddress(
int address,
int prepost)
const
1134 int buffer = prepostAddress(prepost);
1135 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][0][address];
1139 unsigned short StTriggerData2012::mtdgemAtAddress(
int address,
int prepost)
const
1141 if (mRun<=12003001)
return 0;
1142 int buffer = prepostAddress(prepost);
1143 if (buffer >= 0 && address>=0 && address<32)
return mxq[buffer][10][address];
1148 unsigned short StTriggerData2012::mtdAdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
1151 int buffer = prepostAddress(prepost);
1152 if (buffer >= 0 && pmt==0){
1153 if (eastwest==east) {
1154 if (mRun<=10133008)
return mxq[buffer][0][0];
1155 else return mxq[buffer][0][24];
1157 if (eastwest==west)
return mxq[buffer][0][8];
1162 unsigned short StTriggerData2012::mtdTdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
1165 int buffer = prepostAddress(prepost);
1166 if (buffer >= 0 && pmt==0){
1167 if (eastwest==east) {
1168 if (mRun<=10133008)
return mxq[buffer][0][4];
1169 else return mxq[buffer][0][28];
1171 if (eastwest==west)
return mxq[buffer][0][12];
1176 unsigned char StTriggerData2012::mtdDsmAtCh(
int ch,
int prepost)
const
1178 int map[16] = {7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8};
1179 int buffer = prepostAddress(prepost);
1180 if (buffer >= 0 && ch>=0 && ch<16){
1181 if (mMIX[buffer])
return mMIX[buffer]->MTD_P2PLayer1[map[ch]];
1186 bool StTriggerData2012::mtdDsmHit(
int pmt,
int prepost)
const
1189 int buffer = prepostAddress(prepost);
1192 if(mRun<10133008 && mRun<11000000){
1193 if( (mMIX[buffer]->MTD_P2PLayer1[5] & 0x1) && (mMIX[buffer]->MTD_P2PLayer1[5] & 0x10) )
return true;
1196 if(prepost!=0)
return false;
1197 return (L1_DSM->TOF[3] & 0x1);
1204 unsigned short StTriggerData2012::mtdVpdTacDiff()
const
1206 return (L1_DSM->TOF[3] & 0x3fff);
1209 unsigned short StTriggerData2012::tofAtAddress(
int address,
int prepost)
const
1211 int buffer = prepostAddress(prepost);
1212 if (buffer>=0 && address>=0 && address<48) {
1213 if (mMIX[buffer])
return mMIX[buffer]->TOF[address];
1218 unsigned short StTriggerData2012::tofTrayMultiplicity(
int tray,
int prepost)
const
1220 int dsmmap[8] = {3,2,1,0,7,6,5,4};
1221 int traydsm[120] = { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5,
1222 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3,
1223 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
1224 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
1225 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
1226 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
1227 int traych[120] = { 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1228 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1229 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3,
1230 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17,
1231 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17,
1232 18,19,10,11,12,13,14,15,16,17,18,19,10,11,12,13,14,15,16,17};
1233 int buffer = prepostAddress(prepost);
1234 if (buffer>=0 && tray>=1 && tray<=120) {
1236 int address = traydsm[tray-1]*8 + dsmmap[traych[tray-1]/3];
1237 int ch = traych[tray-1]%3;
1238 return (mMIX[buffer]->TOF[address] >> (5*ch)) & 0x1f;
1244 unsigned short StTriggerData2012::tofMultiplicity(
int prepost)
const
1246 if (prepost==0)
return L1_DSM->TOF[1]%8192;
1250 void StTriggerData2012::dump()
const
1252 printf(
"***** StTriggerData Dump *****\n");
1253 printf(
" mDebug=%d mData=%p\n",mDebug,mData);
1254 printf(
" Year=%d Version=%x\n",year(),version());
1255 printf(
" Run#=%d Event#=%d\n",mRun,eventNumber());
1256 printf(
" %d pre and %d post crossing data available\n",numberOfPreXing(),numberOfPostXing());
1257 printf(
" Token=%d TriggerWord=%x ActionWord=%x BusyStatus=%x\n",
1258 token(), triggerWord(), actionWord(), busyStatus());
1259 printf(
" TUC Bits=%d : ",tcuBits());
1260 for (
int i=0; i<16; i++) {printf(
" %d",(tcuBits()>>(15-i))%2);}; printf(
"\n");
1261 printf(
" BunchId 7bit=%d 48bit=%d\n",bunchId7Bit(), bunchId48Bit());
1262 printf(
" Spin Bits=%d : ",spinBit());
1263 for (
int i=0; i<8; i++) {printf(
" %d",(spinBit()>>(7-i))%2);}; printf(
"\n");
1265 printf(
" BBC East ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(east,i,0)); }; printf(
"\n");
1266 printf(
" BBC West ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(west,i,0)); }; printf(
"\n");
1267 printf(
" BBC East TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(east,i,0)); }; printf(
"\n");
1268 printf(
" BBC West TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(west,i,0)); }; printf(
"\n");
1269 for (
int i=-numberOfPreXing(); i<=static_cast<int>(numberOfPostXing()); i++){
1270 printf(
" BBC Sums %d xing : ",i);
1271 printf(
"East=%d West=%d Large tile East=%d West=%d\n",
1272 bbcADCSum(east,i),bbcADCSum(west,i),
1273 bbcADCSumLargeTile(east,i),bbcADCSumLargeTile(west,i));
1275 printf(
" BBC Earilest : "); printf(
"East=%d West=%d Difference+256=%d\n",
1276 bbcEarliestTDC(east,0),bbcEarliestTDC(west,0),bbcTimeDifference());
1277 printf(
" ZDC Earilest : "); printf(
"East=%d West=%d Difference=%d\n",
1278 zdcEarliestTDC(east,0),zdcEarliestTDC(west,0),zdcTimeDifference());
1290 printf(
" ZDC Sum(A) East : ");printf(
"%d ",zdcAttenuated(east)); printf(
"\n");
1291 printf(
" ZDC Sum(A) West : ");printf(
"%d ",zdcAttenuated(west)); printf(
"\n");
1292 printf(
" ZDC Sum(UA) East : ");printf(
"%d ",zdcUnAttenuated(east)); printf(
"\n");
1293 printf(
" ZDC Sum(UA) West : ");printf(
"%d ",zdcUnAttenuated(west)); printf(
"\n");
1294 printf(
" VPD E Earliest TAC : %d\n", vpdEarliestTDC(east));
1295 printf(
" VPD W Earliest TAC : %d\n", vpdEarliestTDC(west));
1296 printf(
" VPD TimeDifference : %d\n", vpdTimeDifference());
1297 printf(
" L2 result : \n");
1298 for (
int j=0; j<4 ;j++) {
for (
int k=0; k<16; k++) {printf(
"%u ",*(l2Result()+j*16+k)); } printf(
"\n");}
1299 printf(
"BBClayer1:");
1300 int buffer = prepostAddress(0);
1303 for (
int i = 0;i < 16;i++) printf(
" %1x %04X", i, mBBC[buffer]->BBClayer1[i]);
1307 printf(
"ZDClayer1:");
1310 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, mBBC[buffer]->ZDClayer1[i]);
1314 printf(
"VPDlayer1:");
1317 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, mBBC[buffer]->VPD[i]);
1323 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, L1_DSM->VTX[i]);
1326 printf(
"Last DSM:");
1328 for (
int i = 0;i < 8;i++) printf(
" %1x %04X", i, L1_DSM->lastDSM[i]);
1331 printf(
"***** End StTriggerData Dump *****\n");
1334 void StTriggerData2012::killFMS(){
1336 int npre = numberOfPreXing();
1337 int npost = numberOfPostXing();
1338 for (
int i=0; i<1+npre+npost; i++){
1340 {offlen = mData->MainX;}
1342 if (mData->PrePostList[i-1]==0)
continue;
1343 offlen = (
TrgOfflen2012*) ((
char*)mData + mData->PrePostList[i-1]);
1346 j=offlen[y12FEQ_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y12FEQ_CONF_NUM].offset, 0, j); offlen[y12FEQ_CONF_NUM].length=0;};
1347 j=offlen[y12QT1_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y12QT1_CONF_NUM].offset, 0, j); offlen[y12QT1_CONF_NUM].length=0;};
1348 j=offlen[y12QT2_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y12QT2_CONF_NUM].offset, 0, j); offlen[y12QT2_CONF_NUM].length=0;};
1349 j=offlen[y12QT3_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y12QT3_CONF_NUM].offset, 0, j); offlen[y12QT3_CONF_NUM].length=0;};
1350 j=offlen[y12QT4_CONF_NUM].length;
if (j>0){memset((
char*)mData + offlen[y12QT4_CONF_NUM].offset, 0, j); offlen[y12QT4_CONF_NUM].length=0;};
1354 void StTriggerData2012::swapRawDet(
DataBlock2012* data,
int name,
int hlength,
int bs)
1360 int header_length = 8;
1361 if(bs) swapI((
unsigned int*)&data->length);
1363 case y12MXQ_CONF_NUM :
case y12FEQ_CONF_NUM :
case y12BBQ_CONF_NUM :
1364 case y12QT1_CONF_NUM :
case y12QT2_CONF_NUM :
case y12QT3_CONF_NUM :
case y12QT4_CONF_NUM :
1365 header_length = 12;
break;
1367 if (hlength != data->length + header_length){
1368 mErrorFlag = mErrorFlag | (1 << name);
1369 printf(
"StTriggerData2012: Error reading Block=%2d [%1c%1c%1c%1c] length %d != %d + %d\n",
1370 name,data->name[0],data->name[1],data->name[2],data->name[3],
1371 hlength,data->length,header_length);
1372 printf(
"StTriggerData2012: Droping the data block =%2d [%1c%1c%1c%1c] with ErrorFlag=0x%x\n",
1373 name,data->name[0],data->name[1],data->name[2],data->name[3],mErrorFlag);
1379 case y12BC1_CONF_NUM :
1381 swapSSn((
unsigned int*)bc1->BEMClayer1,48);
1382 swapSSn((
unsigned int*)bc1->EEMClayer1,16);
1384 case y12MIX_CONF_NUM :
1386 swapSSn((
unsigned int*)mix->FPDEastNSLayer1,8);
1387 swapSSn((
unsigned int*)mix->TOFLayer1,8+48);
1389 case y12BCW_CONF_NUM :
1392 case y12BCE_CONF_NUM :
1395 case y12BBC_CONF_NUM :
1397 swapSSn((
unsigned int*)bbc->BBClayer1,16+8+8);
1399 case y12FMS_CONF_NUM :
1402 case y12MXQ_CONF_NUM :
1403 case y12FEQ_CONF_NUM :
1404 case y12BBQ_CONF_NUM :
1405 case y12QT1_CONF_NUM :
1406 case y12QT2_CONF_NUM :
1407 case y12QT3_CONF_NUM :
1408 case y12QT4_CONF_NUM :
1410 swapI((
unsigned int*)&qtdata->dataLoss);
1411 swapIn(qtdata->data, qtdata->length/4);
1416 printf(
"Read id=%2d name=%1c%1c%1c%1c length=%d\n",
1417 name,data->name[0],data->name[1],data->name[2],data->name[3],data->length);
1420 void StTriggerData2012::Streamer(TBuffer &R__b)
1424 if (R__b.IsReading()) {
1425 R__b.ReadClassBuffer(StTriggerData2012::Class(),
this);
1427 if(mData) readData();
1430 R__b.WriteClassBuffer(StTriggerData2012::Class(),
this);