38 #include "StTriggerData2007.h"
39 #include "StDaqLib/TRG/trgStructures2007.h"
40 #include "StDaqLib/TRG/L2pedResults2006.h"
41 #include "StDaqLib/TRG/L2gammaResult2007.h"
56 int npre = data->EvtDesc.npre;
57 int npost = data->EvtDesc.npost;
64 memcpy(mData,data,size);
69 unsigned int StTriggerData2007::version()
const
71 return mData->EvtDesc.TrgDataFmtVer;
74 StTriggerData2007::~StTriggerData2007() {
delete mData;}
76 unsigned int StTriggerData2007::token()
const
78 return mData->EvtDesc.TrgToken;
81 unsigned int StTriggerData2007::triggerWord()
const
83 return mData->EvtDesc.TriggerWord;
86 unsigned int StTriggerData2007::actionWord()
const
89 ( (
unsigned short)(mData->EvtDesc.actionWdTrgCommand) * 16 * 16 * 16 ) +
90 ( (
unsigned short)(mData->EvtDesc.actionWdDaqCommand) * 16 * 16 ) +
91 ( mData->EvtDesc.actionWdDetectorBitMask & 0x00ff ) ;
94 unsigned int StTriggerData2007::numberOfPreXing()
const
96 return mData->EvtDesc.npre;
99 unsigned int StTriggerData2007::numberOfPostXing()
const
101 return mData->EvtDesc.npost;
104 unsigned short StTriggerData2007::busyStatus()
const{
105 return mData->EvtDesc.modifiedBusyStatus;
108 unsigned short StTriggerData2007::dsmInput()
const{
109 return mData->EvtDesc.DSMInput;
112 unsigned short StTriggerData2007::trgToken()
const{
113 return mData->EvtDesc.TrgToken;
116 unsigned short StTriggerData2007::dsmAddress()
const{
117 return mData->EvtDesc.DSMAddress;
120 unsigned short StTriggerData2007::mAddBits()
const{
121 return mData->EvtDesc.addBits;
124 unsigned short StTriggerData2007::bcData(
int channel)
const{
125 return mData->TrgSum.DSMdata.BCdata[channel];
128 unsigned short StTriggerData2007::lastDSM(
int channel)
const{
129 return mData->TrgSum.DSMdata.lastDSM[channel];
132 unsigned short StTriggerData2007::tcuBits()
const
134 return mData->EvtDesc.DSMInput;
137 unsigned int StTriggerData2007::bunchCounterHigh()
const
139 return mData->EvtDesc.bunchXing_hi;
142 unsigned int StTriggerData2007::bunchCounterLow()
const
144 return mData->EvtDesc.bunchXing_lo;
147 unsigned int StTriggerData2007::bunchId48Bit()
const
149 unsigned long long bxinghi,bxing1,bxinglo, bx;
150 bxinghi = mData->TrgSum.DSMdata.BCdata[3];
151 bxing1 = mData->TrgSum.DSMdata.BCdata[10];
152 bxinglo = (bxing1 << 16) + mData->TrgSum.DSMdata.BCdata[11];
153 bx = (bxinghi << 32) + bxinglo;
154 return (
int)(bx % 120);
157 unsigned int StTriggerData2007::bunchId7Bit()
const
160 b7dat = mData->TrgSum.DSMdata.BCdata[2];
165 unsigned int StTriggerData2007::spinBit()
const
167 return (mData->TrgSum.DSMdata.lastDSM[7]/16)%256;
170 unsigned int StTriggerData2007::spinBitYellowFilled()
const
172 unsigned int sb = spinBit();
176 unsigned int StTriggerData2007::spinBitYellowUp()
const
178 unsigned int sb = spinBit();
182 unsigned int StTriggerData2007::spinBitYellowDown()
const
184 unsigned int sb = spinBit();
188 unsigned int StTriggerData2007::spinBitYellowUnpol()
const
190 unsigned int sb = spinBit();
194 unsigned int StTriggerData2007::spinBitBlueFilled()
const
196 unsigned int sb = spinBit();
200 unsigned int StTriggerData2007::spinBitBlueUp()
const
202 unsigned int sb = spinBit();
206 unsigned int StTriggerData2007::spinBitBlueDown()
const
208 unsigned int sb = spinBit();
212 unsigned int StTriggerData2007::spinBitBlueUnpol()
const
214 unsigned int sb = spinBit();
218 unsigned short StTriggerData2007::ctbRaw(
int address,
int prepost)
const
220 return mData->rawTriggerDet[prepostAddress(prepost)].CTB[address];
223 unsigned short StTriggerData2007::ctb(
int pmt,
int prepost)
const
225 static const unsigned char ctbMap[240] = {
226 7, 6, 5, 4, 3, 23, 22, 21, 20, 19,
227 2, 1, 0, 15, 14, 18, 17, 16, 31, 30,
228 13, 12, 11, 10, 9, 29, 28, 27, 26, 25,
229 39, 38, 37, 36, 35, 55, 54, 53, 52, 51,
230 34, 33, 32, 47, 46, 50, 49, 48, 63, 62,
231 45, 44, 43, 42, 41, 61, 60, 59, 58, 57,
232 71, 70, 69, 68, 67, 87, 86, 85, 84, 83,
233 66, 65, 64, 79, 78, 82, 81, 80, 95, 94,
234 77, 76, 75, 74, 73, 93, 92, 91, 90, 89,
235 103, 102, 101, 100, 99, 119, 118, 117, 116, 115,
236 98, 97, 96, 111, 110, 114, 113, 112, 127, 126,
237 109, 108, 107, 106, 105, 125, 124, 123, 122, 121,
238 135, 134, 133, 132, 131, 151, 150, 149, 148, 147,
239 130, 129, 128, 143, 142, 146, 145, 144, 159, 158,
240 141, 140, 139, 138, 137, 157, 156, 155, 154, 153,
241 167, 166, 165, 164, 163, 183, 182, 181, 180, 179,
242 162, 161, 160, 175, 174, 178, 177, 176, 191, 190,
243 173, 172, 171, 170, 169, 189, 188, 187, 186, 185,
244 199, 198, 197, 196, 195, 215, 214, 213, 212, 211,
245 194, 193, 192, 207, 206, 210, 209, 208, 223, 222,
246 205, 204, 203, 202, 201, 221, 220, 219, 218, 217,
247 231, 230, 229, 228, 227, 247, 246, 245, 244, 243,
248 226, 225, 224, 239, 238, 242, 241, 240, 255, 254,
249 237, 236, 235, 234, 233, 253, 252, 251, 250, 249,
252 int add=prepostAddress(prepost);
253 if(add>=0) v=mData->rawTriggerDet[add].CTB[ctbMap[pmt]];
257 unsigned short StTriggerData2007::ctbTraySlat(
int tray,
int slat,
int prepost)
const{
258 static const unsigned char ctbMap[2][120] = {
259 { 109, 108, 107, 106, 105, 7, 6, 5, 4, 3,
260 2, 1, 0, 15, 14, 13, 12, 11, 10, 9,
261 39, 38, 37, 36, 35, 34, 33, 32, 47, 46,
262 45, 44, 43, 42, 41, 71, 70, 69, 68, 67,
263 66, 65, 64, 79, 78, 77, 76, 75, 74, 73,
264 103, 102, 101, 100, 99, 98, 97, 96, 111, 110,
265 141, 140, 139, 138, 137, 167, 166, 165, 164, 163,
266 162, 161, 160, 175, 174, 173, 172, 171, 170, 169,
267 199, 198, 197, 196, 195, 194, 193, 192, 207, 206,
268 205, 204, 203, 202, 201, 231, 230, 229, 228, 227,
269 226, 225, 224, 239, 238, 237, 236, 235, 234, 233,
270 135, 134, 133, 132, 131, 130, 129, 128, 143, 142},
271 { 125, 124, 123, 122, 121, 23, 22, 21, 20, 19,
272 18, 17, 16, 31, 30, 29, 28, 27, 26, 25,
273 55, 54, 53, 52, 51, 50, 49, 48, 63, 62,
274 61, 60, 59, 58, 57, 87, 86, 85, 84, 83,
275 82, 81, 80, 95, 94, 93, 92, 91, 90, 89,
276 119, 118, 117, 116, 115, 114, 113, 112, 127, 126,
277 157, 156, 155, 154, 153, 183, 182, 181, 180, 179,
278 178, 177, 176, 191, 190, 189, 188, 187, 186, 185,
279 215, 214, 213, 212, 211, 210, 209, 208, 223, 222,
280 221, 220, 219, 218, 217, 247, 246, 245, 244, 243,
281 242, 241, 240, 255, 254, 253, 252, 251, 250, 249,
282 151, 150, 149, 148, 147, 146, 145, 144, 159, 158}
285 int add=prepostAddress(prepost);
286 if(add>=0) v=mData->rawTriggerDet[add].CTB[ctbMap[slat][tray]];
290 unsigned short StTriggerData2007::ctbSum(
int prepost)
const{
291 unsigned short sum=0;
292 for (
int i=1; i<240; i++){sum+=ctb(i,prepost);}
296 unsigned short StTriggerData2007::bbcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
298 static const int q_map[2][24] = {
299 { 8 , 5 , 4 , 40 , 37 , 36 , 7 , 6 ,
300 3 , 2 , 1 , 39 , 38 , 35 , 34 , 33 ,
301 72 , 71 , 70 , 69 , 68 , 67 , 66 , 65 },
302 { 24 , 21 , 20 , 56 , 53 , 52 , 23 , 22 ,
303 19 , 18 , 17 , 55 , 54 , 51 , 50 , 49 ,
304 88 , 87 , 86 , 85 , 84 , 83 , 82 , 81 }
306 return mData->rawTriggerDet[prepostAddress(prepost)].BBC[q_map[eastwest][pmt-1]-1];
309 unsigned short StTriggerData2007::bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
311 static const int t_map[2][24] ={
312 { 16 , 13 , 12 , 48 , 45 , 44 , 15 , 14 ,
313 11 , 10 , 9 , 47 , 46 , 43 , 42 , 41 ,
314 80 , 79 , 78 , 77 , 76 , 75 , 74 , 73 },
315 { 32 , 29 , 28 , 64 , 61 , 60 , 31 , 30 ,
316 27 , 26 , 25 , 63 , 62 , 59 , 58 , 57 ,
317 96 , 95 , 94 , 93 , 92 , 91 , 90 , 89 }
319 return mData->rawTriggerDet[prepostAddress(prepost)].BBC[t_map[eastwest][pmt-1]-1];
322 unsigned short StTriggerData2007::bbcADCSum(StBeamDirection eastwest,
int prepost)
const
324 int address = prepostAddress(prepost);
327 mData->rawTriggerDet[address].BBClayer1[7]%2048+
328 mData->rawTriggerDet[address].BBClayer1[3]%2048;
332 mData->rawTriggerDet[address].BBClayer1[5]%2048+
333 mData->rawTriggerDet[address].BBClayer1[1]%2048;
337 unsigned short StTriggerData2007::bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost)
const
339 int address = prepostAddress(prepost);
340 if (eastwest==east) {
return mData->rawTriggerDet[address].BBClayer1[11]%2048; }
341 else {
return mData->rawTriggerDet[address].BBClayer1[10]%2048; }
344 unsigned short StTriggerData2007::bbcEarliestTDC(StBeamDirection eastwest,
int prepost)
const
346 int address = prepostAddress(prepost), t1, t2;
348 t1 = mData->rawTriggerDet[address].BBClayer1[6]%256;
349 t2 = mData->rawTriggerDet[address].BBClayer1[2]%256;
352 t1 = mData->rawTriggerDet[address].BBClayer1[4]%256;
353 t2 = mData->rawTriggerDet[address].BBClayer1[0]%256;
355 return (t1>t2) ? t1 : t2;
358 unsigned short StTriggerData2007::bbcTimeDifference()
const
360 return mData->TrgSum.DSMdata.VTX[3]%512;
363 unsigned short StTriggerData2007::fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost)
const
365 static const short fpdmap[2][6][49] = {
369 {39, 38, 37, 36, 35, 34, 33,
370 7, 6, 5, 23, 22, 21, 55,
371 4, 3, 2, 20, 19, 18, 54,
372 1, 0, 15, 17, 16, 31, 53,
373 14, 13, 12, 30, 29, 28, 52,
374 11, 10, 9, 27, 26, 25, 51,
375 32, 47, 46, 45, 44, 43, 42},
377 { 103,101,100, 99, 98, 97, 96,
378 71, 70, 69, 87, 86, 85, 48,
379 68, 67, 66, 84, 83, 82, 63,
380 65, 64, 79, 81, 80, 95, 61,
381 78, 77 ,76, 94, 93, 92, 60,
382 75, 74, 73, 91, 90, 89, 59,
383 111,110,109,108, 107, 106,105},
385 {135, 134, 133, 132, 131, 130, 129, 128, 143, 142,
386 119, 118, 117, 116, 115, 114, 113, 112,
387 127, 126, 125, 124, 123, 122, 121,
389 -1, -1, -1, -1, -1, -1, -1,
390 -1, -1, -1, -1, -1, -1, -1,
391 -1, -1, -1, -1, -1, -1, -1},
393 {151, 150, 149, 148, 147, 146, 145, 144,
394 159, 158, 157, 156, 155, 154, 153,
395 167, 166, 165, 164, 163, 162, 161, 160, 175, 174,
397 -1, -1, -1, -1, -1, -1, -1,
398 -1, -1, -1, -1, -1, -1, -1,
399 -1, -1, -1, -1, -1, -1, -1},
401 { 50, 49, 141, 140, 139, 138, 137,
402 -1, -1, -1, -1, -1, -1, -1,
403 -1, -1, -1, -1, -1, -1, -1,
404 -1, -1, -1, -1, -1, -1, -1,
405 -1, -1, -1, -1, -1, -1, -1,
406 -1, -1, -1, -1, -1, -1, -1,
407 -1, -1, -1, -1, -1, -1, -1},
409 { 58, 57, 173, 172, 171, 170, 169,
410 -1, -1, -1, -1, -1, -1, -1,
411 -1, -1, -1, -1, -1, -1, -1,
412 -1, -1, -1, -1, -1, -1, -1,
413 -1, -1, -1, -1, -1, -1, -1,
414 -1, -1, -1, -1, -1, -1, -1,
415 -1, -1, -1, -1, -1, -1, -1},
420 { -1, -1, -1, -1, -1, -1, -1,
421 -1, -1, -1, -1, -1, -1, -1,
422 -1, -1, -1, -1, -1, -1, -1,
423 -1, -1, -1, -1, -1, -1, -1,
424 -1, -1, -1, -1, -1, -1, -1,
425 -1, -1, -1, -1, -1, -1, -1,
426 -1, -1, -1, -1, -1, -1, -1},
428 { 71, 70, 87, 86, 96, 97, 48,
429 69, 68, 85, 84, 98, 99, 63,
430 67, 66, 83, 82, 100, 101, 62,
431 65, 64, 81, 80, 102, 103, 61,
432 79, 78, 90, 91, 106, 107, 60,
433 77, 76, 92, 93, 108, 109, 59,
434 75, 74, 94, 95, 110, 111, 58},
436 { -1, -1, -1, -1, -1, -1, -1,
437 -1, -1, -1, -1, -1, -1, -1,
438 -1, -1, -1, -1, -1, -1, -1,
439 -1, -1, -1, -1, -1, -1, -1,
440 -1, -1, -1, -1, -1, -1, -1,
441 -1, -1, -1, -1, -1, -1, -1,
442 -1, -1, -1, -1, -1, -1, -1},
444 { 77, 70, 69, 68, 67,
450 -1, -1, -1, -1, -1, -1, -1,
451 -1, -1, -1, -1, -1, -1, -1,
452 -1, -1, -1, -1, -1, -1, -1},
454 { -1, -1, -1, -1, -1, -1, -1,
455 -1, -1, -1, -1, -1, -1, -1,
456 -1, -1, -1, -1, -1, -1, -1,
457 -1, -1, -1, -1, -1, -1, -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},
462 { 7, 6, 5, 4, 3, 2, 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,
466 -1, -1, -1, -1, -1, -1, -1,
467 -1, -1, -1, -1, -1, -1, -1,
468 -1, -1, -1, -1, -1, -1, -1},
471 int address = fpdmap[eastwest][module][pmt-1];
474 if (address<112)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer0[address];
475 else return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastTBLayer0[address-112];
486 unsigned short StTriggerData2007::fpdSum(StBeamDirection eastwest,
int module)
const
488 static const short map[2][4]={{3,2,1,0},{7,6,5,4}};
489 static const short nbit[2][4]={{16384,16384,8192,8192},{16384,16384,8192,8192}};
490 return mData->TrgSum.DSMdata.FPD[map[eastwest][module]] % nbit[eastwest][module];
493 unsigned short StTriggerData2007::fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost)
const{
495 if (channel<8)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer1[channel];
500 unsigned short StTriggerData2007::fpdLayer1DSM(StBeamDirection eastwest,
int module,
int board,
int prepost)
const{
501 static const short map[4][4]={{3,2,1,0},{7,6,5,4},{3,2,6,7},{1,0,4,5}};
504 if (module<2)
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer1[map[module][board]];
514 unsigned short StTriggerData2007::fpdLayer2DSMRaw(
int channel)
const{
515 if (channel<8)
return mData->TrgSum.DSMdata.FPD[channel];
519 unsigned short StTriggerData2007::fpdLayer2DSM(StBeamDirection eastwest,
int module)
const{
520 static const int dsmmap[2][4]={{3,2,1,0},{7,6,5,4}};
521 if (module<4)
return mData->TrgSum.DSMdata.FPD[dsmmap[eastwest][module]];
525 unsigned short StTriggerData2007::zdcAtChannel(
int channel,
int prepost)
const
527 static const int dsmmap[16]={7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
528 if (channel>=0 && channel<16){
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[dsmmap[channel]]; }
532 unsigned short StTriggerData2007::zdcAtAddress(
int address,
int prepost)
const
534 if (address>=0 && address<16){
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[address]; }
538 unsigned short StTriggerData2007::zdcUnAttenuated(StBeamDirection eastwest,
int prepost)
const
540 if (eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[4];}
541 if (eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[0];}
545 unsigned short StTriggerData2007::zdcAttenuated(StBeamDirection eastwest,
int prepost)
const
547 if (eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[13];}
548 if (eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[10];}
552 unsigned short StTriggerData2007::zdcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
554 if (eastwest==east && pmt==1) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[7];}
555 if (eastwest==east && pmt==2) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[6];}
556 if (eastwest==east && pmt==3) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[5];}
557 if (eastwest==west && pmt==1) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[3];}
558 if (eastwest==west && pmt==2) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[2];}
559 if (eastwest==west && pmt==3) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[1];}
564 unsigned short StTriggerData2007::zdcTDC(StBeamDirection eastwest,
int prepost)
const
566 if (eastwest==east) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[8];}
567 if (eastwest==west) {
return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[9];}
571 unsigned short StTriggerData2007::zdcHardwareSum(
int prepost)
const
573 return mData->rawTriggerDet[prepostAddress(prepost)].ZDC[14];
576 unsigned short StTriggerData2007::zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost)
const
579 static const int zdcsmd_map[2][2][8] ={
580 { { 7, 6, 5, 4, 3, 2, 1,11} ,
581 { 0,15,14,13,12,8, 10, 9} } ,
582 { {23,22,21,20,19,18,17,26} ,
583 {16,31,30,29,28,27,24,25} }
585 if (verthori<0 || verthori>1)
return 0;
586 if (strip<1 || strip>8)
return 0;
588 add=zdcsmd_map[eastwest][verthori][strip-1];
589 if(add>=0)
return mData->rawTriggerDet[prepostAddress(prepost)].ZDCSMD[add];
593 unsigned short StTriggerData2007::bemcLayer1DSM(
int channel,
int prepost)
const {
594 const int n_bemc_layer1=48;
595 if (channel<0 || channel >=n_bemc_layer1) {
596 gMessMgr->Warning() <<
"Barrel DSM layer 1 out of range (" << channel <<
")" << endm;
599 return mData->rawTriggerDet[prepostAddress(prepost)].BEMClayer1[channel];
602 unsigned short StTriggerData2007::eemcLayer1DSM(
int channel,
int prepost)
const {
603 const int n_eemc_layer1=48;
604 if (channel<0 || channel >=n_eemc_layer1) {
605 gMessMgr->Warning() <<
"Endap DSM layer 1 out of range (" << channel <<
")" << endm;
608 return mData->rawTriggerDet[prepostAddress(prepost)].EEMClayer1[channel];
611 unsigned short StTriggerData2007::emcLayer2DSM(
int channel)
const {
612 const int n_emc_layer2=8;
613 if (channel<0 || channel >=n_emc_layer2) {
614 gMessMgr->Warning() <<
"EMC DSM layer 2 out of range (" << channel <<
")" << endm;
617 return mData->TrgSum.DSMdata.EMC[channel];
620 unsigned char StTriggerData2007::bemcHighTower(
int patch_id,
int prepost)
const
623 const int m_max_patch=300;
625 if ( patch_id < 0 || patch_id >= m_max_patch) {
626 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
631 int channel=patch_id%10;
632 unsigned short trg_word;
634 trg_word=decodeEmc12bit(dsm-15,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCEast);
636 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCWest);
637 return trg_word & 0x3F;
640 unsigned char StTriggerData2007::bemcJetPatch (
int patch_id,
int prepost)
const
643 const int m_max_patch=300;
645 if ( patch_id < 0 || patch_id >= m_max_patch) {
646 gMessMgr->Warning() <<
"Invalid Barrel patch id: " << patch_id << endm;
651 int channel=patch_id%10;
652 unsigned short trg_word;
654 trg_word=decodeEmc12bit(dsm-15,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCEast);
656 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].BEMCWest);
657 return trg_word >> 6;
660 unsigned char StTriggerData2007::eemcHighTower(
int patch_id,
int prepost)
const
663 const int m_max_patch=90;
665 if ( patch_id < 0 || patch_id >= m_max_patch) {
666 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
671 int channel=patch_id%10;
672 unsigned short trg_word;
673 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].EEMC);
674 return trg_word & 0x3F;
677 unsigned char StTriggerData2007::eemcJetPatch (
int patch_id,
int prepost)
const
680 const int m_max_patch=90;
682 if ( patch_id < 0 || patch_id >= m_max_patch) {
683 gMessMgr->Warning() <<
"Invalid Endcap patch id" << endm;
688 int channel=patch_id%10;
689 unsigned short trg_word;
690 trg_word=decodeEmc12bit(dsm,channel,mData->rawTriggerDet[prepostAddress(prepost)].EEMC);
691 return trg_word >> 6;
694 unsigned char StTriggerData2007::bemcHighestTowerADC(
int prepost)
const
697 const int m_max_patch=300;
699 for (
int i=1; i<m_max_patch; i++){
700 unsigned char hh=bemcHighTower(i,prepost);
706 unsigned char StTriggerData2007::eemcHighestTowerADC(
int prepost)
const
709 const int m_max_patch=90;
711 for (
int i=1; i<m_max_patch; i++){
712 unsigned char hh=eemcHighTower(i,prepost);
718 void StTriggerData2007::dump()
const
720 printf(
"***** StTriggerData Dump *****\n");
721 printf(
" Year=%d Version=%x\n",year(),version());
722 printf(
" %d pre and %d post crossing data available\n",numberOfPreXing(),numberOfPostXing());
723 printf(
" Token=%d TriggerWord=%x ActionWord=%x BusyStatus=%x\n",
724 token(), triggerWord(), actionWord(), busyStatus());
725 printf(
" TUC Bits=%d : ",tcuBits());
726 for (
int i=0; i<16; i++) {printf(
" %d",(tcuBits()>>(15-i))%2);}; printf(
"\n");
727 printf(
" BunchId 7bit=%d 48bit=%d\n",bunchId7Bit(), bunchId48Bit());
728 printf(
" Spin Bits=%d : ",spinBit());
729 for (
int i=0; i<8; i++) {printf(
" %d",(spinBit()>>(7-i))%2);}; printf(
"\n");
730 printf(
" CTB ADC : ");
for (
int i=0; i<240;i++){ printf(
"%d ",ctb(i,0)); }; printf(
"\n");
731 printf(
" BBC East ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(east,i,0)); }; printf(
"\n");
732 printf(
" BBC West ADC : ");
for (
int i=1; i<=24;i++){ printf(
"%d ",bbcADC(west,i,0)); }; printf(
"\n");
733 printf(
" BBC East TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(east,i,0)); }; printf(
"\n");
734 printf(
" BBC West TAC : ");
for (
int i=1; i<=16;i++){ printf(
"%d ",bbcTDC(west,i,0)); }; printf(
"\n");
735 for (
int i=-numberOfPreXing(); i<=static_cast<int>(numberOfPostXing()); i++){
736 printf(
" BBC Sums %d xing : ",i);
737 printf(
"East=%d West=%d Large tile East=%d West=%d\n",
738 bbcADCSum(east,i),bbcADCSum(west,i),
739 bbcADCSumLargeTile(east,i),bbcADCSumLargeTile(west,i));
741 printf(
" BBC Earilest : "); printf(
"East=%d West=%d Difference+256=%d\n",
742 bbcEarliestTDC(east,0),bbcEarliestTDC(west,0),bbcTimeDifference());
743 printf(
" FPD East North : ");
for (
int i=1; i<=49;i++){ printf(
"%d ",fpd(east,0,i,0)); }; printf(
"\n");
744 printf(
" FPD East South : ");
for (
int i=1; i<=49;i++){ printf(
"%d ",fpd(east,1,i,0)); }; printf(
"\n");
745 printf(
" FPD East Top : ");
for (
int i=1; i<=25;i++){ printf(
"%d ",fpd(east,2,i,0)); }; printf(
"\n");
746 printf(
" FPD East Bottom : ");
for (
int i=1; i<=25;i++){ printf(
"%d ",fpd(east,3,i,0)); }; printf(
"\n");
747 printf(
" FPD East North PS: ");
for (
int i=1; i<= 7;i++){ printf(
"%d ",fpd(east,4,i,0)); }; printf(
"\n");
748 printf(
" FPD East South PS: ");
for (
int i=1; i<= 7;i++){ printf(
"%d ",fpd(east,5,i,0)); }; printf(
"\n");
749 printf(
" FPD West South : ");
for (
int i=1; i<=49;i++){ printf(
"%d ",fpd(west,1,i,0)); }; printf(
"\n");
750 printf(
" FPD West Bottom : ");
for (
int i=1; i<=25;i++){ printf(
"%d ",fpd(west,3,i,0)); }; printf(
"\n");
751 printf(
" FPD West South PS: ");
for (
int i=1; i<= 7;i++){ printf(
"%d ",fpd(west,5,i,0)); }; printf(
"\n");
752 printf(
" FPD Sums East : ");
for (
int j=0; j<4 ;j++) printf(
"%d ",fpdSum(east,j)); printf(
"\n");
753 printf(
" FPD Sums West : ");
for (
int j=0; j<4 ;j++) printf(
"%d ",fpdSum(west,j)); printf(
"\n");
754 printf(
" ZDC Sum(A) East : ");printf(
"%d ",zdcAttenuated(east)); printf(
"\n");
755 printf(
" ZDC Sum(A) West : ");printf(
"%d ",zdcAttenuated(west)); printf(
"\n");
756 printf(
" ZDC Sum(UA) East : ");printf(
"%d ",zdcUnAttenuated(east)); printf(
"\n");
757 printf(
" ZDC Sum(UA) West : ");printf(
"%d ",zdcUnAttenuated(west)); printf(
"\n");
758 printf(
" VPD E Earliest TAC : %d\n", vpdEarliestTDC(east));
759 printf(
" VPD W Earliest TAC : %d\n", vpdEarliestTDC(west));
760 printf(
" VPD TimeDifference : %d\n", vpdTimeDifference());
761 printf(
" L2 result : \n");
762 for (
int j=0; j<4 ;j++) {
for (
int k=0; k<16; k++) {printf(
"%u ",*(l2Result()+j*16+k)); } printf(
"\n");}
764 printf(
"***** StTriggerData Dump *****\n");
767 char* StTriggerData2007::getTriggerStructure()
769 return (
char*) mData;
777 int StTriggerData2007::getRawSize()
const
779 int npre = numberOfPreXing();
780 int npost = numberOfPostXing();
786 unsigned char * StTriggerData2007::getDsm0_EEMC(
int prepost)
const {
787 return mData->rawTriggerDet[prepostAddress(prepost)].EEMC;
790 unsigned short int * StTriggerData2007::getDsm1_EEMC(
int prepost)
const{
791 return mData->rawTriggerDet[prepostAddress(prepost)].EEMClayer1;
794 unsigned short int * StTriggerData2007::getDsm2_EMC()
const{
795 return mData->TrgSum.DSMdata.EMC;
798 unsigned short int * StTriggerData2007::getDsm3()
const{
799 return mData->TrgSum.DSMdata.lastDSM;
802 int StTriggerData2007::L2ResultsOffset(StL2AlgorithmId
id)
const
804 if(mRun<7000000)
return -1;
807 case l2Diagnostic:
return L2RESULTS_2007_OFFSET_TRG;
808 case l2EmcPedestal:
return L2RESULTS_2007_OFFSET_EMC_PED;
809 case l2Pi0Gamma:
return L2RESULTS_2007_OFFSET_PIG;
810 case l2Upsilon:
return L2RESULTS_2007_OFFSET_UPS;
811 case l2DisplacedVertex:
return L2RESULTS_2007_OFFSET_DISPVER;
812 default:
return -999999999;
816 bool StTriggerData2007::isL2Triggered(StL2TriggerResultType
id)
const
859 unsigned int StTriggerData2007::l2ResultLength()
const
861 return sizeof(mData->TrgSum.L2Result)/
sizeof(
unsigned int);
864 const unsigned int* StTriggerData2007::l2Result()
const
866 return mData->TrgSum.L2Result;
869 unsigned short StTriggerData2007::vpdADC(StBeamDirection eastwest,
int pmt,
int prepost)
const
871 static const int map[2][16] = {
872 { 7, 6, 5, 4, 3, 2, 1, 0,
873 23, 22, 21, 20, 19, 18, 17, 16} ,
874 { 39, 38, 37, 36, 35, 34, 33, 32,
875 55, 54, 53, 52, 51, 50, 49, 48}
877 return mData->rawTriggerDet[prepostAddress(prepost)].VPD[map[eastwest][pmt-1]];
880 unsigned short StTriggerData2007::vpdTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const
882 static const int map[2][16] = {
883 { 15, 14, 13, 12, 11, 10, 9, 8,
884 31, 30, 29, 28, 27, 26, 25, 24} ,
885 { 47, 46, 45, 44, 43, 42, 41, 40,
886 63, 62, 61, 60, 59, 58, 57, 56}
888 return mData->rawTriggerDet[prepostAddress(prepost)].VPD[map[eastwest][pmt-1]];
891 unsigned short StTriggerData2007::vpdEarliestTDC(StBeamDirection eastwest,
int prepost)
const
893 if(prepost!=0)
return 0;
894 int map[2][2] = {{2, 0},{6, 4}};
895 int i1 = map[eastwest][0];
896 int i2 = map[eastwest][1];
897 bool b1 = (mData->TrgSum.DSMdata.VPD[i1] >> 8) & 0x1;
898 bool b2 = (mData->TrgSum.DSMdata.VPD[i2] >> 8) & 0x1;
899 int t1 = mData->TrgSum.DSMdata.VPD[i1] & 0xFF;
900 int t2 = mData->TrgSum.DSMdata.VPD[i2] & 0xFF;
901 if(b1 && b2) {
return (t1>t2) ? t1 : t2;}
902 else if(b1) {
return t1;}
903 else if(b2) {
return t2;}
907 unsigned short StTriggerData2007::vpdTimeDifference()
const
909 return mData->TrgSum.DSMdata.CTB[4] & 0x1FF;
912 unsigned short StTriggerData2007::nQTdata(
int prepost)
const
914 return mData->rawTriggerDet[prepostAddress(prepost)].QQTdataBytes/4;
917 unsigned int* StTriggerData2007::QTdata(
int prepost)
const
919 return mData->rawTriggerDet[prepostAddress(prepost)].QQTdata;
922 unsigned char* StTriggerData2007::getDsm_FMS(
int prepost)
const {
return mData->rawTriggerDet[prepostAddress(prepost)].FPDW;}
923 unsigned char* StTriggerData2007::getDsm01_FMS(
int prepost)
const {
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer0;}
924 unsigned char* StTriggerData2007::getDsm02_FMS(
int prepost)
const {
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastTBLayer0;}
925 unsigned short int* StTriggerData2007::getDsm1_FMS(
int prepost)
const {
return mData->rawTriggerDet[prepostAddress(prepost)].FPDEastNSLayer1;}
926 unsigned short int* StTriggerData2007::getDsm2_FMS()
const {
return mData->TrgSum.DSMdata.FPD;}
928 unsigned short StTriggerData2007::mtdAtAddress(
int address,
int prepost)
const
930 if (address>=0 && address<32){
return mData->rawTriggerDet[prepostAddress(prepost)].MTD[address]; }
934 unsigned short StTriggerData2007::mtdAdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
936 static const int map[2][8] = {
937 { 6, 5, 11, 12, 13, 10, 9, 8},
938 { 7, 4, 3, 2, 1, 0, 15, 14}
940 if(pmt>=0 && pmt<8) {
return mData->rawTriggerDet[prepostAddress(prepost)].MTD[map[eastwest][pmt]]; }
944 unsigned short StTriggerData2007::mtdTdc(StBeamDirection eastwest,
int pmt,
int prepost)
const
946 static const int map[2][8] = {
947 {22,21,27,28,29,26,25,24},
948 {23,20,19,18,17,16,31,30}
950 if(pmt>=0 && pmt<8) {
return mData->rawTriggerDet[prepostAddress(prepost)].MTD[map[eastwest][pmt]]; }