Skip to content

Commit

Permalink
SoA format of HGCal ECON-D header
Browse files Browse the repository at this point in the history
  • Loading branch information
yulunmiao authored and pfs committed Jul 24, 2024
1 parent 6427e97 commit 9756f10
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
14 changes: 14 additions & 0 deletions DataFormats/HGCalDigi/interface/HGCalECONDInfoHost.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef DataFormats_HGCalDigi_interface_HGCalECONDInfoHost_h
#define DataFormats_HGCalDigi_interface_HGCalECONDInfoHost_h

#include "DataFormats/Portable/interface/PortableHostCollection.h"
#include "DataFormats/HGCalDigi/interface/HGCalECONDInfoSoA.h"

namespace hgcaldigi {

// SoA with x, y, z, id fields in host memory
using HGCalECONDInfoHost = PortableHostCollection<HGCalECONDInfoSoA>;

} // namespace hgcaldigi

#endif
52 changes: 52 additions & 0 deletions DataFormats/HGCalDigi/interface/HGCalECONDInfoSoA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef DataFormats_HGCalDigi_interface_HGCalECONDInfoSoA_h
#define DataFormats_HGCalDigi_interface_HGCalECONDInfoSoA_h

#include <Eigen/Core>
#include <Eigen/Dense>

#include "DataFormats/SoATemplate/interface/SoACommon.h"
#include "DataFormats/SoATemplate/interface/SoALayout.h"
#include "DataFormats/SoATemplate/interface/SoAView.h"

namespace hgcaldigi {
// Generate structure of arrays (SoA) layout with Digi dataformat
GENERATE_SOA_LAYOUT(HGCalECONDInfoSoALayout,
// Capture block information:
// 0b000: Normal packet
// 0b001: No ECOND packet. Packet was detected and discarded because too large (>250)
// 0b010: Packet with payload CRC error
// 0b011: Packet with EventID mismatch.
// 0b100: No ECOND packet. The event builder state machine timed-out.
// 0b101: No ECOND packet due to BCID and/or OrbitID mismatch.
// 0b110: No ECOND packet. Packet was detected but was discarded due to Main Buffer overflow.
SOA_COLUMN(uint8_t, cbFlag), //cbflag
// ECON-D header information
// bit 0: Truncation flag
// bit 1: Match flag
// bit 2-3: E/B/O bits
// bit 4-5: H/T bits
// bit 6: Expected flag
// bit 7: logical OR of Stat for all active eRx
SOA_COLUMN(uint8_t, econdFlag), //econdFlag
// Exception flag
// 0: Normal
// 1: Wrong S-Link header marker
// 2: Wrong Capture block header marker
// These will be saved to the first ECON-D in the block
// 3: Wrong ECON-D header marker
// 4: ECON-D payload length overflow(>469)
// 5: unpacked ECON-D length and payload length not match
SOA_COLUMN(uint8_t, exception),
// Location
// If exception found before ECON-D, this would be 0
// Otherwise the 64b index of ECON-D header
SOA_COLUMN(uint32_t, location),
// Payload length
// If exception found before ECON-D, this would be 0
// Otherwise the payload length of the ECON-D
SOA_COLUMN(uint16_t, payloadLength)
)
using HGCalECONDInfoSoA = HGCalECONDInfoSoALayout<>;
} // namespace hgcaldigi

#endif
23 changes: 23 additions & 0 deletions DataFormats/HGCalDigi/interface/alpaka/HGCalECONDInfoDevice.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef DataFormats_HGCalDigi_interface_alpaka_HGCalECONDInfoDevice_h
#define DataFormats_HGCalDigi_interface_alpaka_HGCalECONDInfoDevice_h

#include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
#include "DataFormats/HGCalDigi/interface/HGCalECONDInfoSoA.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {

namespace hgcaldigi {

// make the names from the top-level hgcaldigi namespace visible for unqualified lookup
// inside the ALPAKA_ACCELERATOR_NAMESPACE::hgcaldigi namespace
using namespace ::hgcaldigi;

// SoA in device global memory
using HGCalECONDInfoDevice = PortableCollection<HGCalECONDInfoSoA>;

} // namespace hgcaldigi

} // namespace ALPAKA_ACCELERATOR_NAMESPACE

#endif

0 comments on commit 9756f10

Please sign in to comment.