48 #include "StTriggerData2005.h"
49 #include "StDaqLib/TRG/trgStructures2005.h"
50 #include "StDaqLib/TRG/L2jetResults2006.h"
51 #include "StDaqLib/TRG/L2pedResults2006.h"
52 #include "StDaqLib/TRG/L2gammaResult2006.h"
67 int npre = data->EvtDesc.npre;
68 int npost = data->EvtDesc.npost;
76 memcpy(mData,data,size);
80 unsigned int StTriggerData2005::version()
const
82 return mData->EvtDesc.TrgDataFmtVer;
85 StTriggerData2005::~StTriggerData2005() {
delete mData;}
87 unsigned int StTriggerData2005::token()
const
89 return mData->EvtDesc.TrgToken;
92 unsigned int StTriggerData2005::triggerWord()
const
94 return mData->EvtDesc.TriggerWord;
97 unsigned int StTriggerData2005::actionWord()
const
100 ( (
unsigned short)(mData->EvtDesc.actionWdTrgCommand) * 16 * 16 * 16 ) +
101 ( (
unsigned short)(mData->EvtDesc.actionWdDaqCommand) * 16 * 16 ) +
102 ( mData->EvtDesc.actionWdDetectorBitMask & 0x00ff ) ;
105 unsigned int StTriggerData2005::numberOfPreXing()
const
107 return mData->EvtDesc.npre;
110 unsigned int StTriggerData2005::numberOfPostXing()
const
112 return mData->EvtDesc.npost;
115 unsigned short StTriggerData2005::busyStatus()
const{
116 return mData->EvtDesc.modifiedBusyStatus;
119 unsigned short StTriggerData2005::dsmInput()
const{
120 return mData->EvtDesc.DSMInput;
123 unsigned short StTriggerData2005::trgToken()
const{
124 return mData->EvtDesc.TrgToken;
127 unsigned short StTriggerData2005::dsmAddress()
const{
128 return mData->EvtDesc.DSMAddress;
131 unsigned short StTriggerData2005::mAddBits()
const{
132 return mData->EvtDesc.addBits;
135 unsigned short StTriggerData2005::bcData(
int channel)
const{
136 return mData->TrgSum.DSMdata.BCdata[channel];
139 unsigned short StTriggerData2005::lastDSM(
int channel)
const{
140 return mData->TrgSum.DSMdata.lastDSM[channel];
143 unsigned short StTriggerData2005::tcuBits()
const
145 return mData->EvtDesc.DSMInput;
148 unsigned int StTriggerData2005::bunchCounterHigh()
const
150 return mData->EvtDesc.bunchXing_hi;
153 unsigned int StTriggerData2005::bunchCounterLow()
const
155 return mData->EvtDesc.bunchXing_lo;
158 unsigned int StTriggerData2005::bunchId48Bit()
const
160 unsigned long long bxinghi,bxing1,bxinglo, bx;
161 bxinghi = mData->TrgSum.DSMdata.BCdata[3];
162 bxing1 = mData->TrgSum.DSMdata.BCdata[10];
163 bxinglo = (bxing1 << 16) + mData->TrgSum.DSMdata.BCdata[11];
164 bx = (bxinghi << 32) + bxinglo;
165 return (
int)(bx % 120);
168 unsigned int StTriggerData2005::bunchId7Bit()
const
171 b7dat = mData->TrgSum.DSMdata.BCdata[2];
176 unsigned int StTriggerData2005::spinBit()
const
178 return (mData->TrgSum.DSMdata.lastDSM[7]/16)%256;
181 unsigned int StTriggerData2005::spinBitYellowFilled()
const
183 unsigned int sb = spinBit();
187 unsigned int StTriggerData2005::spinBitYellowUp()
const
189 unsigned int sb = spinBit();
193 unsigned int StTriggerData2005::spinBitYellowDown()
const
195 unsigned int sb = spinBit();
199 unsigned int StTriggerData2005::spinBitYellowUnpol()
const
201 unsigned int sb = spinBit();
205 unsigned int StTriggerData2005::spinBitBlueFilled()
const
207 unsigned int sb = spinBit();
211 unsigned int StTriggerData2005::spinBitBlueUp()
const
213 unsigned int sb = spinBit();
217 unsigned int StTriggerData2005::spinBitBlueDown()
const
219 unsigned int sb = spinBit();
223 unsigned int StTriggerData2005::spinBitBlueUnpol()
const
225 unsigned int sb = spinBit();
229 unsigned short StTriggerData2005::ctbRaw(
int address,
int prepost)
const
231 return mData->rawTriggerDet[prepostAddress(prepost)].CTB[address];
234 unsigned short StTriggerData2005::ctb(
int pmt,
int prepost)
const
236 static const unsigned char ctbMap[240] = {
237 7, 6, 5, 4, 3, 23, 22, 21, 20, 19,
238 2, 1, 0, 15, 14, 18, 17, 16, 31, 30,
239 13, 12, 11, 10, 9, 29, 28, 27, 26, 25,
240 39, 38, 37, 36, 35, 55, 54, 53, 52, 51,
241 34, 33, 32, 47, 46, 50, 49, 48, 63, 62,
242 45, 44, 43, 42, 41, 61, 60, 59, 58, 57,
243 71, 70, 69, 68, 67, 87, 86, 85, 84, 83,
244 66, 65, 64, 79, 78, 82, 81, 80, 95, 94,
245 77, 76, 75, 74, 73, 93, 92, 91, 90, 89,
246 103, 102, 101, 100, 99, 119, 118, 117, 116, 115,
247 98, 97, 96, 111, 110, 114, 113, 112, 127, 126,
248 109, 108, 107, 106, 105, 125, 124, 123, 122, 121,
249 135, 134, 133, 132, 131, 151, 150, 149, 148, 147,
250 130, 129, 128, 143, 142, 146, 145, 144, 159, 158,
251 141, 140, 139, 138, 137, 157, 156, 155, 154, 153,
252 167, 166, 165, 164, 163, 183, 182, 181, 180, 179,
253 162, 161, 160, 175, 174, 178, 177, 176, 191, 190,
254 173, 172, 171, 170, 169, 189, 188, 187, 186, 185,
255 199, 198, 197, 196, 195, 215, 214, 213, 212, 211,
256 194, 193, 192, 207, 206, 210, 209, 208, 223, 222,
257 205, 204, 203, 202, 201, 221, 220, 219, 218, 217,
258 231, 230, 229, 228, 227, 247, 246, 245, 244, 243,
259 226, 225, 224, 239, 238, 242, 241, 240, 255, 254,
260 237, 236, 235, 234, 233, 253, 252, 251, 250, 249,
263 int add=prepostAddress(prepost);
264 if(add>=0) v=mData->rawTriggerDet[add].CTB[ctbMap[pmt]];
265 if(mRun>7000000 && mRun<7151026){
266 if (add== 76){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[7];}
267 else if(add== 75){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[6];}
268 else if(add== 74){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[5];}
269 else if(add==166){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[4];}
270 else if(add==165){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[3];}
271 else if(add==164){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[2];}
273 else if(mRun>=7151026){
274 if (add== 4){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[7];}
275 else if(add== 3){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[6];}
276 else if(add== 2){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[5];}
277 else if(add==238){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[4];}
278 else if(add==237){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[3];}
279 else if(add==236){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[2];}
284 unsigned short StTriggerData2005::ctbTraySlat(
int tray,
int slat,
int prepost)
const{
285 static const unsigned char ctbMap[2][120] = {
286 { 109, 108, 107, 106, 105, 7, 6, 5, 4, 3,
287 2, 1, 0, 15, 14, 13, 12, 11, 10, 9,
288 39, 38, 37, 36, 35, 34, 33, 32, 47, 46,
289 45, 44, 43, 42, 41, 71, 70, 69, 68, 67,
290 66, 65, 64, 79, 78, 77, 76, 75, 74, 73,
291 103, 102, 101, 100, 99, 98, 97, 96, 111, 110,
292 141, 140, 139, 138, 137, 167, 166, 165, 164, 163,
293 162, 161, 160, 175, 174, 173, 172, 171, 170, 169,
294 199, 198, 197, 196, 195, 194, 193, 192, 207, 206,
295 205, 204, 203, 202, 201, 231, 230, 229, 228, 227,
296 226, 225, 224, 239, 238, 237, 236, 235, 234, 233,
297 135, 134, 133, 132, 131, 130, 129, 128, 143, 142},
298 { 125, 124, 123, 122, 121, 23, 22, 21, 20, 19,
299 18, 17, 16, 31, 30, 29, 28, 27, 26, 25,
300 55, 54, 53, 52, 51, 50, 49, 48, 63, 62,
301 61, 60, 59, 58, 57, 87, 86, 85, 84, 83,
302 82, 81, 80, 95, 94, 93, 92, 91, 90, 89,
303 119, 118, 117, 116, 115, 114, 113, 112, 127, 126,
304 157, 156, 155, 154, 153, 183, 182, 181, 180, 179,
305 178, 177, 176, 191, 190, 189, 188, 187, 186, 185,
306 215, 214, 213, 212, 211, 210, 209, 208, 223, 222,
307 221, 220, 219, 218, 217, 247, 246, 245, 244, 243,
308 242, 241, 240, 255, 254, 253, 252, 251, 250, 249,
309 151, 150, 149, 148, 147, 146, 145, 144, 159, 158}
312 int add=prepostAddress(prepost);
313 if(add>=0) v=mData->rawTriggerDet[add].CTB[ctbMap[slat][tray]];
314 if(mRun>7000000 && mRun<7151026){
315 if (tray== 46 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[7];}
316 else if(tray== 47 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[6];}
317 else if(tray== 48 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[5];}
318 else if(tray== 66 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[4];}
319 else if(tray== 67 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[3];}
320 else if(tray== 68 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[2];}
322 else if(mRun>=7151026){
323 if (tray== 8 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[7];}
324 else if(tray== 9 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[6];}
325 else if(tray== 10 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[5];}
326 else if(tray==104 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[4];}
327 else if(tray==105 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[3];}
328 else if(tray==106 && slat==0){v=mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[2];}
333 unsigned short StTriggerData2005::ctbSum(
int prepost)
const{
334 unsigned short sum=0;
335 for (
int i=1; i<240; i++){sum+=ctb(i,prepost);}
339 unsigned short StTriggerData2005::mwc(
int pmt,
int prepost)
const
341 static const unsigned char mwcMap[96] = {
342 71, 70, 69, 68, 67, 66, 65, 64, 79, 78, 77, 76,
343 95, 94, 93, 92, 87, 86, 85, 84, 83, 82, 81, 80,
344 99, 98, 97, 96, 111, 110, 109, 108, 103, 102, 101, 100,
345 119, 118, 117, 116, 115, 114, 113, 112, 127, 126, 125, 124,
346 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12,
347 31, 30, 29, 28, 23, 22, 21, 20, 19, 18, 17, 16,
348 35, 34, 33, 32, 47, 46, 45, 44, 39, 38, 37, 36,
349 55, 54, 53, 52, 51, 50, 49, 48, 63, 62, 61, 60,
351 return mData->rawTriggerDet[prepostAddress(prepost)].MWC[mwcMap[pmt]];
354 unsigned short StTriggerData2005::bbcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
356 static const int q_map[2][24] = {
357 { 8 , 5 , 4 , 40 , 37 , 36 , 7 , 6 ,
358 3 , 2 , 1 , 39 , 38 , 35 , 34 , 33 ,
359 72 , 71 , 70 , 69 , 68 , 67 , 66 , 65 },
360 { 24 , 21 , 20 , 56 , 53 , 52 , 23 , 22 ,
361 19 , 18 , 17 , 55 , 54 , 51 , 50 , 49 ,
362 88 , 87 , 86 , 85 , 84 , 83 , 82 , 81 }
364 return mData->rawTriggerDet[prepostAddress(prepost)].BBC[q_map[eastwest][pmt-1]-1];
367 unsigned short StTriggerData2005::bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
369 static const int t_map[2][24] ={
370 { 16 , 13 , 12 , 48 , 45 , 44 , 15 , 14 ,
371 11 , 10 , 9 , 47 , 46 , 43 , 42 , 41 ,
372 80 , 79 , 78 , 77 , 76 , 75 , 74 , 73 },
373 { 32 , 29 , 28 , 64 , 61 , 60 , 31 , 30 ,
374 27 , 26 , 25 , 63 , 62 , 59 , 58 , 57 ,
375 96 , 95 , 94 , 93 , 92 , 91 , 90 , 89 }
377 return mData->rawTriggerDet[prepostAddress(prepost)].BBC[t_map[eastwest][pmt-1]-1];
380 unsigned short StTriggerData2005::bbcADCSum(StBeamDirection eastwest,
int prepost)
const
382 int address = prepostAddress(prepost);
385 mData->rawTriggerDet[address].BBClayer1[7]%2048+
386 mData->rawTriggerDet[address].BBClayer1[3]%2048;
390 mData->rawTriggerDet[address].BBClayer1[5]%2048+
391 mData->rawTriggerDet[address].BBClayer1[1]%2048;
395 unsigned short StTriggerData2005::bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost)
const
397 int address = prepostAddress(prepost);
398 if (eastwest==east) {
return mData->rawTriggerDet[address].BBClayer1[11]%2048; }
399 else {
return mData->rawTriggerDet[address].BBClayer1[10]%2048; }
402 unsigned short StTriggerData2005::bbcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
404 int address = prepostAddress(prepost), t1, t2;
406 t1 = mData->rawTriggerDet[address].BBClayer1[6]%256;
407 t2 = mData->rawTriggerDet[address].BBClayer1[2]%256;
410 t1 = mData->rawTriggerDet[address].BBClayer1[4]%256;
411 t2 = mData->rawTriggerDet[address].BBClayer1[0]%256;
413 return (t1>t2) ? t1 : t2;
416 unsigned short StTriggerData2005::bbcTimeDifference()
const
418 return mData->TrgSum.DSMdata.VTX[3]%512;
421 unsigned short StTriggerData2005::fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost)
const
423 static const short fpdmap[2][6][49] = {
427 {39, 38, 37, 36, 35, 34, 33,
428 7, 6, 5, 23, 22, 21, 55,
429 4, 3, 2, 20, 19, 18, 54,
430 1, 0, 15, 17, 16, 31, 53,
431 14, 13, 12, 30, 29, 28, 52,
432 11, 10, 9, 27, 26, 25, 51,
433 32, 47, 46, 45, 44, 43, 42},
435 { 103,101,100, 99, 98, 97, 96,
436 71, 70, 69, 87, 86, 85, 48,
437 68, 67, 66, 84, 83, 82, 63,
438 65, 64, 79, 81, 80, 95, 61,
439 78, 77 ,76, 94, 93, 92, 60,
440 75, 74, 73, 91, 90, 89, 59,
441 111,110,109,108, 107, 106,105},
443 {135, 134, 133, 132, 131, 130, 129, 128, 143, 142,
444 119, 118, 117, 116, 115, 114, 113, 112,
445 127, 126, 125, 124, 123, 122, 121,
447 -1, -1, -1, -1, -1, -1, -1,
448 -1, -1, -1, -1, -1, -1, -1,
449 -1, -1, -1, -1, -1, -1, -1},
451 {151, 150, 149, 148, 147, 146, 145, 144,
452 159, 158, 157, 156, 155, 154, 153,
453 167, 166, 165, 164, 163, 162, 161, 160, 175, 174,
455 -1, -1, -1, -1, -1, -1, -1,
456 -1, -1, -1, -1, -1, -1, -1,
457 -1, -1, -1, -1, -1, -1, -1},
459 { 50, 49, 141, 140, 139, 138, 137,
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 { 58, 57, 173, 172, 171, 170, 169,
468 -1, -1, -1, -1, -1, -1, -1,
469 -1, -1, -1, -1, -1, -1, -1,
470 -1, -1, -1, -1, -1, -1, -1,
471 -1, -1, -1, -1, -1, -1, -1,
472 -1, -1, -1, -1, -1, -1, -1,
473 -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,
482 -1, -1, -1, -1, -1, -1, -1,
483 -1, -1, -1, -1, -1, -1, -1,
484 -1, -1, -1, -1, -1, -1, -1},
486 { 71, 70, 87, 86, 96, 97, 48,
487 69, 68, 85, 84, 98, 99, 63,
488 67, 66, 83, 82, 100, 101, 62,
489 65, 64, 81, 80, 102, 103, 61,
490 79, 78, 90, 91, 106, 107, 60,
491 77, 76, 92, 93, 108, 109, 59,
492 75, 74, 94, 95, 110, 111, 58},
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,
500 -1, -1, -1, -1, -1, -1, -1},
502 { 77, 70, 69, 68, 67,
508 -1, -1, -1, -1, -1, -1, -1,
509 -1, -1, -1, -1, -1, -1, -1,
510 -1, -1, -1, -1, -1, -1, -1},
512 { -1, -1, -1, -1, -1, -1, -1,
513 -1, -1, -1, -1, -1, -1, -1,
514 -1, -1, -1, -1, -1, -1, -1,
515 -1, -1, -1, -1, -1, -1, -1,
516 -1, -1, -1, -1, -1, -1, -1,
517 -1, -1, -1, -1, -1, -1, -1,
518 -1, -1, -1, -1, -1, -1, -1},
520 { 7, 6, 5, 4, 3, 2, 1,
521 -1, -1, -1, -1, -1, -1, -1,
522 -1, -1, -1, -1, -1, -1, -1,
523 -1, -1, -1, -1, -1, -1, -1,
524 -1, -1, -1, -1, -1, -1, -1,
525 -1, -1, -1, -1, -1, -1, -1,
526 -1, -1, -1, -1, -1, -1, -1},
529 int address = fpdmap[eastwest][module][pmt-1];
532 if (address<112)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer0[address];
533 else return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastTBLayer0[address-112];
535 if (address<112)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestNSLayer0[address];
536 else return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestTBLayer0[address-112];
543 unsigned short StTriggerData2005::fpdSum(StBeamDirection eastwest,
int module)
const
545 static const short map[2][4]={{3,2,1,0},{7,6,5,4}};
546 static const short nbit[2][4]={{16384,16384,8192,8192},{16384,16384,8192,8192}};
547 return mData->TrgSum.DSMdata.FPD[map[eastwest][module]] % nbit[eastwest][module];
550 unsigned short StTriggerData2005::fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost)
const{
552 if (channel<8)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer1[channel];
553 if (channel<16)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastTBLayer1[channel-8];
556 if (channel<8)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestNSLayer1[channel];
557 if (channel<16)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestTBLayer1[channel-8];
562 unsigned short StTriggerData2005::fpdLayer1DSM(StBeamDirection eastwest,
int module,
int board,
int prepost)
const{
563 static const short map[4][4]={{3,2,1,0},{7,6,5,4},{3,2,6,7},{1,0,4,5}};
566 if (module<2)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer1[map[module][board]];
567 else return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastTBLayer1[map[module][board]];
570 if (module<2)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestNSLayer1[map[module][board]];
571 else return mData->rawTriggerDet[prepostAddress(prepost)].FPDWestTBLayer1[map[module][board]];
577 unsigned short StTriggerData2005::fpdLayer2DSMRaw(
int channel)
const{
578 if (channel<8)
return mData->TrgSum.DSMdata.FPD[channel];
582 unsigned short StTriggerData2005::fpdLayer2DSM(StBeamDirection eastwest,
int module)
const{
583 static const int dsmmap[2][4]={{3,2,1,0},{7,6,5,4}};
584 if (module<4)
return mData->TrgSum.DSMdata.FPD[dsmmap[eastwest][module]];
588 unsigned short StTriggerData2005::zdcAtChannel(
int channel,
int prepost)
const
590 static const int dsmmap[16]={7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
591 if (channel>=0 && channel<16){
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[dsmmap[channel]]; }
595 unsigned short StTriggerData2005::zdcAtAddress(
int address,
int prepost)
const
597 if (address>=0 && address<16){
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[address]; }
601 unsigned short StTriggerData2005::zdcUnAttenuated(StBeamDirection eastwest,
int prepost)
const
603 if (eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[4];}
604 if (eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[0];}
608 unsigned short StTriggerData2005::zdcAttenuated(StBeamDirection eastwest,
int prepost)
const
610 if (eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[13];}
611 if (eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[10];}
615 unsigned short StTriggerData2005::zdcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
617 if (eastwest==east && pmt==1) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[7];}
618 if (eastwest==east && pmt==2) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[6];}
619 if (eastwest==east && pmt==3) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[5];}
620 if (eastwest==west && pmt==1) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[3];}
621 if (eastwest==west && pmt==2) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[2];}
622 if (eastwest==west && pmt==3) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[1];}
627 unsigned short StTriggerData2005::zdcTDC(StBeamDirection eastwest,
int prepost)
const
629 if (eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[8];}
630 if (eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[9];}
634 unsigned short StTriggerData2005::zdcHardwareSum(
int prepost)
const
636 return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[14];
639 unsigned short StTriggerData2005::zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost)
const
641 static const int zdcsmd_map[2][2][8] ={
648 { { 7, 6, 5, 4, 3, 2, 1, 11} ,
649 { 0,15,14,13,12,8,10, 9} } ,
650 { {23,22,21,20,19,18,17,24} ,
651 {16,31,30,29,28,27,26,25} }
653 static const int zdcsmd_map2006[2][2][8] ={
654 { {23,22,21,20,-1,-1,1,14} ,
655 {19,18,17,16,-1,-1,13,8} } ,
656 { {31,30,29,28,-1,-1,0,15} ,
657 {27,26,25,24,-1,-1,12,9} }
659 if (verthori<0 || verthori>1)
return 0;
660 if (strip<1 || strip>8)
return 0;
662 if(mRun<7000000) {add=zdcsmd_map[eastwest][verthori][strip-1];}
663 else {add=zdcsmd_map2006[eastwest][verthori][strip-1];}
664 if(add>=0)
return mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[add];
668 unsigned short StTriggerData2005::bemcLayer1DSM(
int channel,
int prepost)
const {
669 const int n_bemc_layer1=48;
670 if (channel<0 || channel >=n_bemc_layer1) {
671 gMessMgr->Warning() <<
"Barrel DSM layer 1 out of range (" << channel <<
")" << endm;
674 return mData->rawTriggerDet[prepostAddress(prepost)].BEMClayer1[channel];
677 unsigned short StTriggerData2005::eemcLayer1DSM(
int channel,
int prepost)
const {
678 const int n_eemc_layer1=48;
679 if (channel<0 || channel >=n_eemc_layer1) {
680 gMessMgr->Warning() <<
"Endap DSM layer 1 out of range (" << channel <<
")" << endm;
683 return mData->rawTriggerDet[prepostAddress(prepost)].EEMClayer1[channel];
686 unsigned short StTriggerData2005::emcLayer2DSM(
int channel)
const {
687 const int n_emc_layer2=8;
688 if (channel<0 || channel >=n_emc_layer2) {
689 gMessMgr->Warning() <<
"EMC DSM layer 2 out of range (" << channel <<
")" << endm;
692 return mData->TrgSum.DSMdata.EMC[channel];
695 unsigned char StTriggerData2005::bemcHighTower(
int patch_id,
int prepost)
const
698 const int m_max_patch=300;
700 if ( patch_id < 0 || patch_id >= m_max_patch) {
701 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
706 int channel=patch_id%10;
707 unsigned short trg_word;
709 trg_word=decodeEmc12bit(dsm-15,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCEast);
711 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCWest);
712 return trg_word & 0x3F;
715 unsigned char StTriggerData2005::bemcJetPatch (
int patch_id,
int prepost)
const
718 const int m_max_patch=300;
720 if ( patch_id < 0 || patch_id >= m_max_patch) {
721 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
726 int channel=patch_id%10;
727 unsigned short trg_word;
729 trg_word=decodeEmc12bit(dsm-15,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCEast);
731 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCWest);
732 return trg_word >> 6;
735 unsigned char StTriggerData2005::eemcHighTower(
int patch_id,
int prepost)
const
738 const int m_max_patch=90;
740 if ( patch_id < 0 || patch_id >= m_max_patch) {
741 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
746 int channel=patch_id%10;
747 unsigned short trg_word;
748 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].EEMC);
749 return trg_word & 0x3F;
752 unsigned char StTriggerData2005::eemcJetPatch (
int patch_id,
int prepost)
const
755 const int m_max_patch=90;
757 if ( patch_id < 0 || patch_id >= m_max_patch) {
758 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
763 int channel=patch_id%10;
764 unsigned short trg_word;
765 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].EEMC);
766 return trg_word >> 6;
769 unsigned char StTriggerData2005::bemcHighestTowerADC(
int prepost)
const
772 const int m_max_patch=300;
774 for (
int i=1; i<m_max_patch; i++){
775 unsigned char hh=bemcHighTower(i,prepost);
781 unsigned char StTriggerData2005::eemcHighestTowerADC(
int prepost)
const
784 const int m_max_patch=90;
786 for (
int i=1; i<m_max_patch; i++){
787 unsigned char hh=eemcHighTower(i,prepost);
793 void StTriggerData2005::dump()
const
795 printf(
"***** StTriggerData Dump *****\n");
796 printf(
" Year=%d Version=%x\n",year(),version());
797 printf(
" %d pre and %d post crossing data available\n",numberOfPreXing(),numberOfPostXing());
798 printf(
" Token=%d TriggerWord=%x ActionWord=%x BusyStatus=%x\n",
799 token(), triggerWord(), actionWord(), busyStatus());
800 printf(
" TUC Bits=%d : ",tcuBits());
801 for (
int i=0; i<16; i++) {printf(
" %d",(tcuBits()>>(15-i))%2);}; printf(
"\n");
802 printf(
" BunchId 7bit=%d 48bit=%d\n",bunchId7Bit(), bunchId48Bit());
803 printf(
" Spin Bits=%d : ",spinBit());
804 for (
int i=0; i<8; i++) {printf(
" %d",(spinBit()>>(7-i))%2);}; printf(
"\n");
805 printf(
" CTB ADC : ");
for (
int i=0; i<240;i++){ printf(
"%d ",ctb(i,0)); }; printf(
"\n");
806 printf(
" MWC ADC : ");
for (
int i=0; i<96; i++){ printf(
"%d ",mwc(i,0)); }; printf(
"\n");
807 printf(
" BBC East ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(east,i,0)); }; printf(
"\n");
808 printf(
" BBC West ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(west,i,0)); }; printf(
"\n");
809 printf(
" BBC East TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(east,i,0)); }; printf(
"\n");
810 printf(
" BBC West TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(west,i,0)); }; printf(
"\n");
811 for (
int i=-numberOfPreXing(); i<=static_cast<int>(numberOfPostXing()); i++){
812 printf(
" BBC Sums %d xing : ",i);
813 printf(
"East=%d West=%d Large tile East=%d West=%d\n",
814 bbcADCSum(east,i),bbcADCSum(west,i),
815 bbcADCSumLargeTile(east,i),bbcADCSumLargeTile(west,i));
817 printf(
" BBC Earilest : "); printf(
"East=%d West=%d Difference+256=%d\n",
818 bbcEarliestTDC(east,0),bbcEarliestTDC(west,0),bbcTimeDifference());
819 printf(
" FPD East North : ");
for (
int i=1; i<=49;i++){ printf(
"%d ",fpd(east,0,i,0)); }; printf(
"\n");
820 printf(
" FPD East South : ");
for (
int i=1; i<=49;i++){ printf(
"%d ",fpd(east,1,i,0)); }; printf(
"\n");
821 printf(
" FPD East Top : ");
for (
int i=1; i<=25;i++){ printf(
"%d ",fpd(east,2,i,0)); }; printf(
"\n");
822 printf(
" FPD East Bottom : ");
for (
int i=1; i<=25;i++){ printf(
"%d ",fpd(east,3,i,0)); }; printf(
"\n");
823 printf(
" FPD East North PS: ");
for (
int i=1; i<= 7;i++){ printf(
"%d ",fpd(east,4,i,0)); }; printf(
"\n");
824 printf(
" FPD East South PS: ");
for (
int i=1; i<= 7;i++){ printf(
"%d ",fpd(east,5,i,0)); }; printf(
"\n");
825 printf(
" FPD West South : ");
for (
int i=1; i<=49;i++){ printf(
"%d ",fpd(west,1,i,0)); }; printf(
"\n");
826 printf(
" FPD West Bottom : ");
for (
int i=1; i<=25;i++){ printf(
"%d ",fpd(west,3,i,0)); }; printf(
"\n");
827 printf(
" FPD West South PS: ");
for (
int i=1; i<= 7;i++){ printf(
"%d ",fpd(west,5,i,0)); }; printf(
"\n");
828 printf(
" FPD Sums East : ");
for (
int j=0; j<4 ;j++) printf(
"%d ",fpdSum(east,j)); printf(
"\n");
829 printf(
" FPD Sums West : ");
for (
int j=0; j<4 ;j++) printf(
"%d ",fpdSum(west,j)); printf(
"\n");
830 printf(
" ZDC Sum(A) East : ");printf(
"%d ",zdcAttenuated(east)); printf(
"\n");
831 printf(
" ZDC Sum(A) West : ");printf(
"%d ",zdcAttenuated(west)); printf(
"\n");
832 printf(
" ZDC Sum(UA) East : ");printf(
"%d ",zdcUnAttenuated(east)); printf(
"\n");
833 printf(
" ZDC Sum(UA) West : ");printf(
"%d ",zdcUnAttenuated(west)); printf(
"\n");
835 printf(
"***** StTriggerData Dump *****\n");
838 char* StTriggerData2005::getTriggerStructure()
840 return (
char*) mData;
848 int StTriggerData2005::getRawSize()
const
850 int npre = numberOfPreXing();
851 int npost = numberOfPostXing();
857 unsigned char * StTriggerData2005::getDsm0_EEMC(
int prepost)
const {
858 return mData->rawTriggerDet[prepostAddress(prepost)].EEMC;
861 unsigned short int * StTriggerData2005::getDsm1_EEMC(
int prepost)
const{
862 return mData->rawTriggerDet[prepostAddress(prepost)].EEMClayer1;
865 unsigned short int * StTriggerData2005::getDsm2_EMC()
const{
866 return mData->TrgSum.DSMdata.EMC;
869 unsigned short int * StTriggerData2005::getDsm3()
const{
870 return mData->TrgSum.DSMdata.lastDSM;
873 int StTriggerData2005::L2ResultsOffset(StL2AlgorithmId
id)
const
875 if(mRun<7000000)
return -1;
878 case l2Diagnostic:
return L2RESULTS_OFFSET_TRG;
879 case l2EmcCheck:
return L2RESULTS_OFFSET_EMC_CHECK;
880 case l2Jpsi:
return L2RESULTS_OFFSET_JPSI;
881 case l2Upsilon:
return L2RESULTS_OFFSET_UPS;
882 case l2Dijet:
return L2RESULTS_OFFSET_DIJET;
883 case l2EmcPedestal:
return L2RESULTS_OFFSET_EMC_PED;
884 case l2Pi0Gamma:
return L2RESULTS_OFFSET_PIG;
889 bool StTriggerData2005::isL2Triggered(StL2TriggerResultType
id)
const
891 if(mRun<7000000)
return false;
892 if(mRun>7270000)
return false;
895 offset=L2ResultsOffset(l2Dijet);
897 offset=L2ResultsOffset(l2Pi0Gamma);
902 case l2Trg2006BEMCGammaPi:
903 return (gam_bemc->trigger & 0x3)==0x3;
905 case l2Trg2006BEMCGammaPiRandom:
906 return gam_bemc->trigger & 0x4;
908 case l2Trg2006EEMCGammaPi:
909 return (gam_eemc->trigger & 0x3)==0x3;
911 case l2Trg2006EEMCGammaPiRandom:
912 return gam_eemc->trigger & 0x4;
914 case l2Trg2006MonoJet:
915 return jet->int0.decision & 0x40;
918 return jet->int0.decision & 0x80;
920 case l2Trg2006RandomJet:
921 return jet->int0.decision & 0x20;
928 unsigned int StTriggerData2005::l2ResultLength()
const
930 return sizeof(mData->TrgSum.L2Result)/
sizeof(
unsigned int);
933 const unsigned int* StTriggerData2005::l2Result()
const
935 return mData->TrgSum.L2Result;