9 #include <Event/Event.h>
10 #include <Event/EventTypes.h>
11 #include <Event/Eventiterator.h>
12 #include <Event/fileEventiterator.h>
45 for (
unsigned int ievt = 0; ievt <
nevents; ievt++)
59 std::cout <<
PHWHERE <<
"Event is nullptr" << std::endl;
83 for (
int i = 0;
i < npackets;
i++)
85 if (
plist[
i]->iValue(0,
"EVENCHECKSUMOK") != 0 &&
plist[
i]->iValue(0,
"ODDCHECKSUMOK") != 0)
92 std::cout <<
"rolling over, event " << std::hex << evtno
94 <<
", rollover counter: " << (
rollover[
i] << 16)
95 << std::dec << std::endl;
103 bool useFEMInfo = ((
plist[
i]->
getIdentifier() / 1000 == 12) && evtno != ((EventSequence - 2) & 0xffff));
105 if (useFEMInfo ==
true)
107 evtno = ((
plist[
i]->
iValue(0,
"FEMEVTNR") - 1) & 0xffff);
108 bclk = ((
plist[
i]->
iValue(0,
"FEMCLOCK") + 30) & 0xffff);
113 << std::hex <<
" clock: 0x" << bclk << std::dec << std::endl;
133 m_Event.emplace_back(std::make_pair(evtno, bclk));
144 std::cout <<
"pktmap size : " <<
m_PacketMap.size() << std::endl;
145 std::cout <<
"evt set size : " <<
m_EvtSet.size() << std::endl;
147 int common_event_number = *(
m_EvtSet.begin());
148 int common_beam_clock =
m_PacketMap.begin()->first;
155 std::cout <<
"we are good evtno: " << *(
m_EvtSet.begin())
156 <<
", clock: " <<
m_PacketMap.begin()->first << std::endl;
163 std::cout <<
"We have multiple event numbers for bclk: 0x" << std::hex
164 <<
m_PacketMap.begin()->first << std::dec << std::endl;
167 std::cout <<
"Event " << iter << std::endl;
173 std::cout <<
"picked event no " << common_event_number << std::endl;
179 for (
auto const &pktiter : iter.second)
189 std::cout <<
"We have multiple beam clocks per event" << std::endl;
195 std::cout <<
"we are good evtno: " << *(
m_EvtSet.begin())
196 <<
", clock: " <<
m_PacketMap.begin()->first << std::endl;
203 std::cout <<
"We have multiple event numbers for bclk: 0x" << std::hex
204 <<
m_PacketMap.begin()->first << std::dec << std::endl;
207 std::cout <<
"Event " << iter << std::endl;
213 std::cout <<
"picked event no " << common_event_number << std::endl;
220 std::cout <<
"picked bclk: " << std::hex << common_beam_clock << std::dec << std::endl;
225 for (
auto pktiter : iter.second)
227 if (pktiter->iValue(0,
"CLOCK") == common_beam_clock)
231 std::cout <<
"adding packet " << pktiter->getIdentifier() <<
" beam clock "
232 << std::hex << pktiter->iValue(0,
"CLOCK") << std::dec << std::endl;
240 std::cout <<
"Deleting packet " << pktiter->getIdentifier() <<
" beam clock "
241 << std::hex << pktiter->iValue(0,
"CLOCK") <<
" common bclk: "
242 << common_beam_clock << std::dec << std::endl;
264 for (
unsigned int i = 0;
i <
m_Event.size();
i++)
266 if (
m_Event[
i].first != decided_evtno)
271 std::cout <<
"my evtno: " <<
m_Event[
i].first <<
", decided: " << decided_evtno
272 <<
", adjustment: " <<
m_Event[
i].first - decided_evtno << std::endl;
281 std::map<int, int> evtcnt;
284 evtcnt[iter.first]++;
288 for (
auto iter : evtcnt)
290 if (iter.second > imax)
301 std::map<int, int> evtcnt;
304 evtcnt[iter.second]++;
307 std::cout <<
"adding clk: " << std::hex << iter.second << std::dec
308 <<
" current counter: " << evtcnt[iter.second] << std::endl;
312 int bclk = std::numeric_limits<int>::max();
313 for (
auto iter : evtcnt)
315 if (iter.second > imax)