72 #include "StTriggerData2004.h"
73 #include "StDaqLib/TRG/trgStructures2004.h"
88 int npre = data->EvtDesc.npre;
89 int npost = data->EvtDesc.npost;
97 memcpy(mData,data,size);
101 unsigned int StTriggerData2004::version()
const
103 return mData->EvtDesc.TrgDataFmtVer;
106 StTriggerData2004::~StTriggerData2004() {
delete mData;}
108 unsigned int StTriggerData2004::token()
const
110 return mData->EvtDesc.TrgToken;
113 unsigned int StTriggerData2004::triggerWord()
const
115 return mData->EvtDesc.TriggerWord;
118 unsigned int StTriggerData2004::actionWord()
const
121 ( (
unsigned short)(mData->EvtDesc.actionWdTrgCommand) * 16 * 16 * 16 ) +
122 ( (
unsigned short)(mData->EvtDesc.actionWdDaqCommand) * 16 * 16 ) +
123 ( mData->EvtDesc.actionWdDetectorBitMask & 0x00ff ) ;
126 unsigned int StTriggerData2004::numberOfPreXing()
const
128 return mData->EvtDesc.npre;
131 unsigned int StTriggerData2004::numberOfPostXing()
const
133 return mData->EvtDesc.npost;
136 unsigned short StTriggerData2004::busyStatus()
const{
137 return mData->EvtDesc.modifiedBusyStatus;
140 unsigned short StTriggerData2004::dsmInput()
const{
141 return mData->EvtDesc.DSMInput;
144 unsigned short StTriggerData2004::trgToken()
const{
145 return mData->EvtDesc.TrgToken;
148 unsigned short StTriggerData2004::dsmAddress()
const{
149 return mData->EvtDesc.DSMAddress;
152 unsigned short StTriggerData2004::mAddBits()
const{
153 return mData->EvtDesc.addBits;
156 unsigned short StTriggerData2004::bcData(
int channel)
const{
157 return mData->TrgSum.DSMdata.BCdata[channel];
160 unsigned short StTriggerData2004::lastDSM(
int channel)
const{
161 return mData->TrgSum.DSMdata.lastDSM[channel];
164 unsigned short StTriggerData2004::tcuBits()
const
166 return mData->EvtDesc.DSMInput;
169 unsigned int StTriggerData2004::bunchCounterHigh()
const
171 return mData->EvtDesc.bunchXing_hi;
174 unsigned int StTriggerData2004::bunchCounterLow()
const
176 return mData->EvtDesc.bunchXing_lo;
179 unsigned int StTriggerData2004::bunchId48Bit()
const
181 unsigned long long bxinghi,bxing1,bxinglo, bx;
182 bxinghi = mData->TrgSum.DSMdata.BCdata[3];
183 bxing1 = mData->TrgSum.DSMdata.BCdata[10];
184 bxinglo = (bxing1 << 16) + mData->TrgSum.DSMdata.BCdata[11];
185 bx = (bxinghi << 32) + bxinglo;
186 return (
int)(bx % 120);
189 unsigned int StTriggerData2004::bunchId7Bit()
const
192 b7dat = mData->TrgSum.DSMdata.BCdata[2];
197 unsigned int StTriggerData2004::spinBit()
const
199 return (mData->TrgSum.DSMdata.lastDSM[7]/16)%256;
202 unsigned int StTriggerData2004::spinBitYellowFilled()
const
204 unsigned int sb = spinBit();
208 unsigned int StTriggerData2004::spinBitYellowUp()
const
210 unsigned int sb = spinBit();
214 unsigned int StTriggerData2004::spinBitYellowDown()
const
216 unsigned int sb = spinBit();
220 unsigned int StTriggerData2004::spinBitYellowUnpol()
const
222 unsigned int sb = spinBit();
226 unsigned int StTriggerData2004::spinBitBlueFilled()
const
228 unsigned int sb = spinBit();
232 unsigned int StTriggerData2004::spinBitBlueUp()
const
234 unsigned int sb = spinBit();
238 unsigned int StTriggerData2004::spinBitBlueDown()
const
240 unsigned int sb = spinBit();
244 unsigned int StTriggerData2004::spinBitBlueUnpol()
const
246 unsigned int sb = spinBit();
250 unsigned short StTriggerData2004::ctbRaw(
int address,
int prepost)
const
252 return mData->rawTriggerDet[prepostAddress(prepost)].CTB[address];
255 unsigned short StTriggerData2004::ctb(
int pmt,
int prepost)
const
257 static const unsigned char ctbMap[240] = {
258 7, 6, 5, 4, 3, 23, 22, 21, 20, 19,
259 2, 1, 0, 15, 14, 18, 17, 16, 31, 30,
260 13, 12, 11, 10, 9, 29, 28, 27, 26, 25,
261 39, 38, 37, 36, 35, 55, 54, 53, 52, 51,
262 34, 33, 32, 47, 46, 50, 49, 48, 63, 62,
263 45, 44, 43, 42, 41, 61, 60, 59, 58, 57,
264 71, 70, 69, 68, 67, 87, 86, 85, 84, 83,
265 66, 65, 64, 79, 78, 82, 81, 80, 95, 94,
266 77, 76, 75, 74, 73, 93, 92, 91, 90, 89,
267 103, 102, 101, 100, 99, 119, 118, 117, 116, 115,
268 98, 97, 96, 111, 110, 114, 113, 112, 127, 126,
269 109, 108, 107, 106, 105, 125, 124, 123, 122, 121,
270 135, 134, 133, 132, 131, 151, 150, 149, 148, 147,
271 130, 129, 128, 143, 142, 146, 145, 144, 159, 158,
272 141, 140, 139, 138, 137, 157, 156, 155, 154, 153,
273 167, 166, 165, 164, 163, 183, 182, 181, 180, 179,
274 162, 161, 160, 175, 174, 178, 177, 176, 191, 190,
275 173, 172, 171, 170, 169, 189, 188, 187, 186, 185,
276 199, 198, 197, 196, 195, 215, 214, 213, 212, 211,
277 194, 193, 192, 207, 206, 210, 209, 208, 223, 222,
278 205, 204, 203, 202, 201, 221, 220, 219, 218, 217,
279 231, 230, 229, 228, 227, 247, 246, 245, 244, 243,
280 226, 225, 224, 239, 238, 242, 241, 240, 255, 254,
281 237, 236, 235, 234, 233, 253, 252, 251, 250, 249,
283 return mData->rawTriggerDet[prepostAddress(prepost)].CTB[ctbMap[pmt]];
286 unsigned short StTriggerData2004::ctbTraySlat(
int tray,
int slat,
int prepost)
const{
287 static const unsigned char ctbMap[2][120] = {
288 { 109, 108, 107, 106, 105, 7, 6, 5, 4, 3,
289 2, 1, 0, 15, 14, 13, 12, 11, 10, 9,
290 39, 38, 37, 36, 35, 34, 33, 32, 47, 46,
291 45, 44, 43, 42, 41, 71, 70, 69, 68, 67,
292 66, 65, 64, 79, 78, 77, 76, 75, 74, 73,
293 103, 102, 101, 100, 99, 98, 97, 96, 111, 110,
294 141, 140, 139, 138, 137, 167, 166, 165, 164, 163,
295 162, 161, 160, 175, 174, 173, 172, 171, 170, 169,
296 199, 198, 197, 196, 195, 194, 193, 192, 207, 206,
297 205, 204, 203, 202, 201, 231, 230, 229, 228, 227,
298 226, 225, 224, 239, 238, 237, 236, 235, 234, 233,
299 135, 134, 133, 132, 131, 130, 129, 128, 143, 142},
300 { 125, 124, 123, 122, 121, 23, 22, 21, 20, 19,
301 18, 17, 16, 31, 30, 29, 28, 27, 26, 25,
302 55, 54, 53, 52, 51, 50, 49, 48, 63, 62,
303 61, 60, 59, 58, 57, 87, 86, 85, 84, 83,
304 82, 81, 80, 95, 94, 93, 92, 91, 90, 89,
305 119, 118, 117, 116, 115, 114, 113, 112, 127, 126,
306 157, 156, 155, 154, 153, 183, 182, 181, 180, 179,
307 178, 177, 176, 191, 190, 189, 188, 187, 186, 185,
308 215, 214, 213, 212, 211, 210, 209, 208, 223, 222,
309 221, 220, 219, 218, 217, 247, 246, 245, 244, 243,
310 242, 241, 240, 255, 254, 253, 252, 251, 250, 249,
311 151, 150, 149, 148, 147, 146, 145, 144, 159, 158}
313 int add=prepostAddress(prepost);
314 if(add>=0)
return mData->rawTriggerDet[prepostAddress(prepost)].CTB[ctbMap[slat][tray]];
318 unsigned short StTriggerData2004::ctbSum(
int prepost)
const{
319 unsigned short sum=0;
320 for(
int i=1; i<240; i++){sum+=ctb(i,prepost);}
324 unsigned short StTriggerData2004::mwc(
int pmt,
int prepost)
const
326 static const unsigned char mwcMap[96] = {
327 71, 70, 69, 68, 67, 66, 65, 64, 79, 78, 77, 76,
328 95, 94, 93, 92, 87, 86, 85, 84, 83, 82, 81, 80,
329 99, 98, 97, 96, 111, 110, 109, 108, 103, 102, 101, 100,
330 119, 118, 117, 116, 115, 114, 113, 112, 127, 126, 125, 124,
331 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12,
332 31, 30, 29, 28, 23, 22, 21, 20, 19, 18, 17, 16,
333 35, 34, 33, 32, 47, 46, 45, 44, 39, 38, 37, 36,
334 55, 54, 53, 52, 51, 50, 49, 48, 63, 62, 61, 60,
336 return mData->rawTriggerDet[prepostAddress(prepost)].MWC[mwcMap[pmt]];
339 unsigned short StTriggerData2004::bbcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
341 static const int q_map[2][24] = {
342 { 8 , 5 , 4 , 40 , 37 , 36 , 7 , 6 ,
343 3 , 2 , 1 , 39 , 38 , 35 , 34 , 33 ,
344 72 , 71 , 70 , 69 , 68 , 67 , 66 , 65 },
345 { 24 , 21 , 20 , 56 , 53 , 52 , 23 , 22 ,
346 19 , 18 , 17 , 55 , 54 , 51 , 50 , 49 ,
347 80 , 79 , 78 , 77 , 76 , 75 , 74 , 73 }
349 return mData->rawTriggerDet[prepostAddress(prepost)].BBC[q_map[eastwest][pmt-1]-1];
352 unsigned short StTriggerData2004::bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
354 static const int t_map[2][16] ={
355 { 16 , 13 , 12 , 48 , 45 , 44 , 15 , 14 ,
356 11 , 10 , 9 , 47 , 46 , 43 , 42 , 41 },
357 { 32 , 29 , 28 , 64 , 61 , 60 , 31 , 30 ,
358 27 , 26 , 25 , 63 , 62 , 59 , 58 , 57 }
360 return mData->rawTriggerDet[prepostAddress(prepost)].BBC[t_map[eastwest][pmt-1]-1];
363 unsigned short StTriggerData2004::bbcADCSum(StBeamDirection eastwest,
int prepost)
const
365 int address = prepostAddress(prepost);
368 mData->rawTriggerDet[address].BBClayer1[7]%2048+
369 mData->rawTriggerDet[address].BBClayer1[3]%2048;
372 mData->rawTriggerDet[address].BBClayer1[5]%2048+
373 mData->rawTriggerDet[address].BBClayer1[1]%2048;
377 unsigned short StTriggerData2004::bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost)
const
379 int address = prepostAddress(prepost);
380 if(eastwest==east) {
return mData->rawTriggerDet[address].BBClayer1[11]%2048; }
381 else {
return mData->rawTriggerDet[address].BBClayer1[10]%2048; }
384 unsigned short StTriggerData2004::bbcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
386 int address = prepostAddress(prepost), t1, t2;
388 t1 = mData->rawTriggerDet[address].BBClayer1[6]%256;
389 t2 = mData->rawTriggerDet[address].BBClayer1[2]%256;
391 t1 = mData->rawTriggerDet[address].BBClayer1[4]%256;
392 t2 = mData->rawTriggerDet[address].BBClayer1[0]%256;
394 return (t1>t2) ? t1 : t2;
397 unsigned short StTriggerData2004::bbcTimeDifference()
const
399 return mData->TrgSum.DSMdata.VTX[3]%512;
402 unsigned short StTriggerData2004::fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost)
const
404 static const short fpdmap[2][6][49] = {
408 {39, 38, 37, 36, 35, 34, 33,
409 7, 6, 5, 23, 22, 21, 55,
410 4, 3, 2, 20, 19, 18, 54,
411 1, 0, 15, 17, 16, 31, 53,
412 14, 13, 12, 30, 29, 28, 52,
413 11, 10, 9, 27, 26, 25, 51,
414 32, 47, 46, 45, 44, 43, 42},
416 { 103,101,100, 99, 98, 97, 96,
417 71, 70, 69, 87, 86, 85, 48,
418 68, 67, 66, 84, 83, 82, 63,
419 65, 64, 79, 81, 80, 95, 61,
420 78, 77 ,76, 94, 93, 92, 60,
421 75, 74, 73, 91, 90, 89, 59,
422 111,110,109,108, 107, 106,105},
424 {135, 134, 133, 132, 131, 130, 129, 128, 143, 142,
425 119, 118, 117, 116, 115, 114, 113, 112,
426 127, 126, 125, 124, 123, 122, 121,
428 -1, -1, -1, -1, -1, -1, -1,
429 -1, -1, -1, -1, -1, -1, -1,
430 -1, -1, -1, -1, -1, -1, -1},
432 {151, 150, 149, 148, 147, 146, 145, 144,
433 159, 158, 157, 156, 155, 154, 153,
434 167, 166, 165, 164, 163, 162, 161, 160, 175, 174,
436 -1, -1, -1, -1, -1, -1, -1,
437 -1, -1, -1, -1, -1, -1, -1,
438 -1, -1, -1, -1, -1, -1, -1},
440 { 50, 49, 141, 140, 139, 138, 137,
441 -1, -1, -1, -1, -1, -1, -1,
442 -1, -1, -1, -1, -1, -1, -1,
443 -1, -1, -1, -1, -1, -1, -1,
444 -1, -1, -1, -1, -1, -1, -1,
445 -1, -1, -1, -1, -1, -1, -1,
446 -1, -1, -1, -1, -1, -1, -1},
448 { 58, 57, 173, 172, 171, 170, 169,
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},
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,
464 -1, -1, -1, -1, -1, -1, -1,
465 -1, -1, -1, -1, -1, -1, -1},
467 { 71, 70, 87, 86, 96, 97, 48,
468 69, 68, 85, 84, 98, 99, 63,
469 67, 66, 83, 82, 100, 101, 62,
470 65, 64, 81, 80, 102, 103, 61,
471 79, 78, 90, 91, 106, 107, 60,
472 77, 76, 92, 93, 108, 109, 59,
473 75, 74, 94, 95, 110, 111, 58},
475 { -1, -1, -1, -1, -1, -1, -1,
476 -1, -1, -1, -1, -1, -1, -1,
477 -1, -1, -1, -1, -1, -1, -1,
478 -1, -1, -1, -1, -1, -1, -1,
479 -1, -1, -1, -1, -1, -1, -1,
480 -1, -1, -1, -1, -1, -1, -1,
481 -1, -1, -1, -1, -1, -1, -1},
483 { 77, 70, 69, 68, 67,
489 -1, -1, -1, -1, -1, -1, -1,
490 -1, -1, -1, -1, -1, -1, -1,
491 -1, -1, -1, -1, -1, -1, -1},
493 { -1, -1, -1, -1, -1, -1, -1,
494 -1, -1, -1, -1, -1, -1, -1,
495 -1, -1, -1, -1, -1, -1, -1,
496 -1, -1, -1, -1, -1, -1, -1,
497 -1, -1, -1, -1, -1, -1, -1,
498 -1, -1, -1, -1, -1, -1, -1,
499 -1, -1, -1, -1, -1, -1, -1},
501 { 7, 6, 5, 4, 3, 2, 1,
502 -1, -1, -1, -1, -1, -1, -1,
503 -1, -1, -1, -1, -1, -1, -1,
504 -1, -1, -1, -1, -1, -1, -1,
505 -1, -1, -1, -1, -1, -1, -1,
506 -1, -1, -1, -1, -1, -1, -1,
507 -1, -1, -1, -1, -1, -1, -1},
510 int address = fpdmap[eastwest][module][pmt-1];
513 if(address<112)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer0[address];
514 else return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastTBLayer0[address-112];
516 if(address<112)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestNSLayer0[address];
517 else return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestTBLayer0[address-112];
524 unsigned short StTriggerData2004::fpdSum(StBeamDirection eastwest,
int module)
const
526 static const short map[2][4]={{3,2,1,0},{7,6,5,4}};
527 static const short nbit[2][4]={{16384,16384,8192,8192},{16384,16384,8192,8192}};
528 return mData->TrgSum.DSMdata.FPD[map[eastwest][module]] % nbit[eastwest][module];
531 unsigned short StTriggerData2004::fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost)
const{
533 if(channel<8)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer1[channel];
534 if(channel<16)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastTBLayer1[channel-8];
536 if(channel<8)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestNSLayer1[channel];
537 if(channel<16)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestTBLayer1[channel-8];
542 unsigned short StTriggerData2004::fpdLayer1DSM(StBeamDirection eastwest,
int module,
int board,
int prepost)
const{
543 static const short map[4][4]={{3,2,1,0},{7,6,5,4},{3,2,6,7},{1,0,4,5}};
546 if(module<2)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer1[map[module][board]];
547 else return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastTBLayer1[map[module][board]];
549 if(module<2)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestNSLayer1[map[module][board]];
550 else return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestTBLayer1[map[module][board]];
556 unsigned short StTriggerData2004::fpdLayer2DSMRaw(
int channel)
const{
557 if(channel<8)
return mData->TrgSum.DSMdata.FPD[channel];
561 unsigned short StTriggerData2004::fpdLayer2DSM(StBeamDirection eastwest,
int module)
const{
562 static const int dsmmap[2][4]={{3,2,1,0},{7,6,5,4}};
563 if(module<4)
return mData->TrgSum.DSMdata.FPD[dsmmap[eastwest][module]];
567 unsigned short StTriggerData2004::zdcAtChannel(
int channel,
int prepost)
const
569 static const int dsmmap[16]={7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
570 if(channel>=0 && channel<16){
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[dsmmap[channel]]; }
574 unsigned short StTriggerData2004::zdcAtAddress(
int address,
int prepost)
const
576 if(address>=0 && address<16){
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[address]; }
580 unsigned short StTriggerData2004::zdcUnAttenuated(StBeamDirection eastwest,
int prepost)
const
582 if(eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[4];}
583 if(eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[0];}
587 unsigned short StTriggerData2004::zdcAttenuated(StBeamDirection eastwest,
int prepost)
const
589 if(eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[13];}
590 if(eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[10];}
594 unsigned short StTriggerData2004::zdcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
596 if(eastwest==east && pmt==1) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[7];}
597 if(eastwest==east && pmt==2) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[6];}
598 if(eastwest==east && pmt==3) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[5];}
599 if(eastwest==west && pmt==1) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[3];}
600 if(eastwest==west && pmt==2) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[2];}
601 if(eastwest==west && pmt==3) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[1];}
606 unsigned short StTriggerData2004::zdcTDC(StBeamDirection eastwest,
int prepost)
const
608 if(eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[8];}
609 if(eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[9];}
613 unsigned short StTriggerData2004::zdcHardwareSum(
int prepost)
const
615 return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[14];
618 unsigned short StTriggerData2004::zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost)
const
620 static const int zdcsmd_map[2][2][8] ={
627 { { 7, 6, 5, 4, 3, 2, 1, 11} ,
628 { 0,15,14,13,12,8,10, 9} } ,
629 { {23,22,21,20,19,18,17,24} ,
630 {16,31,30,29,28,27,26,25} }
633 if(verthori<0 || verthori>1)
return 0;
634 if(strip<1 || strip>8)
return 0;
635 return mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[zdcsmd_map[eastwest][verthori][strip-1]];
638 unsigned short StTriggerData2004::bemcLayer1DSM(
int channel,
int prepost)
const {
639 const int n_bemc_layer1=48;
640 if (channel<0 || channel >=n_bemc_layer1) {
641 gMessMgr->Warning() <<
"Barrel DSM layer 1 out of range (" << channel <<
")" << endm;
644 return mData->rawTriggerDet[prepostAddress(prepost)].BEMClayer1[channel];
647 unsigned short StTriggerData2004::eemcLayer1DSM(
int channel,
int prepost)
const {
648 const int n_eemc_layer1=48;
649 if (channel<0 || channel >=n_eemc_layer1) {
650 gMessMgr->Warning() <<
"Endap DSM layer 1 out of range (" << channel <<
")" << endm;
653 return mData->rawTriggerDet[prepostAddress(prepost)].EEMClayer1[channel];
656 unsigned short StTriggerData2004::emcLayer2DSM(
int channel)
const {
657 const int n_emc_layer2=8;
658 if (channel<0 || channel >=n_emc_layer2) {
659 gMessMgr->Warning() <<
"EMC DSM layer 2 out of range (" << channel <<
")" << endm;
662 return mData->TrgSum.DSMdata.EMC[channel];
665 unsigned char StTriggerData2004::bemcHighTower(
int patch_id,
int prepost)
const
668 const int m_max_patch=300;
670 if ( patch_id < 0 || patch_id >= m_max_patch) {
671 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
676 int channel=patch_id%10;
677 unsigned short trg_word;
679 trg_word=decodeEmc12bit(dsm-15,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCEast);
681 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCWest);
682 return trg_word & 0x3F;
685 unsigned char StTriggerData2004::bemcJetPatch (
int patch_id,
int prepost)
const
688 const int m_max_patch=300;
690 if ( patch_id < 0 || patch_id >= m_max_patch) {
691 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
696 int channel=patch_id%10;
697 unsigned short trg_word;
699 trg_word=decodeEmc12bit(dsm-15,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCEast);
701 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCWest);
702 return trg_word >> 6;
705 unsigned char StTriggerData2004::eemcHighTower(
int patch_id,
int prepost)
const
708 const int m_max_patch=90;
710 if ( patch_id < 0 || patch_id >= m_max_patch) {
711 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
716 int channel=patch_id%10;
717 unsigned short trg_word;
718 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].EEMC);
719 return trg_word & 0x3F;
722 unsigned char StTriggerData2004::eemcJetPatch (
int patch_id,
int prepost)
const
725 const int m_max_patch=90;
727 if ( patch_id < 0 || patch_id >= m_max_patch) {
728 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
733 int channel=patch_id%10;
734 unsigned short trg_word;
735 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].EEMC);
736 return trg_word >> 6;
739 unsigned char StTriggerData2004::bemcHighestTowerADC(
int prepost)
const
742 const int m_max_patch=300;
744 for(
int i=1; i<m_max_patch; i++){
745 unsigned char hh=bemcHighTower(i,prepost);
751 unsigned char StTriggerData2004::eemcHighestTowerADC(
int prepost)
const
754 const int m_max_patch=90;
756 for(
int i=1; i<m_max_patch; i++){
757 unsigned char hh=eemcHighTower(i,prepost);
763 void StTriggerData2004::dump()
const
765 printf(
"***** StTriggerData Dump *****\n");
766 printf(
" Year=%d Version=%x\n",year(),version());
767 printf(
" %d pre and %d post crossing data available\n",numberOfPreXing(),numberOfPostXing());
768 printf(
" Token=%d TriggerWord=%x ActionWord=%x BusyStatus=%x\n",
769 token(), triggerWord(), actionWord(), busyStatus());
770 printf(
" TUC Bits=%d : ",tcuBits());
771 for(
int i=0; i<16; i++) {printf(
" %d",(tcuBits()>>(15-i))%2);}; printf(
"\n");
772 printf(
" BunchId 7bit=%d 48bit=%d\n",bunchId7Bit(), bunchId48Bit());
773 printf(
" Spin Bits=%d : ",spinBit());
774 for(
int i=0; i<8; i++) {printf(
" %d",(spinBit()>>(7-i))%2);}; printf(
"\n");
775 printf(
" CTB ADC : ");
for(
int i=0; i<240;i++){ printf(
"%d ",ctb(i,0)); }; printf(
"\n");
776 printf(
" MWC ADC : ");
for(
int i=0; i<96; i++){ printf(
"%d ",mwc(i,0)); }; printf(
"\n");
777 printf(
" BBC East ADC : ");
for(
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(east,i,0)); }; printf(
"\n");
778 printf(
" BBC West ADC : ");
for(
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(west,i,0)); }; printf(
"\n");
779 printf(
" BBC East TAC : ");
for(
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(east,i,0)); }; printf(
"\n");
780 printf(
" BBC West TAC : ");
for(
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(west,i,0)); }; printf(
"\n");
781 for(
int i=-numberOfPreXing(); i<=static_cast<int>(numberOfPostXing()); i++){
782 printf(
" BBC Sums %d xing : ",i);
783 printf(
"East=%d West=%d Large tile East=%d West=%d\n",
784 bbcADCSum(east,i),bbcADCSum(west,i),
785 bbcADCSumLargeTile(east,i),bbcADCSumLargeTile(west,i));
787 printf(
" BBC Earilest : "); printf(
"East=%d West=%d Difference+256=%d\n",
788 bbcEarliestTDC(east,0),bbcEarliestTDC(west,0),bbcTimeDifference());
789 printf(
" FPD East North : ");
for(
int i=1; i<=49;i++){ printf(
"%d ",fpd(east,0,i,0)); }; printf(
"\n");
790 printf(
" FPD East South : ");
for(
int i=1; i<=49;i++){ printf(
"%d ",fpd(east,1,i,0)); }; printf(
"\n");
791 printf(
" FPD East Top : ");
for(
int i=1; i<=25;i++){ printf(
"%d ",fpd(east,2,i,0)); }; printf(
"\n");
792 printf(
" FPD East Bottom : ");
for(
int i=1; i<=25;i++){ printf(
"%d ",fpd(east,3,i,0)); }; printf(
"\n");
793 printf(
" FPD East North PS: ");
for(
int i=1; i<= 7;i++){ printf(
"%d ",fpd(east,4,i,0)); }; printf(
"\n");
794 printf(
" FPD East South PS: ");
for(
int i=1; i<= 7;i++){ printf(
"%d ",fpd(east,5,i,0)); }; printf(
"\n");
795 printf(
" FPD West South : ");
for(
int i=1; i<=49;i++){ printf(
"%d ",fpd(west,1,i,0)); }; printf(
"\n");
796 printf(
" FPD West Bottom : ");
for(
int i=1; i<=25;i++){ printf(
"%d ",fpd(west,3,i,0)); }; printf(
"\n");
797 printf(
" FPD West South PS: ");
for(
int i=1; i<= 7;i++){ printf(
"%d ",fpd(west,5,i,0)); }; printf(
"\n");
798 printf(
" FPD Sums East : ");
for(
int j=0; j<4 ;j++) printf(
"%d ",fpdSum(east,j)); printf(
"\n");
799 printf(
" FPD Sums West : ");
for(
int j=0; j<4 ;j++) printf(
"%d ",fpdSum(west,j)); printf(
"\n");
800 printf(
" ZDC Sum(A) East : ");printf(
"%d ",zdcAttenuated(east)); printf(
"\n");
801 printf(
" ZDC Sum(A) West : ");printf(
"%d ",zdcAttenuated(west)); printf(
"\n");
802 printf(
" ZDC Sum(UA) East : ");printf(
"%d ",zdcUnAttenuated(east)); printf(
"\n");
803 printf(
" ZDC Sum(UA) West : ");printf(
"%d ",zdcUnAttenuated(west)); printf(
"\n");
805 printf(
"***** StTriggerData Dump *****\n");
808 char* StTriggerData2004::getTriggerStructure()
810 return (
char*) mData;
818 int StTriggerData2004::getRawSize()
const
820 int npre = numberOfPreXing();
821 int npost = numberOfPostXing();
827 unsigned char * StTriggerData2004::getDsm0_EEMC(
int prepost)
const
829 return mData->rawTriggerDet[prepostAddress(prepost)].EEMC;
832 unsigned short int * StTriggerData2004::getDsm1_EEMC(
int prepost)
const
834 return mData->rawTriggerDet[prepostAddress(prepost)].EEMClayer1;
837 unsigned short int * StTriggerData2004::getDsm2_EMC()
const
839 return mData->TrgSum.DSMdata.EMC;
842 unsigned short int * StTriggerData2004::getDsm3()
const
844 return mData->TrgSum.DSMdata.lastDSM;
847 unsigned int StTriggerData2004::l2ResultLength()
const
849 return sizeof(mData->TrgSum.L2Result)/
sizeof(
unsigned int);
852 const unsigned int* StTriggerData2004::l2Result()
const
854 return mData->TrgSum.L2Result;