CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
FRDEventFileWriter Class Reference

#include <FRDEventFileWriter.h>

Public Member Functions

uint32 adler32 () const
 
void doOutputEvent (FRDEventMsgView const &msg)
 
void doOutputEventFragment (unsigned char *dataPtr, unsigned long dataSize)
 
 FRDEventFileWriter (edm::ParameterSet const &ps)
 
 FRDEventFileWriter (std::string const &fileName)
 
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_
 

Detailed Description

Definition at line 11 of file FRDEventFileWriter.h.

Constructor & Destructor Documentation

FRDEventFileWriter::FRDEventFileWriter ( edm::ParameterSet const &  ps)
explicit

Definition at line 8 of file FRDEventFileWriter.cc.

References edm::ParameterSet::getUntrackedParameter(), and initialize().

9 {
10  initialize(ps.getUntrackedParameter<std::string>("fileName", "testFRDfile.dat"));
11 }
void initialize(std::string const &name)
FRDEventFileWriter::FRDEventFileWriter ( std::string const &  fileName)
explicit

Definition at line 13 of file FRDEventFileWriter.cc.

References initialize().

14 {
16 }
void initialize(std::string const &name)
FRDEventFileWriter::~FRDEventFileWriter ( )

Definition at line 18 of file FRDEventFileWriter.cc.

References ost_.

19 {
20  ost_->close();
21 }
std::auto_ptr< std::ofstream > ost_

Member Function Documentation

uint32 FRDEventFileWriter::adler32 ( ) const
inline

Definition at line 23 of file FRDEventFileWriter.h.

References adlera_, and adlerb_.

23 { return (adlerb_ << 16) | adlera_; }
void FRDEventFileWriter::doOutputEvent ( FRDEventMsgView const &  msg)

Definition at line 23 of file FRDEventFileWriter.cc.

References cms::Adler32(), adlera_, adlerb_, edm::hlt::Exception, fileName_, ost_, FRDEventMsgView::size(), and FRDEventMsgView::startAddress().

24 {
25  ost_->write((const char*) msg.startAddress(), msg.size());
26  if (ost_->fail()) {
27  throw cms::Exception("FRDEventFileWriter", "doOutputEvent")
28  << "Error writing FED Raw Data event data to "
29  << fileName_ << ". Possibly the output disk "
30  << "is full?" << std::endl;
31  }
32 
33  ost_->flush();
34  if (ost_->fail()) {
35  throw cms::Exception("FRDEventFileWriter", "doOutputEvent")
36  << "Error writing FED Raw Data event data to "
37  << fileName_ << ". Possibly the output disk "
38  << "is full?" << std::endl;
39  }
40 
41  cms::Adler32((const char*) msg.startAddress(), msg.size(), adlera_, adlerb_);
42 }
std::auto_ptr< std::ofstream > ost_
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
void FRDEventFileWriter::doOutputEventFragment ( unsigned char *  dataPtr,
unsigned long  dataSize 
)

Definition at line 44 of file FRDEventFileWriter.cc.

References cms::Adler32(), adlera_, adlerb_, edm::hlt::Exception, fileName_, and ost_.

46 {
47  ost_->write((const char*) dataPtr, dataSize);
48  if (ost_->fail()) {
49  throw cms::Exception("FRDEventFileWriter", "doOutputEventFragment")
50  << "Error writing FED Raw Data event data to "
51  << fileName_ << ". Possibly the output disk "
52  << "is full?" << std::endl;
53  }
54 
55  ost_->flush();
56  if (ost_->fail()) {
57  throw cms::Exception("FRDEventFileWriter", "doOutputEventFragment")
58  << "Error writing FED Raw Data event data to "
59  << fileName_ << ". Possibly the output disk "
60  << "is full?" << std::endl;
61  }
62 
63  cms::Adler32((const char*) dataPtr, dataSize, adlera_, adlerb_);
64 }
std::auto_ptr< std::ofstream > ost_
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
void FRDEventFileWriter::initialize ( std::string const &  name)
private

Definition at line 66 of file FRDEventFileWriter.cc.

References adlera_, adlerb_, edm::hlt::Exception, fileName_, mergeVDriftHistosByStation::name, ost_, and dbtoconf::out.

Referenced by FRDEventFileWriter().

67 {
68  fileName_ = name;
69  ost_.reset(new std::ofstream(name.c_str(), std::ios_base::binary | std::ios_base::out));
70 
71  if (!ost_->is_open()) {
72  throw cms::Exception("FRDEventFileWriter","initialize")
73  << "Error opening FED Raw Data event output file: " << name << "\n";
74  }
75 
76  adlera_ = 1;
77  adlerb_ = 0;
78 }
std::auto_ptr< std::ofstream > ost_
tuple out
Definition: dbtoconf.py:99
void FRDEventFileWriter::start ( void  )
inline

Definition at line 25 of file FRDEventFileWriter.h.

Referenced by progressbar.ProgressBar::__next__().

25 {}
void FRDEventFileWriter::stop ( )
inline

Definition at line 26 of file FRDEventFileWriter.h.

26 {}

Member Data Documentation

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