File indexing completed on 2024-05-31 04:19:42
0001 #include "IOPool/Streamer/src/StreamerFileWriter.h"
0002 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0003
0004 namespace edm::streamer {
0005
0006 StreamerFileWriter::StreamerFileWriter(edm::ParameterSet const& ps)
0007 : stream_writer_(new StreamerOutputFile(ps.getUntrackedParameter<std::string>("fileName"),
0008 ps.getUntrackedParameter<unsigned int>("padding"))) {}
0009
0010 StreamerFileWriter::StreamerFileWriter(std::string const& fileName)
0011 : stream_writer_(new StreamerOutputFile(fileName)) {}
0012
0013 StreamerFileWriter::~StreamerFileWriter() {}
0014
0015 void StreamerFileWriter::doOutputHeader(InitMsgBuilder const& init_message) {
0016
0017 InitMsgView view(init_message.startAddress());
0018 doOutputHeader(view);
0019 }
0020
0021 void StreamerFileWriter::doOutputHeader(InitMsgView const& init_message) {
0022
0023 stream_writer_->write(init_message);
0024 }
0025
0026 void StreamerFileWriter::doOutputEvent(EventMsgView const& msg) {
0027
0028 stream_writer_->write(msg);
0029 }
0030
0031 void StreamerFileWriter::doOutputEvent(EventMsgBuilder const& msg) {
0032 EventMsgView eview(msg.startAddress());
0033 doOutputEvent(eview);
0034 }
0035
0036 void StreamerFileWriter::fillDescription(ParameterSetDescription& desc) {
0037 desc.setComment("Writes events into a streamer output file.");
0038 desc.addUntracked<std::string>("fileName", "teststreamfile.dat")->setComment("Name of output file.");
0039 desc.addUntracked<unsigned int>("padding", 0)
0040 ->setComment("For testing: INIT and event block size will be rounded to this size padded with 0xff bytes.");
0041 }
0042 }