29 MsgStream log(
msgSvc(),name());
30 log<<MSG::DEBUG<<
"TrigEventMaker: in execute()" <<endreq;
34 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
36 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
37 return StatusCode::FAILURE;
40 int eventId = eventHeader->eventNumber() ;
41 int runId = eventHeader->runNumber();
42 log << MSG::INFO <<
"TrigEventMaker: retrieved event: " <<
" Event Number "<< eventId <<
" run: " <<runId << endreq;
49 bool preScale =
false;
52 for(
int i = 0; i < 48; i++) {
53 if(i < 16) trgChan[i] = 0;
58 SmartDataPtr<TrigGTDCol> trigGTDCol(eventSvc(),
"/Event/Trig/TrigGTDCol");
60 log << MSG::FATAL <<
"Could not find TrigGTDCol!" << endreq;
61 return StatusCode::FAILURE;
64 TrigGTDCol::iterator
iter = trigGTDCol->begin();
65 for (;
iter != trigGTDCol->end();
iter++ ) {
66 const uint32_t boardId = (*iter)->getId();
67 const uint32_t timeWindow = (*iter)->getTimeWindow();
69 const uint32_t size = (*iter)->getDataSize();
70 const uint32_t* trigData = (*iter)->getDataPtr();
76 if(size%timeWindow != 0) {
77 log << MSG::FATAL <<
"GTL data is NOT completed" << endreq;
78 return StatusCode::FAILURE;
80 for(uint32_t j = 0; j < size; j++) {
81 uint32_t dataId = ((trigData[j] >> 24) & 0x7);
82 if(dataId != 5)
continue;
83 for(uint32_t i = 1, loop = 0; loop < 24; i <<= 1, loop++) {
85 if(trigData[j] & i) trgChan[loop] = 1;
87 if((loop == 16) && (trigData[j] & i)) timing = 1;
88 if((loop == 17) && (trigData[j] & i) && (timing != 1)) timing = 2;
89 if((loop == 18) && (trigData[j] & i) && (timing == 0)) timing = 3;
90 if((loop == 21) && (trigData[j] & i)) preScale =
true;
95 if(boardId == 0xd2 || boardId == 0xd4 || boardId == 0xd6) {
96 for(uint32_t j = 0; j < size; j++) {
97 uint32_t dataId = ((trigData[j] >> 16) & 0xFF);
98 if(dataId != 4)
continue;
99 for(uint32_t i = 1, loop = 0; loop < 16; i <<= 1, loop++) {
100 if((boardId == 0xd2) && (trigData[j] & i)) trgCond[32+loop] = 1;
101 if((boardId == 0xd4) && (trigData[j] & i)) trgCond[16+loop] = 1;
102 if((boardId == 0xd6) && (trigData[j] & i)) trgCond[loop] = 1;
109 TrigData* aTrigData =
new TrigData(window, timing, trgCond, trgChan, preScale);
111 StatusCode sc = StatusCode::SUCCESS ;
113 if(sc!=StatusCode::SUCCESS) {
114 log<<MSG::DEBUG<<
"Could not register TrigData" <<endreq;
115 return StatusCode::FAILURE;
118 return StatusCode::SUCCESS;