BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
TrigEventMaker Class Reference

#include <TrigEventMaker.h>

+ Inheritance diagram for TrigEventMaker:

Public Member Functions

 TrigEventMaker (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 TrigEventMaker (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Constructor & Destructor Documentation

◆ TrigEventMaker() [1/2]

TrigEventMaker::TrigEventMaker ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 17 of file TrigEventMaker.cxx.

17 : Algorithm(name, pSvcLocator)
18{
19 //Declare the properties
20}

◆ TrigEventMaker() [2/2]

TrigEventMaker::TrigEventMaker ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Member Function Documentation

◆ execute() [1/2]

StatusCode TrigEventMaker::execute ( )

Definition at line 28 of file TrigEventMaker.cxx.

28 {
29 MsgStream log(msgSvc(),name());
30 log<<MSG::DEBUG<< "TrigEventMaker: in execute()" <<endreq;
31
32 // Get the event header, print out event and run number
33
34 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
35 if (!eventHeader) {
36 log << MSG::FATAL << "Could not find Event Header" << endreq;
37 return StatusCode::FAILURE;
38 }
39
40 int eventId = eventHeader->eventNumber() ;
41 int runId = eventHeader->runNumber();
42 log << MSG::INFO << "TrigEventMaker: retrieved event: " <<" Event Number "<< eventId << " run: " <<runId << endreq;
43
44 //define elements in TrigData structure
45 int trgCond[48];
46 int trgChan[16];
47 int window = 0;
48 int timing = 0;
49 bool preScale = false;
50
51 //initialize the elements defined above
52 for(int i = 0; i < 48; i++) {
53 if(i < 16) trgChan[i] = 0;
54 trgCond[i] = 0;
55 }
56
57 //Get trigger information from TDS
58 SmartDataPtr<TrigGTDCol> trigGTDCol(eventSvc(),"/Event/Trig/TrigGTDCol");
59 if (!trigGTDCol) {
60 log << MSG::FATAL << "Could not find TrigGTDCol!" << endreq;
61 return StatusCode::FAILURE;
62 }
63
64 TrigGTDCol::iterator iter = trigGTDCol->begin();
65 for (;iter != trigGTDCol->end(); iter++ ) {
66 const uint32_t boardId = (*iter)->getId(); //The board Id 0xd3: GTL, 0xD2: SAF1, 0xD4: SAF2, 0xD6: SAF3
67 const uint32_t timeWindow = (*iter)->getTimeWindow(); //Time window, bit8 to bit13, total: 0--31
68 //const uint32_t dataType = (*iter)->getDataType(); //bit3 to bit7, total: 0--31
69 const uint32_t size = (*iter)->getDataSize(); //The size of trigger data, not include head
70 const uint32_t* trigData = (*iter)->getDataPtr(); //Trigger data
71
72 window = timeWindow;
73
74 //Get data group 5 in GTL, including trigger channel, timing and prescale.
75 if(boardId == 0xd3) {
76 if(size%timeWindow != 0) {
77 log << MSG::FATAL << "GTL data is NOT completed" << endreq;
78 return StatusCode::FAILURE;
79 }
80 for(uint32_t j = 0; j < size; j++) {
81 uint32_t dataId = ((trigData[j] >> 24) & 0x7);
82 if(dataId != 5) continue; //find data group 5
83 for(uint32_t i = 1, loop = 0; loop < 24; i <<= 1, loop++) {
84 if(loop < 16) {
85 if(trigData[j] & i) trgChan[loop] = 1;
86 }
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;
91 }
92 }
93 }
94 //Get "or 4" in SAF
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; //find data "or 4" in SAF
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;
103 }
104 }
105 }
106 }
107
108 //Register related trigger information to TDS for physics analysis
109 TrigData* aTrigData = new TrigData(window, timing, trgCond, trgChan, preScale);
110
111 StatusCode sc = StatusCode::SUCCESS ;
112 sc = eventSvc()->registerObject(EventModel::Trig::TrigData,aTrigData);
113 if(sc!=StatusCode::SUCCESS) {
114 log<<MSG::DEBUG<< "Could not register TrigData" <<endreq;
115 return StatusCode::FAILURE;
116 }
117
118 return StatusCode::SUCCESS;
119}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)

◆ execute() [2/2]

StatusCode TrigEventMaker::execute ( )

◆ finalize() [1/2]

StatusCode TrigEventMaker::finalize ( )

Definition at line 121 of file TrigEventMaker.cxx.

121 {
122 MsgStream log(msgSvc(), name());
123 log << MSG::DEBUG << "==> Finalize TrigEventMaker" << endreq;
124 return StatusCode::SUCCESS;
125}

◆ finalize() [2/2]

StatusCode TrigEventMaker::finalize ( )

◆ initialize() [1/2]

StatusCode TrigEventMaker::initialize ( )

Definition at line 22 of file TrigEventMaker.cxx.

22 {
23 MsgStream log(msgSvc(), name());
24 log << MSG::DEBUG << "TrigEventMaker: in initialize()" << endreq;
25 return StatusCode::SUCCESS;
26}

◆ initialize() [2/2]

StatusCode TrigEventMaker::initialize ( )

The documentation for this class was generated from the following files: