1 #ifndef IOPool_Streamer_RawEventOutputModuleForBU_h 2 #define IOPool_Streamer_RawEventOutputModuleForBU_h 21 #include "boost/shared_array.hpp" 24 template <
class Consumer>
63 template <
class Consumer>
68 label_(ps.getUntrackedParameter<
std::
string>(
"ProductLabel",
"source")),
72 frdVersion_(ps.getUntrackedParameter<unsigned
int>(
"frdVersion", 3)),
80 template <
class Consumer>
83 template <
class Consumer>
100 int expectedSize = headerSize;
105 expectedSize += singleFED.
size();
110 boost::shared_array<unsigned char> workBuffer(
new unsigned char[expectedSize + 256]);
123 fedsize[
idx] = singleFED.
size();
126 memcpy(bufPtr, fedsize, 1024 *
sizeof(
uint32));
129 *bufPtr++ = expectedSize - headerSize;
134 uint32* payloadPtr = bufPtr;
137 if (singleFED.
size() > 0) {
138 memcpy(bufPtr, singleFED.
data(), singleFED.
size());
139 bufPtr += singleFED.
size() / 4;
145 *(payloadPtr - 1) =
crc32c(crc, (
const unsigned char*)payloadPtr, expectedSize - headerSize);
150 cms::Adler32((
const char*)payloadPtr, expectedSize - headerSize, adlera, adlerb);
151 *(payloadPtr - 1) = (adlerb << 16) | adlera;
164 template <
class Consumer>
170 template <
class Consumer>
175 template <
class Consumer>
180 std::cout <<
" writing to destination dir " << destinationDir <<
" name: " << filename << std::endl;
185 ::gettimeofday(&now,
nullptr);
200 template <
class Consumer>
std::unique_ptr< Consumer > templateConsumer_
EventNumber_t event() const
void endRun(edm::RunForOutput const &) override
EventID const & id() const
void beginRun(edm::RunForOutput const &) override
BasicHandle getByToken(EDGetToken token, TypeID const &typeID) const
const uint32 FRDHeaderVersionSize[6]
unsigned long long writtensize
void write(edm::EventForOutput const &e) override
edm::EDGetTokenT< FEDRawDataCollection > token_
RawEventOutputModuleForBU(edm::ParameterSet const &ps)
size_t size() const
Lenght of the data buffer in bytes.
void beginLuminosityBlock(edm::LuminosityBlockForOutput const &) override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
unsigned long long totsize
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
~RawEventOutputModuleForBU() override
unsigned long long writtenSizeLast
uint32_t crc32c(uint32_t crc, const unsigned char *buf, size_t len)
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
void endLuminosityBlock(edm::LuminosityBlockForOutput const &) override
LuminosityBlockNumber_t luminosityBlock() const
unsigned int numEventsPerFile_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
LuminosityBlockNumber_t luminosityBlock() const
void writeLuminosityBlock(const edm::LuminosityBlockForOutput &) override
LuminosityBlockID const & id() const
void writeRun(const edm::RunForOutput &) override
OutputModule(edm::ParameterSet const &iPSet)
static constexpr int lastFEDId()