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 10 of file FRDEventFileWriter.h.

Constructor & Destructor Documentation

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

Definition at line 7 of file FRDEventFileWriter.cc.

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

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

Definition at line 12 of file FRDEventFileWriter.cc.

References initialize().

13 {
15 }
void initialize(std::string const &name)
FRDEventFileWriter::~FRDEventFileWriter ( )

Definition at line 17 of file FRDEventFileWriter.cc.

References ost_.

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

Member Function Documentation

uint32 FRDEventFileWriter::adler32 ( ) const
inline

Definition at line 22 of file FRDEventFileWriter.h.

References adlera_, and adlerb_.

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

Definition at line 22 of file FRDEventFileWriter.cc.

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

23 {
24  ost_->write((const char*) msg.startAddress(), msg.size());
25  if (ost_->fail()) {
26  throw cms::Exception("FRDEventFileWriter", "doOutputEvent")
27  << "Error writing FED Raw Data event data to "
28  << fileName_ << ". Possibly the output disk "
29  << "is full?" << std::endl;
30  }
31 
32  ost_->flush();
33  if (ost_->fail()) {
34  throw cms::Exception("FRDEventFileWriter", "doOutputEvent")
35  << "Error writing FED Raw Data event data to "
36  << fileName_ << ". Possibly the output disk "
37  << "is full?" << std::endl;
38  }
39 
40  cms::Adler32((const char*) msg.startAddress(), msg.size(), adlera_, adlerb_);
41 }
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 43 of file FRDEventFileWriter.cc.

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

45 {
46  ost_->write((const char*) dataPtr, dataSize);
47  if (ost_->fail()) {
48  throw cms::Exception("FRDEventFileWriter", "doOutputEventFragment")
49  << "Error writing FED Raw Data event data to "
50  << fileName_ << ". Possibly the output disk "
51  << "is full?" << std::endl;
52  }
53 
54  ost_->flush();
55  if (ost_->fail()) {
56  throw cms::Exception("FRDEventFileWriter", "doOutputEventFragment")
57  << "Error writing FED Raw Data event data to "
58  << fileName_ << ". Possibly the output disk "
59  << "is full?" << std::endl;
60  }
61 
62  cms::Adler32((const char*) dataPtr, dataSize, adlera_, adlerb_);
63 }
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 65 of file FRDEventFileWriter.cc.

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

Referenced by FRDEventFileWriter().

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

Definition at line 24 of file FRDEventFileWriter.h.

Referenced by progressbar.ProgressBar::__next__().

24 {}
void FRDEventFileWriter::stop ( )
inline

Definition at line 25 of file FRDEventFileWriter.h.

25 {}

Member Data Documentation

uint32 FRDEventFileWriter::adlera_
private

Definition at line 34 of file FRDEventFileWriter.h.

Referenced by adler32(), doOutputEvent(), doOutputEventFragment(), and initialize().

uint32 FRDEventFileWriter::adlerb_
private

Definition at line 35 of file FRDEventFileWriter.h.

Referenced by adler32(), doOutputEvent(), doOutputEventFragment(), and initialize().

std::string FRDEventFileWriter::fileName_
private

Definition at line 32 of file FRDEventFileWriter.h.

Referenced by doOutputEvent(), doOutputEventFragment(), and initialize().

std::auto_ptr<std::ofstream> FRDEventFileWriter::ost_
private