36 #include "StTriggerData2008.h"
51 int npre = data->EvtDesc.npre;
52 int npost = data->EvtDesc.npost;
59 memcpy(mData,data,size);
64 unsigned int StTriggerData2008::version()
const
66 return mData->EvtDesc.TrgDataFmtVer;
69 StTriggerData2008::~StTriggerData2008() {
delete mData;}
71 unsigned int StTriggerData2008::token()
const
73 return mData->EvtDesc.TrgToken;
76 unsigned int StTriggerData2008::triggerWord()
const
78 return mData->EvtDesc.TriggerWord;
81 unsigned int StTriggerData2008::actionWord()
const
84 ( (
unsigned short)(mData->EvtDesc.actionWdTrgCommand) * 16 * 16 * 16 ) +
85 ( (
unsigned short)(mData->EvtDesc.actionWdDaqCommand) * 16 * 16 ) +
86 ( mData->EvtDesc.actionWdDetectorBitMask & 0x00ff ) ;
89 unsigned int StTriggerData2008::numberOfPreXing()
const
91 return mData->EvtDesc.npre;
94 unsigned int StTriggerData2008::numberOfPostXing()
const
96 return mData->EvtDesc.npost;
99 unsigned short StTriggerData2008::busyStatus()
const{
100 return mData->EvtDesc.modifiedBusyStatus;
103 unsigned short StTriggerData2008::dsmInput()
const{
104 return mData->EvtDesc.DSMInput;
107 unsigned short StTriggerData2008::trgToken()
const{
108 return mData->EvtDesc.TrgToken;
111 unsigned short StTriggerData2008::dsmAddress()
const{
112 return mData->EvtDesc.DSMAddress;
115 unsigned short StTriggerData2008::mAddBits()
const{
116 return mData->EvtDesc.addBits;
119 unsigned short StTriggerData2008::bcData(
int channel)
const{
120 return mData->TrgSum.DSMdata.BCdata[channel];
123 unsigned short StTriggerData2008::lastDSM(
int channel)
const{
124 return mData->TrgSum.DSMdata.lastDSM[channel];
127 unsigned short StTriggerData2008::tcuBits()
const
129 return mData->EvtDesc.DSMInput;
132 unsigned int StTriggerData2008::bunchCounterHigh()
const
134 return mData->EvtDesc.bunchXing_hi;
137 unsigned int StTriggerData2008::bunchCounterLow()
const
139 return mData->EvtDesc.bunchXing_lo;
142 unsigned int StTriggerData2008::bunchId48Bit()
const
144 unsigned long long bxinghi,bxing1,bxinglo, bx;
145 bxinghi = mData->TrgSum.DSMdata.BCdata[3];
146 bxing1 = mData->TrgSum.DSMdata.BCdata[10];
147 bxinglo = (bxing1 << 16) + mData->TrgSum.DSMdata.BCdata[11];
148 bx = (bxinghi << 32) + bxinglo;
149 return (
int)(bx % 120);
152 unsigned int StTriggerData2008::bunchId7Bit()
const
155 b7dat = mData->TrgSum.DSMdata.BCdata[2];
160 unsigned int StTriggerData2008::spinBit()
const
162 return (mData->TrgSum.DSMdata.lastDSM[7]/16)%256;
165 unsigned int StTriggerData2008::spinBitYellowFilled()
const
167 unsigned int sb = spinBit();
171 unsigned int StTriggerData2008::spinBitYellowUp()
const
173 unsigned int sb = spinBit();
177 unsigned int StTriggerData2008::spinBitYellowDown()
const
179 unsigned int sb = spinBit();
183 unsigned int StTriggerData2008::spinBitYellowUnpol()
const
185 unsigned int sb = spinBit();
189 unsigned int StTriggerData2008::spinBitBlueFilled()
const
191 unsigned int sb = spinBit();
195 unsigned int StTriggerData2008::spinBitBlueUp()
const
197 unsigned int sb = spinBit();
201 unsigned int StTriggerData2008::spinBitBlueDown()
const
203 unsigned int sb = spinBit();
207 unsigned int StTriggerData2008::spinBitBlueUnpol()
const
209 unsigned int sb = spinBit();
213 unsigned short StTriggerData2008::ctbRaw(
int address,
int prepost)
const
215 return mData->rawTriggerDet[prepostAddress(prepost)].CTB[address];
218 unsigned short StTriggerData2008::ctb(
int pmt,
int prepost)
const
220 static const unsigned char ctbMap[240] = {
221 7, 6, 5, 4, 3, 23, 22, 21, 20, 19,
222 2, 1, 0, 15, 14, 18, 17, 16, 31, 30,
223 13, 12, 11, 10, 9, 29, 28, 27, 26, 25,
224 39, 38, 37, 36, 35, 55, 54, 53, 52, 51,
225 34, 33, 32, 47, 46, 50, 49, 48, 63, 62,
226 45, 44, 43, 42, 41, 61, 60, 59, 58, 57,
227 71, 70, 69, 68, 67, 87, 86, 85, 84, 83,
228 66, 65, 64, 79, 78, 82, 81, 80, 95, 94,
229 77, 76, 75, 74, 73, 93, 92, 91, 90, 89,
230 103, 102, 101, 100, 99, 119, 118, 117, 116, 115,
231 98, 97, 96, 111, 110, 114, 113, 112, 127, 126,
232 109, 108, 107, 106, 105, 125, 124, 123, 122, 121,
233 135, 134, 133, 132, 131, 151, 150, 149, 148, 147,
234 130, 129, 128, 143, 142, 146, 145, 144, 159, 158,
235 141, 140, 139, 138, 137, 157, 156, 155, 154, 153,
236 167, 166, 165, 164, 163, 183, 182, 181, 180, 179,
237 162, 161, 160, 175, 174, 178, 177, 176, 191, 190,
238 173, 172, 171, 170, 169, 189, 188, 187, 186, 185,
239 199, 198, 197, 196, 195, 215, 214, 213, 212, 211,
240 194, 193, 192, 207, 206, 210, 209, 208, 223, 222,
241 205, 204, 203, 202, 201, 221, 220, 219, 218, 217,
242 231, 230, 229, 228, 227, 247, 246, 245, 244, 243,
243 226, 225, 224, 239, 238, 242, 241, 240, 255, 254,
244 237, 236, 235, 234, 233, 253, 252, 251, 250, 249,
247 int add=prepostAddress(prepost);
248 if(add>=0) v=mData->rawTriggerDet[add].CTB[ctbMap[pmt]];
252 unsigned short StTriggerData2008::ctbTraySlat(
int tray,
int slat,
int prepost)
const{
253 static const unsigned char ctbMap[2][120] = {
254 { 109, 108, 107, 106, 105, 7, 6, 5, 4, 3,
255 2, 1, 0, 15, 14, 13, 12, 11, 10, 9,
256 39, 38, 37, 36, 35, 34, 33, 32, 47, 46,
257 45, 44, 43, 42, 41, 71, 70, 69, 68, 67,
258 66, 65, 64, 79, 78, 77, 76, 75, 74, 73,
259 103, 102, 101, 100, 99, 98, 97, 96, 111, 110,
260 141, 140, 139, 138, 137, 167, 166, 165, 164, 163,
261 162, 161, 160, 175, 174, 173, 172, 171, 170, 169,
262 199, 198, 197, 196, 195, 194, 193, 192, 207, 206,
263 205, 204, 203, 202, 201, 231, 230, 229, 228, 227,
264 226, 225, 224, 239, 238, 237, 236, 235, 234, 233,
265 135, 134, 133, 132, 131, 130, 129, 128, 143, 142},
266 { 125, 124, 123, 122, 121, 23, 22, 21, 20, 19,
267 18, 17, 16, 31, 30, 29, 28, 27, 26, 25,
268 55, 54, 53, 52, 51, 50, 49, 48, 63, 62,
269 61, 60, 59, 58, 57, 87, 86, 85, 84, 83,
270 82, 81, 80, 95, 94, 93, 92, 91, 90, 89,
271 119, 118, 117, 116, 115, 114, 113, 112, 127, 126,
272 157, 156, 155, 154, 153, 183, 182, 181, 180, 179,
273 178, 177, 176, 191, 190, 189, 188, 187, 186, 185,
274 215, 214, 213, 212, 211, 210, 209, 208, 223, 222,
275 221, 220, 219, 218, 217, 247, 246, 245, 244, 243,
276 242, 241, 240, 255, 254, 253, 252, 251, 250, 249,
277 151, 150, 149, 148, 147, 146, 145, 144, 159, 158}
280 int add=prepostAddress(prepost);
281 if(add>=0) v=mData->rawTriggerDet[add].CTB[ctbMap[slat][tray]];
285 unsigned short StTriggerData2008::ctbSum(
int prepost)
const{
286 unsigned short sum=0;
287 for (
int i=1; i<240; i++){sum+=ctb(i,prepost);}
291 unsigned short StTriggerData2008::bbcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
293 static const int q_map[2][24] = {
294 { 8 , 5 , 4 , 40 , 37 , 36 , 7 , 6 ,
295 3 , 2 , 1 , 39 , 38 , 35 , 34 , 33 ,
296 72 , 71 , 70 , 69 , 68 , 67 , 66 , 65 },
297 { 24 , 21 , 20 , 56 , 53 , 52 , 23 , 22 ,
298 19 , 18 , 17 , 55 , 54 , 51 , 50 , 49 ,
299 88 , 87 , 86 , 85 , 84 , 83 , 82 , 81 }
301 return mData->rawTriggerDet[prepostAddress(prepost)].BBC[q_map[eastwest][pmt-1]-1];
304 unsigned short StTriggerData2008::bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
306 static const int t_map[2][24] ={
307 { 16 , 13 , 12 , 48 , 45 , 44 , 15 , 14 ,
308 11 , 10 , 9 , 47 , 46 , 43 , 42 , 41 ,
309 80 , 79 , 78 , 77 , 76 , 75 , 74 , 73 },
310 { 32 , 29 , 28 , 64 , 61 , 60 , 31 , 30 ,
311 27 , 26 , 25 , 63 , 62 , 59 , 58 , 57 ,
312 96 , 95 , 94 , 93 , 92 , 91 , 90 , 89 }
314 return mData->rawTriggerDet[prepostAddress(prepost)].BBC[t_map[eastwest][pmt-1]-1];
317 unsigned short StTriggerData2008::bbcADCSum(StBeamDirection eastwest,
int prepost)
const
319 int address = prepostAddress(prepost);
322 mData->rawTriggerDet[address].BBClayer1[7]%2048+
323 mData->rawTriggerDet[address].BBClayer1[3]%2048;
327 mData->rawTriggerDet[address].BBClayer1[5]%2048+
328 mData->rawTriggerDet[address].BBClayer1[1]%2048;
332 unsigned short StTriggerData2008::bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost)
const
334 int address = prepostAddress(prepost);
335 if (eastwest==east) {
return mData->rawTriggerDet[address].BBClayer1[11]%2048; }
336 else {
return mData->rawTriggerDet[address].BBClayer1[10]%2048; }
339 unsigned short StTriggerData2008::bbcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
341 int address = prepostAddress(prepost), t1, t2;
343 t1 = mData->rawTriggerDet[address].BBClayer1[6]%256;
344 t2 = mData->rawTriggerDet[address].BBClayer1[2]%256;
347 t1 = mData->rawTriggerDet[address].BBClayer1[4]%256;
348 t2 = mData->rawTriggerDet[address].BBClayer1[0]%256;
350 return (t1>t2) ? t1 : t2;
353 unsigned short StTriggerData2008::bbcTimeDifference()
const
355 return mData->TrgSum.DSMdata.VTX[3]%512;
358 unsigned short StTriggerData2008::fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost)
const
360 static const short fpdmap[2][6][49] = {
364 {39, 38, 37, 36, 35, 34, 33,
365 7, 6, 5, 23, 22, 21, 55,
366 4, 3, 2, 20, 19, 18, 54,
367 1, 0, 15, 17, 16, 31, 53,
368 14, 13, 12, 30, 29, 28, 52,
369 11, 10, 9, 27, 26, 25, 51,
370 32, 47, 46, 45, 44, 43, 42},
372 { 103,101,100, 99, 98, 97, 96,
373 71, 70, 69, 87, 86, 85, 48,
374 68, 67, 66, 84, 83, 82, 63,
375 65, 64, 79, 81, 80, 95, 61,
376 78, 77 ,76, 94, 93, 92, 60,
377 75, 74, 73, 91, 90, 89, 59,
378 111,110,109,108, 107, 106,105},
380 {135, 134, 133, 132, 131, 130, 129, 128, 143, 142,
381 119, 118, 117, 116, 115, 114, 113, 112,
382 127, 126, 125, 124, 123, 122, 121,
384 -1, -1, -1, -1, -1, -1, -1,
385 -1, -1, -1, -1, -1, -1, -1,
386 -1, -1, -1, -1, -1, -1, -1},
388 {151, 150, 149, 148, 147, 146, 145, 144,
389 159, 158, 157, 156, 155, 154, 153,
390 167, 166, 165, 164, 163, 162, 161, 160, 175, 174,
392 -1, -1, -1, -1, -1, -1, -1,
393 -1, -1, -1, -1, -1, -1, -1,
394 -1, -1, -1, -1, -1, -1, -1},
396 { 50, 49, 141, 140, 139, 138, 137,
397 -1, -1, -1, -1, -1, -1, -1,
398 -1, -1, -1, -1, -1, -1, -1,
399 -1, -1, -1, -1, -1, -1, -1,
400 -1, -1, -1, -1, -1, -1, -1,
401 -1, -1, -1, -1, -1, -1, -1,
402 -1, -1, -1, -1, -1, -1, -1},
404 { 58, 57, 173, 172, 171, 170, 169,
405 -1, -1, -1, -1, -1, -1, -1,
406 -1, -1, -1, -1, -1, -1, -1,
407 -1, -1, -1, -1, -1, -1, -1,
408 -1, -1, -1, -1, -1, -1, -1,
409 -1, -1, -1, -1, -1, -1, -1,
410 -1, -1, -1, -1, -1, -1, -1},
415 { -1, -1, -1, -1, -1, -1, -1,
416 -1, -1, -1, -1, -1, -1, -1,
417 -1, -1, -1, -1, -1, -1, -1,
418 -1, -1, -1, -1, -1, -1, -1,
419 -1, -1, -1, -1, -1, -1, -1,
420 -1, -1, -1, -1, -1, -1, -1,
421 -1, -1, -1, -1, -1, -1, -1},
423 { 71, 70, 87, 86, 96, 97, 48,
424 69, 68, 85, 84, 98, 99, 63,
425 67, 66, 83, 82, 100, 101, 62,
426 65, 64, 81, 80, 102, 103, 61,
427 79, 78, 90, 91, 106, 107, 60,
428 77, 76, 92, 93, 108, 109, 59,
429 75, 74, 94, 95, 110, 111, 58},
431 { -1, -1, -1, -1, -1, -1, -1,
432 -1, -1, -1, -1, -1, -1, -1,
433 -1, -1, -1, -1, -1, -1, -1,
434 -1, -1, -1, -1, -1, -1, -1,
435 -1, -1, -1, -1, -1, -1, -1,
436 -1, -1, -1, -1, -1, -1, -1,
437 -1, -1, -1, -1, -1, -1, -1},
439 { 77, 70, 69, 68, 67,
445 -1, -1, -1, -1, -1, -1, -1,
446 -1, -1, -1, -1, -1, -1, -1,
447 -1, -1, -1, -1, -1, -1, -1},
449 { -1, -1, -1, -1, -1, -1, -1,
450 -1, -1, -1, -1, -1, -1, -1,
451 -1, -1, -1, -1, -1, -1, -1,
452 -1, -1, -1, -1, -1, -1, -1,
453 -1, -1, -1, -1, -1, -1, -1,
454 -1, -1, -1, -1, -1, -1, -1,
455 -1, -1, -1, -1, -1, -1, -1},
457 { 7, 6, 5, 4, 3, 2, 1,
458 -1, -1, -1, -1, -1, -1, -1,
459 -1, -1, -1, -1, -1, -1, -1,
460 -1, -1, -1, -1, -1, -1, -1,
461 -1, -1, -1, -1, -1, -1, -1,
462 -1, -1, -1, -1, -1, -1, -1,
463 -1, -1, -1, -1, -1, -1, -1},
466 int address = fpdmap[eastwest][module][pmt-1];
469 if (address<112)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer0[address];
470 else return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastTBLayer0[address-112];
481 unsigned short StTriggerData2008::fpdSum(StBeamDirection eastwest,
int module)
const
483 static const short map[2][4]={{3,2,1,0},{7,6,5,4}};
484 static const short nbit[2][4]={{16384,16384,8192,8192},{16384,16384,8192,8192}};
485 return mData->TrgSum.DSMdata.FPD[map[eastwest][module]] % nbit[eastwest][module];
488 unsigned short StTriggerData2008::fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost)
const{
490 if (channel<8)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer1[channel];
495 unsigned short StTriggerData2008::fpdLayer1DSM(StBeamDirection eastwest,
int module,
int board,
int prepost)
const{
496 static const short map[4][4]={{3,2,1,0},{7,6,5,4},{3,2,6,7},{1,0,4,5}};
499 if (module<2)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer1[map[module][board]];
509 unsigned short StTriggerData2008::fpdLayer2DSMRaw(
int channel)
const{
510 if (channel<8)
return mData->TrgSum.DSMdata.FPD[channel];
514 unsigned short StTriggerData2008::fpdLayer2DSM(StBeamDirection eastwest,
int module)
const{
515 static const int dsmmap[2][4]={{3,2,1,0},{7,6,5,4}};
516 if (module<4)
return mData->TrgSum.DSMdata.FPD[dsmmap[eastwest][module]];
520 unsigned short StTriggerData2008::zdcAtChannel(
int channel,
int prepost)
const
522 static const int dsmmap[16]={7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
523 if (channel>=0 && channel<16){
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[dsmmap[channel]]; }
527 unsigned short StTriggerData2008::zdcAtAddress(
int address,
int prepost)
const
529 if (address>=0 && address<16){
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[address]; }
533 unsigned short StTriggerData2008::zdcUnAttenuated(StBeamDirection eastwest,
int prepost)
const
535 if (eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[4];}
536 if (eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[0];}
540 unsigned short StTriggerData2008::zdcAttenuated(StBeamDirection eastwest,
int prepost)
const
542 if (eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[13];}
543 if (eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[10];}
547 unsigned short StTriggerData2008::zdcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
549 if (eastwest==east && pmt==1) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[7];}
550 if (eastwest==east && pmt==2) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[6];}
551 if (eastwest==east && pmt==3) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[5];}
552 if (eastwest==west && pmt==1) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[3];}
553 if (eastwest==west && pmt==2) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[2];}
554 if (eastwest==west && pmt==3) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[1];}
559 unsigned short StTriggerData2008::zdcTDC(StBeamDirection eastwest,
int prepost)
const
561 if (eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[8];}
562 if (eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[9];}
566 unsigned short StTriggerData2008::zdcHardwareSum(
int prepost)
const
568 return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[14];
571 unsigned short StTriggerData2008::zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost)
const
574 static const int zdcsmd_map[2][2][8] ={
575 { { 7, 6, 5, 4, 3, 2, 1,11} ,
576 { 0,15,14,13,12,8, 10, 9} } ,
577 { {23,22,21,20,19,18,17,26} ,
578 {16,31,30,29,28,27,24,25} }
580 if (verthori<0 || verthori>1)
return 0;
581 if (strip<1 || strip>8)
return 0;
583 add=zdcsmd_map[eastwest][verthori][strip-1];
584 if(add>=0)
return mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[add];
588 unsigned short StTriggerData2008::bemcLayer1DSM(
int channel,
int prepost)
const {
589 const int n_bemc_layer1=48;
590 if (channel<0 || channel >=n_bemc_layer1) {
591 gMessMgr->Warning() <<
"Barrel DSM layer 1 out of range (" << channel <<
")" << endm;
594 return mData->rawTriggerDet[prepostAddress(prepost)].BEMClayer1[channel];
597 unsigned short StTriggerData2008::eemcLayer1DSM(
int channel,
int prepost)
const {
598 const int n_eemc_layer1=48;
599 if (channel<0 || channel >=n_eemc_layer1) {
600 gMessMgr->Warning() <<
"Endap DSM layer 1 out of range (" << channel <<
")" << endm;
603 return mData->rawTriggerDet[prepostAddress(prepost)].EEMClayer1[channel];
606 unsigned short StTriggerData2008::emcLayer2DSM(
int channel)
const {
607 const int n_emc_layer2=8;
608 if (channel<0 || channel >=n_emc_layer2) {
609 gMessMgr->Warning() <<
"EMC DSM layer 2 out of range (" << channel <<
")" << endm;
612 return mData->TrgSum.DSMdata.EMC[channel];
615 unsigned char StTriggerData2008::bemcHighTower(
int patch_id,
int prepost)
const
618 const int m_max_patch=300;
620 if ( patch_id < 0 || patch_id >= m_max_patch) {
621 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
626 int channel=patch_id%10;
627 unsigned short trg_word;
629 trg_word=decodeEmc12bit(dsm-15,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCEast);
631 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCWest);
632 return trg_word & 0x3F;
635 unsigned char StTriggerData2008::bemcJetPatch (
int patch_id,
int prepost)
const
638 const int m_max_patch=300;
640 if ( patch_id < 0 || patch_id >= m_max_patch) {
641 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
646 int channel=patch_id%10;
647 unsigned short trg_word;
649 trg_word=decodeEmc12bit(dsm-15,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCEast);
651 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCWest);
652 return trg_word >> 6;
655 unsigned char StTriggerData2008::eemcHighTower(
int patch_id,
int prepost)
const
658 const int m_max_patch=90;
660 if ( patch_id < 0 || patch_id >= m_max_patch) {
661 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
666 int channel=patch_id%10;
667 unsigned short trg_word;
668 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].EEMC);
669 return trg_word & 0x3F;
672 unsigned char StTriggerData2008::eemcJetPatch (
int patch_id,
int prepost)
const
675 const int m_max_patch=90;
677 if ( patch_id < 0 || patch_id >= m_max_patch) {
678 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
683 int channel=patch_id%10;
684 unsigned short trg_word;
685 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].EEMC);
686 return trg_word >> 6;
689 unsigned char StTriggerData2008::bemcHighestTowerADC(
int prepost)
const
692 const int m_max_patch=300;
694 for (
int i=1; i<m_max_patch; i++){
695 unsigned char hh=bemcHighTower(i,prepost);
701 unsigned char StTriggerData2008::eemcHighestTowerADC(
int prepost)
const
704 const int m_max_patch=90;
706 for (
int i=1; i<m_max_patch; i++){
707 unsigned char hh=eemcHighTower(i,prepost);
713 void StTriggerData2008::dump()
const
715 printf(
"***** StTriggerData Dump *****\n");
716 printf(
" Year=%d Version=%x\n",year(),version());
717 printf(
" %d pre and %d post crossing data available\n",numberOfPreXing(),numberOfPostXing());
718 printf(
" Token=%d TriggerWord=%x ActionWord=%x BusyStatus=%x\n",
719 token(), triggerWord(), actionWord(), busyStatus());
720 printf(
" TUC Bits=%d : ",tcuBits());
721 for (
int i=0; i<16; i++) {printf(
" %d",(tcuBits()>>(15-i))%2);}; printf(
"\n");
722 printf(
" BunchId 7bit=%d 48bit=%d\n",bunchId7Bit(), bunchId48Bit());
723 printf(
" Spin Bits=%d : ",spinBit());
724 for (
int i=0; i<8; i++) {printf(
" %d",(spinBit()>>(7-i))%2);}; printf(
"\n");
725 printf(
" CTB ADC : ");
for (
int i=0; i<240;i++){ printf(
"%d ",ctb(i,0)); }; printf(
"\n");
726 printf(
" BBC East ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(east,i,0)); }; printf(
"\n");
727 printf(
" BBC West ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(west,i,0)); }; printf(
"\n");
728 printf(
" BBC East TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(east,i,0)); }; printf(
"\n");
729 printf(
" BBC West TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(west,i,0)); }; printf(
"\n");
730 for (
int i=-numberOfPreXing(); i<=static_cast<int>(numberOfPostXing()); i++){
731 printf(
" BBC Sums %d xing : ",i);
732 printf(
"East=%d West=%d Large tile East=%d West=%d\n",
733 bbcADCSum(east,i),bbcADCSum(west,i),
734 bbcADCSumLargeTile(east,i),bbcADCSumLargeTile(west,i));
736 printf(
" BBC Earilest : "); printf(
"East=%d West=%d Difference+256=%d\n",
737 bbcEarliestTDC(east,0),bbcEarliestTDC(west,0),bbcTimeDifference());
738 printf(
" FPD East North : ");
for (
int i=1; i<=49;i++){ printf(
"%d ",fpd(east,0,i,0)); }; printf(
"\n");
739 printf(
" FPD East South : ");
for (
int i=1; i<=49;i++){ printf(
"%d ",fpd(east,1,i,0)); }; printf(
"\n");
740 printf(
" FPD East Top : ");
for (
int i=1; i<=25;i++){ printf(
"%d ",fpd(east,2,i,0)); }; printf(
"\n");
741 printf(
" FPD East Bottom : ");
for (
int i=1; i<=25;i++){ printf(
"%d ",fpd(east,3,i,0)); }; printf(
"\n");
742 printf(
" FPD East North PS: ");
for (
int i=1; i<= 7;i++){ printf(
"%d ",fpd(east,4,i,0)); }; printf(
"\n");
743 printf(
" FPD East South PS: ");
for (
int i=1; i<= 7;i++){ printf(
"%d ",fpd(east,5,i,0)); }; printf(
"\n");
744 printf(
" FPD West South : ");
for (
int i=1; i<=49;i++){ printf(
"%d ",fpd(west,1,i,0)); }; printf(
"\n");
745 printf(
" FPD West Bottom : ");
for (
int i=1; i<=25;i++){ printf(
"%d ",fpd(west,3,i,0)); }; printf(
"\n");
746 printf(
" FPD West South PS: ");
for (
int i=1; i<= 7;i++){ printf(
"%d ",fpd(west,5,i,0)); }; printf(
"\n");
747 printf(
" FPD Sums East : ");
for (
int j=0; j<4 ;j++) printf(
"%d ",fpdSum(east,j)); printf(
"\n");
748 printf(
" FPD Sums West : ");
for (
int j=0; j<4 ;j++) printf(
"%d ",fpdSum(west,j)); printf(
"\n");
749 printf(
" ZDC Sum(A) East : ");printf(
"%d ",zdcAttenuated(east)); printf(
"\n");
750 printf(
" ZDC Sum(A) West : ");printf(
"%d ",zdcAttenuated(west)); printf(
"\n");
751 printf(
" ZDC Sum(UA) East : ");printf(
"%d ",zdcUnAttenuated(east)); printf(
"\n");
752 printf(
" ZDC Sum(UA) West : ");printf(
"%d ",zdcUnAttenuated(west)); printf(
"\n");
753 printf(
" VPD E Earliest TAC : %d\n", vpdEarliestTDC(east));
754 printf(
" VPD W Earliest TAC : %d\n", vpdEarliestTDC(west));
755 printf(
" VPD TimeDifference : %d\n", vpdTimeDifference());
756 printf(
" TOF : ");
for (
int j=0; j<16 ;j++) {printf(
"%d ",tofAtAddress(j));} printf(
"\n");
757 printf(
" TOF Multiplicity : %d\n",tofMultiplicity());
758 printf(
" NQTData=%d\n",nQTdata());
759 printf(
" QTLastWord=0x%x\n",(QTdata())[nQTdata()-1]);
760 printf(
" L2 result : \n");
761 for (
int j=0; j<4 ;j++) {
for (
int k=0; k<16; k++) {printf(
"%u ",*(l2Result()+j*16+k)); } printf(
"\n");}
763 printf(
"***** StTriggerData Dump *****\n");
766 char* StTriggerData2008::getTriggerStructure()
768 return (
char*) mData;
776 int StTriggerData2008::getRawSize()
const
778 int npre = numberOfPreXing();
779 int npost = numberOfPostXing();
785 unsigned char * StTriggerData2008::getDsm0_EEMC(
int prepost)
const {
786 return mData->rawTriggerDet[prepostAddress(prepost)].EEMC;
789 unsigned short int * StTriggerData2008::getDsm1_EEMC(
int prepost)
const{
790 return mData->rawTriggerDet[prepostAddress(prepost)].EEMClayer1;
793 unsigned short int * StTriggerData2008::getDsm2_EMC()
const{
794 return mData->TrgSum.DSMdata.EMC;
797 unsigned short int * StTriggerData2008::getDsm3()
const{
798 return mData->TrgSum.DSMdata.lastDSM;
801 int StTriggerData2008::L2ResultsOffset(StL2AlgorithmId
id)
const
804 case l2Diagnostic:
return L2RESULTS_2008_OFFSET_TRG;
805 case l2EmcCheck:
return L2RESULTS_2008_OFFSET_EMC_CHECK;
806 case l2Jpsi:
return L2RESULTS_2008_OFFSET_JPSI;
807 case l2Upsilon:
return L2RESULTS_2008_OFFSET_UPS;
808 case l2EmcPedestal:
return L2RESULTS_2008_OFFSET_EMC_PED;
809 case l2Pi0Gamma:
return L2RESULTS_2008_OFFSET_GAMMA;
810 case l2Dijet:
return L2RESULTS_2008_OFFSET_DIJET;
811 default:
return -999999999;
815 bool StTriggerData2008::isL2Triggered(StL2TriggerResultType
id)
const
858 unsigned int StTriggerData2008::l2ResultLength()
const
860 return sizeof(mData->TrgSum.L2Result)/
sizeof(
unsigned int);
863 const unsigned int* StTriggerData2008::l2Result()
const
865 return mData->TrgSum.L2Result;
868 unsigned short StTriggerData2008::vpdADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
870 static const int map[2][16] = {
871 { 7, 6, 5, 4, 3, 2, 1, 0,
872 23, 22, 21, 20, 19, 18, 17, 16} ,
873 { 39, 38, 37, 36, 35, 34, 33, 32,
874 55, 54, 53, 52, 51, 50, 49, 48}
876 return mData->rawTriggerDet[prepostAddress(prepost)].VPD[map[eastwest][pmt-1]];
879 unsigned short StTriggerData2008::vpdTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
881 static const int map[2][16] = {
882 { 15, 14, 13, 12, 11, 10, 9, 8,
883 31, 30, 29, 28, 27, 26, 25, 24} ,
884 { 47, 46, 45, 44, 43, 42, 41, 40,
885 63, 62, 61, 60, 59, 58, 57, 56}
887 return mData->rawTriggerDet[prepostAddress(prepost)].VPD[map[eastwest][pmt-1]];
890 unsigned short StTriggerData2008::vpdEarliestTDC(StBeamDirection eastwest,
int prepost)
const
892 if(prepost!=0)
return 0;
893 int map[2][2] = {{2, 0},{6, 4}};
894 int i1 = map[eastwest][0];
895 int i2 = map[eastwest][1];
896 bool b1 = (mData->TrgSum.DSMdata.VPD[i1] >> 8) & 0x1;
897 bool b2 = (mData->TrgSum.DSMdata.VPD[i2] >> 8) & 0x1;
898 int t1 = mData->TrgSum.DSMdata.VPD[i1] & 0xFF;
899 int t2 = mData->TrgSum.DSMdata.VPD[i2] & 0xFF;
900 if(b1 && b2) {
return (t1>t2) ? t1 : t2;}
901 else if(b1) {
return t1;}
902 else if(b2) {
return t2;}
906 unsigned short StTriggerData2008::vpdTimeDifference()
const
908 return mData->TrgSum.DSMdata.CTB[4] & 0x1FF;
911 unsigned short StTriggerData2008::nQTdata(
int prepost)
const
913 return mData->rawTriggerDet[prepostAddress(prepost)].QQTdataBytes/4;
916 unsigned int* StTriggerData2008::QTdata(
int prepost)
const
918 return mData->rawTriggerDet[prepostAddress(prepost)].QQTdata;
921 unsigned char* StTriggerData2008::getDsm_FMS(
int prepost)
const {
return mData->rawTriggerDet[prepostAddress(prepost)].FPDW;}
922 unsigned char* StTriggerData2008::getDsm01_FMS(
int prepost)
const {
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer0;}
923 unsigned char* StTriggerData2008::getDsm02_FMS(
int prepost)
const {
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastTBLayer0;}
924 unsigned short int* StTriggerData2008::getDsm1_FMS(
int prepost)
const {
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer1;}
925 unsigned short int* StTriggerData2008::getDsm2_FMS()
const {
return mData->TrgSum.DSMdata.FPD;}
927 unsigned short StTriggerData2008::mtdAtAddress(
int address,
int prepost)
const
929 if (address>=0 && address<32){
return mData->rawTriggerDet[prepostAddress(prepost)].MTD[address]; }
933 unsigned short StTriggerData2008::mtdAdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
935 static const int map[2][8] = {
936 { 6, 5, 11, 12, 13, 10, 9, 8},
937 { 7, 4, 3, 2, 1, 0, 15, 14}
939 if(pmt>=0 && pmt<8) {
return mData->rawTriggerDet[prepostAddress(prepost)].MTD[map[eastwest][pmt]]; }
943 unsigned short StTriggerData2008::mtdTdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
945 static const int map[2][8] = {
946 {22,21,27,28,29,26,25,24},
947 {23,20,19,18,17,16,31,30}
949 if(pmt>=0 && pmt<8) {
return mData->rawTriggerDet[prepostAddress(prepost)].MTD[map[eastwest][pmt]]; }
953 unsigned short StTriggerData2008::tofAtAddress(
int address,
int prepost)
const
955 if (address>=0 && address<16){
return mData->rawTriggerDet[prepostAddress(prepost)].TOF[address]; }
959 unsigned short StTriggerData2008::tofMultiplicity(
int prepost)
const
961 return mData->rawTriggerDet[prepostAddress(prepost)].TOF[8];