1 #ifndef IOPool_Streamer_RawEventOutputModuleForBU_h 2 #define IOPool_Streamer_RawEventOutputModuleForBU_h 21 #include "boost/shared_array.hpp" 24 template <
class Consumer>
64 template <
class Consumer>
73 frdVersion_(ps.getUntrackedParameter<unsigned
int>(
"frdVersion",3)),
83 template <
class Consumer>
86 template <
class Consumer>
104 int expectedSize = headerSize;
110 expectedSize += singleFED.
size();
115 boost::shared_array<unsigned char> workBuffer(
new unsigned char[expectedSize + 256]);
128 fedsize[
idx] = singleFED.
size();
131 memcpy(bufPtr,fedsize,1024 *
sizeof(
uint32));
135 *bufPtr++ = expectedSize-headerSize;
140 uint32 *payloadPtr=bufPtr;
143 if (singleFED.
size() > 0) {
144 memcpy(bufPtr, singleFED.
data(), singleFED.
size());
145 bufPtr += singleFED.
size()/4;
151 *(payloadPtr-1) =
crc32c(crc,(
const unsigned char*) payloadPtr, expectedSize-headerSize);
157 cms::Adler32((
const char*) payloadPtr, expectedSize-headerSize, adlera, adlerb);
158 *(payloadPtr-1) = (adlerb << 16) | adlera;
171 template <
class Consumer>
178 template <
class Consumer>
184 template <
class Consumer>
189 std::cout <<
" writing to destination dir " << destinationDir <<
" name: " << filename << std::endl;
194 ::gettimeofday(&now,
nullptr);
210 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
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
bool getByToken(EDGetToken token, TypeID const &typeID, BasicHandle &result) const
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)