9 #include <Event/Event.h>
10 #include <Event/EventTypes.h>
11 #include <Event/Eventiterator.h>
12 #include <Event/fileEventiterator.h>
48 for (
unsigned int ievt = 0; ievt <
nevents; ievt++)
62 std::cout <<
PHWHERE <<
"Event is nullptr" << std::endl;
84 for (
int i = 0;
i < npackets;
i++)
86 if (
plist[
i]->iValue(0,
"CHECKSUMOK") != 0)
93 std::cout <<
"rolling over, event " << std::hex << evtno
95 <<
", rollover counter: " << (
rollover[
i] << 16)
96 << std::dec << std::endl;
106 << std::hex <<
" clock: 0x" << bclk << std::dec << std::endl;
126 m_Event.emplace_back(std::make_pair(evtno, bclk));
137 std::cout <<
"pktmap size : " <<
m_PacketMap.size() << std::endl;
138 std::cout <<
"evt set size : " <<
m_EvtSet.size() << std::endl;
140 int common_event_number = *(
m_EvtSet.begin());
141 int common_beam_clock =
m_PacketMap.begin()->first;
148 std::cout <<
"we are good evtno: " << *(
m_EvtSet.begin())
149 <<
", clock: " <<
m_PacketMap.begin()->first << std::endl;
156 std::cout <<
"We have multiple event numbers for bclk: 0x" << std::hex
157 <<
m_PacketMap.begin()->first << std::dec << std::endl;
160 std::cout <<
"Event " << iter << std::endl;
166 std::cout <<
"picked event no " << common_event_number << std::endl;
172 for (
auto const &pktiter : iter.second)
182 std::cout <<
"We have multiple beam clocks per event" << std::endl;
188 std::cout <<
"we are good evtno: " << *(
m_EvtSet.begin())
189 <<
", clock: " <<
m_PacketMap.begin()->first << std::endl;
196 std::cout <<
"We have multiple event numbers for bclk: 0x" << std::hex
197 <<
m_PacketMap.begin()->first << std::dec << std::endl;
200 std::cout <<
"Event " << iter << std::endl;
206 std::cout <<
"picked event no " << common_event_number << std::endl;
213 std::cout <<
"picked bclk: " << std::hex << common_beam_clock << std::dec << std::endl;
218 for (
auto pktiter : iter.second)
220 if (pktiter->iValue(0,
"CLOCK") == common_beam_clock)
224 std::cout <<
"adding packet " << pktiter->getIdentifier() <<
" beam clock "
225 << std::hex << pktiter->iValue(0,
"CLOCK") << std::dec << std::endl;
233 std::cout <<
"Deleting packet " << pktiter->getIdentifier() <<
" beam clock "
234 << std::hex << pktiter->iValue(0,
"CLOCK") <<
" common bclk: "
235 << common_beam_clock << std::dec << std::endl;
257 for (
unsigned int i = 0;
i <
m_Event.size();
i++)
259 if (
m_Event[
i].first != decided_evtno)
264 std::cout <<
"my evtno: " <<
m_Event[
i].first <<
", decided: " << decided_evtno
265 <<
", adjustment: " <<
m_Event[
i].first - decided_evtno << std::endl;
274 std::map<int, int> evtcnt;
277 evtcnt[iter.first]++;
281 for (
auto iter : evtcnt)
283 if (iter.second > imax)
294 std::map<int, int> evtcnt;
297 evtcnt[iter.second]++;
300 std::cout <<
"adding clk: " << std::hex << iter.second << std::dec
301 <<
" current counter: " << evtcnt[iter.second] << std::endl;
305 int bclk = std::numeric_limits<int>::max();
306 for (
auto iter : evtcnt)
308 if (iter.second > imax)
319 std::cout <<
PHWHERE <<
Name() <<
": trying to open " << filenam << std::endl;
322 std::cout <<
"Closing currently open file "
324 <<
" and opening " << filenam << std::endl;
332 std::cout <<
Name() <<
": opening file " <<
FileName() << std::endl;
341 std::cout <<
PHWHERE <<
Name() <<
": could not open file " << fname << std::endl;
353 std::cout <<
Name() <<
": fileclose: No Input file open" << std::endl;