Line data Source code
1 : /**
2 : * @file EventPacket.cxx
3 : *
4 : * This is part of the DUNE DAQ , copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 : #ifndef SSPMODULES_SRC_ANLBOARD_EVENTPACKET_CXX_
9 : #define SSPMODULES_SRC_ANLBOARD_EVENTPACKET_CXX_
10 :
11 : #include "logging/Logging.hpp"
12 :
13 : #include "EventPacket.hpp"
14 :
15 : void
16 0 : dunedaq::sspmodules::EventPacket::SetEmpty()
17 : {
18 0 : data.clear();
19 0 : header.header = 0xDEADBEEF;
20 0 : }
21 :
22 : void
23 0 : dunedaq::sspmodules::EventPacket::DumpHeader()
24 : {
25 :
26 0 : u_int32_t peaksum = ((header.group3 & 0x00FF) >> 16) + header.peakSumLow;
27 0 : if (peaksum & 0x00800000) {
28 : peaksum |= 0xFF000000;
29 : }
30 : // clang-format off
31 : //dune::DAQLogger::LogInfo("SSP_EventPacket")
32 0 : TLOG_DEBUG(10)
33 0 : << "=====HEADER=======================================" << std::endl
34 0 : << "Header: " << header.header << std::endl
35 0 : << "Length: " << header.length << std::endl
36 0 : << "Trigger type: " << ((header.group1 & 0xFF00) >> 8) << std::endl
37 0 : << "Status flags: " << ((header.group1 & 0x00F0) >> 4) << std::endl
38 0 : << "Header type: " << ((header.group1 & 0x000F) >> 0) << std::endl
39 0 : << "Trigger ID: " << header.triggerID << std::endl
40 0 : << "Module ID: " << ((header.group2 & 0xFFF0) >> 4) << std::endl
41 0 : << "Channel ID: " << ((header.group2 & 0x000F) >> 0) << std::endl
42 0 : << "External timestamp (FP mode): " << std::endl
43 0 : << " Sync delay: " << ((unsigned int)(header.timestamp[1]) << 16) + (unsigned int)(header.timestamp[0]) << std::endl
44 0 : << " Sync count: " << ((unsigned int)(header.timestamp[3]) << 16) + (unsigned int)(header.timestamp[2]) << std::endl
45 0 : << "External timestamp (NOvA mode): " << ((unsigned long)header.timestamp[3] << 48) +((unsigned long)header.timestamp[2] << 32) // NOLINT(runtime/int)
46 0 : + ((unsigned long)header.timestamp[1] << 16) + (unsigned long)header.timestamp[0] <<std::endl // NOLINT(runtime/int)
47 0 : << "Peak sum: " << peaksum << std::endl
48 0 : << "Peak time: " << ((header.group3 & 0xFF00) >> 8) << std::endl
49 0 : << "Prerise: " << ((header.group4 & 0x00FF) << 16) + header.preriseLow << std::endl
50 0 : << "Integrated sum: " << ((unsigned int)(header.intSumHigh) << 8) + (((unsigned int)(header.group4) & 0xFF00) >> 8) << std::endl
51 0 : << "Baseline: " << header.baseline << std::endl
52 0 : << "CFD Timestamp interpolation points: " << header.cfdPoint[0] << " " << header.cfdPoint[1] << " " << header.cfdPoint[2] << " " << header.cfdPoint[3] << std::endl
53 0 : << "Internal interpolation point: " << header.intTimestamp[0] << std::endl
54 0 : << "Internal timestamp: " << ((uint64_t)((uint64_t)header.intTimestamp[3] << 32)) + ((uint64_t)((uint64_t)header.intTimestamp[2]) << 16) + ((uint64_t)((uint64_t)header.intTimestamp[1])) <<" ("<<header.intTimestamp[3]<<" "<<header.intTimestamp[2]<<" "<<header.intTimestamp[1]<<")"<<std::endl // NOLINT(build/unsigned)
55 0 : << "=================================================="<< std::endl
56 0 : << std::endl;
57 : // clang-format on
58 0 : }
59 :
60 : void
61 0 : dunedaq::sspmodules::EventPacket::DumpEvent()
62 : {
63 :
64 : // dune::DAQLogger::LogInfo("SSP_EventPacket")<<"*****EVENT DUMP***********************************"
65 : // <<std::endl<<std::endl;
66 :
67 0 : this->DumpHeader();
68 :
69 : // dune::DAQLogger::LogInfo("SSP_EventPacket")<<"=====ADC VALUES===================================" <<std::endl;
70 :
71 0 : unsigned int nADC = data.size() * 2;
72 0 : unsigned short* adcs = reinterpret_cast<unsigned short*>(&(data[0])); // NOLINT
73 :
74 0 : std::stringstream adcstream;
75 :
76 0 : for (unsigned int i = 0; i < nADC; ++i) {
77 :
78 0 : adcstream << adcs[i] << ", ";
79 : }
80 :
81 : // dune::DAQLogger::LogInfo("SSP_EventPacket")<< adcstream.str() ;
82 :
83 : // dune::DAQLogger::LogInfo("SSP_EventPacket")<<std::endl<<"**************************************************"
84 : //<<std::endl<<std::endl;
85 0 : }
86 :
87 : #endif // SSPMODULES_SRC_ANLBOARD_EVENTPACKET_CXX_
|