Skip to content

Commit

Permalink
Merge pull request #24 from Mu2e/rrivera/progressCheckpointAtCaloAndT…
Browse files Browse the repository at this point in the history
…rkVSTs2

Data interpretation updates in progress of buffer handling and printo…
  • Loading branch information
eflumerf authored Mar 7, 2024
2 parents bf181de + 2048402 commit 9a15d2c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
12 changes: 7 additions & 5 deletions artdaq-core-mu2e/Overlays/DTC_Packets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <iomanip>
#include <sstream>


DTCLib::DTC_DataPacket::DTC_DataPacket()
{
memPacket_ = false;
Expand Down Expand Up @@ -147,7 +148,7 @@ DTCLib::DTC_DMAPacket::DTC_DMAPacket(const DTC_DataPacket in)
auto word3 = in.GetData()[3];
uint8_t linkID = word3 & 0x7;
valid_ = (word3 & 0x80) == 0x80;
subsystemID_ = (word3 >> 4) & 0x7;
subsystemID_ = (in.GetData()[5] >> 5) & 0x7;

byteCount_ = in.GetData()[0] + (in.GetData()[1] << 8);
hopCount_ = hopCount;
Expand Down Expand Up @@ -763,7 +764,7 @@ DTCLib::DTC_DataPacket DTCLib::DTC_DCSReplyPacket::ConvertToDataPacket() const
return output;
}

DTCLib::DTC_DataHeaderPacket::DTC_DataHeaderPacket(DTC_Link_ID link, uint16_t packetCount, DTC_DataStatus status,
DTCLib::DTC_DataHeaderPacket::DTC_DataHeaderPacket(DTC_Link_ID link, uint16_t packetCount, uint8_t status,
uint8_t dtcid, DTC_Subsystem subsystemid, uint8_t packetVersion, DTC_EventWindowTag event_tag,
uint8_t evbMode)
: DTC_DMAPacket(DTC_PacketType_DataHeader, link, (1 + packetCount) * 16, true, subsystemid), packetCount_(packetCount), event_tag_(event_tag), status_(status), dataPacketVersion_(packetVersion), dtcId_(dtcid), evbMode_(evbMode) {}
Expand All @@ -780,9 +781,9 @@ DTCLib::DTC_DataHeaderPacket::DTC_DataHeaderPacket(DTC_DataPacket in)
throw ex;
}
auto arr = in.GetData();
packetCount_ = arr[4] + (arr[5] << 8);
packetCount_ = arr[4] + ((arr[5]&7) << 8);
event_tag_ = DTC_EventWindowTag(arr, 6);
status_ = DTC_DataStatus(arr[12]);
status_ = arr[12];
dataPacketVersion_ = arr[13];
dtcId_ = arr[14];
evbMode_ = arr[15];
Expand Down Expand Up @@ -954,7 +955,8 @@ void DTCLib::DTC_SubEvent::SetupSubEvent()
//printout SubEvent header
{
std::stringstream testss;
testss << "subevent header bytes=" << sizeof(header_) << ": 0x ";
testss << "subevent header Tag=" << GetEventWindowTag().GetEventWindowTag(true) << " (0x" << std::hex <<
GetEventWindowTag().GetEventWindowTag(true) << ") bytes=" << std::dec << sizeof(header_) << ": 0x ";
for(size_t i = 0; i < sizeof(header_); i+=4)
testss << std::hex << std::setw(8) << std::setfill('0') << *((uint32_t *)(&(ptr[i]))) << ' ';
TLOG(TLVL_TRACE + 5) << testss.str();
Expand Down
26 changes: 17 additions & 9 deletions artdaq-core-mu2e/Overlays/DTC_Packets.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,21 @@ enum DTC_PacketType : uint8_t

/// <summary>
/// Possible values for the Status word of the Data Header packet
//Bit Position Definition
// 0 “Event Window has Data” flag indicates detector data present, else No Data for Event Window.
// 1 “Invalid Event Window Request” flag indicates the ROC did not receive a Heartbeat packet corresponding to this Data Request.
// 2 “I am corrupt” flag indicates the ROC has lost data or the ability to conduct detector readout has been compromised.
// 3 “Timeout” flag indicates ROC retrieval of data did not respond before timeout occurred.
// 4 “Overflow” flag indicates data is good, but not all data could be sent.
// 7:5 Reserved
/// </summary>
enum DTC_DataStatus
{
DTC_DataStatus_Valid = 0,
DTC_DataStatus_NoValid = 1,
DTC_DataStatus_Invalid = 2,
};
static const uint8_t DTC_DataStatus_Valid = 0;
// enum DTC_DataStatus //It is a bit mask, can implement easily with enum
// {
// DTC_DataStatus_Valid = 0,
// DTC_DataStatus_NoValid = 1,
// DTC_DataStatus_Invalid = 2,
// };

/// <summary>
/// Possible values for the Op word of the DCS Request packet.
Expand Down Expand Up @@ -877,7 +885,7 @@ class DTC_DataHeaderPacket : public DTC_DMAPacket
/// <param name="packetVersion">Version of data format</param>
/// <param name="event_tag">Timestamp of Data Packet (Default: DTC_Timetstamp())</param>
/// <param name="evbMode">EVB Mode byte (Default: 0)</param>
DTC_DataHeaderPacket(DTC_Link_ID link, uint16_t packetCount, DTC_DataStatus status, uint8_t dtcid, DTC_Subsystem subsystemid,
DTC_DataHeaderPacket(DTC_Link_ID link, uint16_t packetCount, uint8_t status, uint8_t dtcid, DTC_Subsystem subsystemid,
uint8_t packetVersion, DTC_EventWindowTag event_tag = DTC_EventWindowTag(), uint8_t evbMode = 0);
/// <summary>
/// Default Copy Constructor
Expand Down Expand Up @@ -941,7 +949,7 @@ class DTC_DataHeaderPacket : public DTC_DMAPacket
/// Get the Data Status of the Data Block
/// </summary>
/// <returns>DTC_DataStatus enumeration value</returns>
DTC_DataStatus GetStatus() const { return status_; }
uint8_t GetStatus() const { return status_; }

/// <summary>
/// Convert the DTC_DataHeaderPacket to JSON representation
Expand Down Expand Up @@ -978,7 +986,7 @@ class DTC_DataHeaderPacket : public DTC_DMAPacket
private:
uint16_t packetCount_;
DTC_EventWindowTag event_tag_;
DTC_DataStatus status_;
uint8_t status_;
uint8_t dataPacketVersion_;
uint8_t dtcId_;
uint8_t evbMode_;
Expand Down

0 comments on commit 9a15d2c

Please sign in to comment.