#include <FRDEventFileWriter.h>
Public Member Functions | |
uint32 | adler32 () const |
void | doOutputEvent (FRDEventMsgView const &msg) |
void | doOutputEventFragment (unsigned char *dataPtr, unsigned long dataSize) |
FRDEventFileWriter (std::string const &fileName) | |
FRDEventFileWriter (edm::ParameterSet const &ps) | |
void | start () |
void | stop () |
~FRDEventFileWriter () | |
Private Member Functions | |
void | initialize (std::string const &name) |
Private Attributes | |
uint32 | adlera_ |
uint32 | adlerb_ |
std::string | fileName_ |
std::auto_ptr< std::ofstream > | ost_ |
Definition at line 11 of file FRDEventFileWriter.h.
FRDEventFileWriter::FRDEventFileWriter | ( | edm::ParameterSet const & | ps | ) | [explicit] |
Definition at line 8 of file FRDEventFileWriter.cc.
References edm::ParameterSet::getUntrackedParameter(), and initialize().
{ initialize(ps.getUntrackedParameter<std::string>("fileName", "testFRDfile.dat")); }
FRDEventFileWriter::FRDEventFileWriter | ( | std::string const & | fileName | ) | [explicit] |
Definition at line 13 of file FRDEventFileWriter.cc.
References initialize().
{ initialize(fileName); }
FRDEventFileWriter::~FRDEventFileWriter | ( | ) |
uint32 FRDEventFileWriter::adler32 | ( | ) | const [inline] |
void FRDEventFileWriter::doOutputEvent | ( | FRDEventMsgView const & | msg | ) |
Definition at line 23 of file FRDEventFileWriter.cc.
References cms::Adler32(), adlera_, adlerb_, Exception, fileName_, ost_, FRDEventMsgView::size(), and FRDEventMsgView::startAddress().
{ ost_->write((const char*) msg.startAddress(), msg.size()); if (ost_->fail()) { throw cms::Exception("FRDEventFileWriter", "doOutputEvent") << "Error writing FED Raw Data event data to " << fileName_ << ". Possibly the output disk " << "is full?" << std::endl; } ost_->flush(); if (ost_->fail()) { throw cms::Exception("FRDEventFileWriter", "doOutputEvent") << "Error writing FED Raw Data event data to " << fileName_ << ". Possibly the output disk " << "is full?" << std::endl; } cms::Adler32((const char*) msg.startAddress(), msg.size(), adlera_, adlerb_); }
void FRDEventFileWriter::doOutputEventFragment | ( | unsigned char * | dataPtr, |
unsigned long | dataSize | ||
) |
Definition at line 44 of file FRDEventFileWriter.cc.
References cms::Adler32(), adlera_, adlerb_, Exception, fileName_, and ost_.
{ ost_->write((const char*) dataPtr, dataSize); if (ost_->fail()) { throw cms::Exception("FRDEventFileWriter", "doOutputEventFragment") << "Error writing FED Raw Data event data to " << fileName_ << ". Possibly the output disk " << "is full?" << std::endl; } ost_->flush(); if (ost_->fail()) { throw cms::Exception("FRDEventFileWriter", "doOutputEventFragment") << "Error writing FED Raw Data event data to " << fileName_ << ". Possibly the output disk " << "is full?" << std::endl; } cms::Adler32((const char*) dataPtr, dataSize, adlera_, adlerb_); }
void FRDEventFileWriter::initialize | ( | std::string const & | name | ) | [private] |
Definition at line 66 of file FRDEventFileWriter.cc.
References adlera_, adlerb_, Exception, fileName_, mergeVDriftHistosByStation::name, ost_, and dbtoconf::out.
Referenced by FRDEventFileWriter().
{ fileName_ = name; ost_.reset(new std::ofstream(name.c_str(), std::ios_base::binary | std::ios_base::out)); if (!ost_->is_open()) { throw cms::Exception("FRDEventFileWriter","initialize") << "Error opening FED Raw Data event output file: " << name << "\n"; } adlera_ = 1; adlerb_ = 0; }
void FRDEventFileWriter::start | ( | void | ) | [inline] |
Definition at line 25 of file FRDEventFileWriter.h.
{}
void FRDEventFileWriter::stop | ( | ) | [inline] |
Definition at line 26 of file FRDEventFileWriter.h.
{}
uint32 FRDEventFileWriter::adlera_ [private] |
Definition at line 35 of file FRDEventFileWriter.h.
Referenced by adler32(), doOutputEvent(), doOutputEventFragment(), and initialize().
uint32 FRDEventFileWriter::adlerb_ [private] |
Definition at line 36 of file FRDEventFileWriter.h.
Referenced by adler32(), doOutputEvent(), doOutputEventFragment(), and initialize().
std::string FRDEventFileWriter::fileName_ [private] |
Definition at line 33 of file FRDEventFileWriter.h.
Referenced by doOutputEvent(), doOutputEventFragment(), and initialize().
std::auto_ptr<std::ofstream> FRDEventFileWriter::ost_ [private] |
Definition at line 32 of file FRDEventFileWriter.h.
Referenced by doOutputEvent(), doOutputEventFragment(), initialize(), and ~FRDEventFileWriter().