94 const auto slink_event_size = slink_event.size() *
sizeof(slink_event.at(0));
97 size_t total_event_size = slink_event_size;
104 fed_data.
resize(total_event_size);
105 auto* ptr = fed_data.data();
109 const auto event_id = std::get<0>(last_event.first), bx_id = std::get<1>(last_event.first);
113 LogDebug(
"HGCalSlinkEmulator").log([&](
auto&
log) {
115 log <<
"FED header: lvl1ID=" << hdr.lvl1ID() <<
", bxID=" << hdr.bxID() <<
", source ID=" << hdr.sourceID()
122 std::memcpy(ptr, slink_event.data(), slink_event_size);
123 ptr += slink_event_size;
124 LogDebug(
"HGCalSlinkEmulator") <<
"Wrote " << slink_event.size() <<
" 64-bit words = " << slink_event_size
130 slink_event.size() + 2,
131 evf::compute_crc(reinterpret_cast<uint8_t*>(slink_event.data()), slink_event_size),
134 LogDebug(
"HGCalSlinkEmulator").log([&](
auto&
log) {
136 log <<
"FED trailer: fragment length: " << trl.fragmentLength() <<
", CRC=0x" << std::hex << trl.crc() <<
std::dec 137 <<
", status: " << trl.evtStatus() <<
".";
const bool store_fed_header_trailer_
static const uint32_t length
const econd::ECONDInput & lastECONDEmulatedInput() const
Retrieve the last ECON-D event emulated.
const bool store_emul_info_
const edm::EDPutTokenT< FEDRawDataCollection > fedRawToken_
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
std::vector< uint64_t > produceSlinkEvent(unsigned int fed_id) const
Produce a S-link event from an emulated event.
static void set(unsigned char *trailer, uint32_t lenght, uint16_t crc, uint8_t evt_stat, uint8_t tts, bool moreTrailers=false)
Set all fields in the trailer.
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
const HGCalSlinkEmulatorInfo & lastSlinkEmulatedInfo() const
Retrieve the metadata generated along with the last S-link emulated payload.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::EDPutTokenT< HGCalSlinkEmulatorInfo > fedEmulInfoToken_
hgcal::HGCalFrameGenerator frame_gen_
void resize(size_t newsize, size_t wordsize=8)
void setRandomEngine(CLHEP::HepRandomEngine &rng)
Set the random number generator engine.
edm::Service< edm::RandomNumberGenerator > rng_
const unsigned int fed_id_