#include <IOPool/Streamer/src/StreamerFileWriter.h>
Public Member Functions | |
void | doOutputEvent (EventMsgView const &msg) |
void | doOutputEvent (EventMsgBuilder const &msg) |
void | doOutputHeader (InitMsgView const &init_message) |
void | doOutputHeader (InitMsgBuilder const &init_message) |
uint32 | get_adler32_index () const |
uint32 | get_adler32_stream () const |
uint32 | getIndexEOFSize () const |
uint32 | getStreamEOFSize () const |
void | start () |
void | stop () |
StreamerFileWriter (std::string const &fileName, std::string const &indexFileName) | |
StreamerFileWriter (edm::ParameterSet const &ps) | |
~StreamerFileWriter () | |
Private Member Functions | |
void | updateHLTStats (std::vector< uint8 > const &packedHlt) |
Private Attributes | |
uint32 | hltCount_ |
std::vector< uint32 > | hltStats_ |
uint32 | index_eof_size_ |
std::auto_ptr < StreamerOutputIndexFile > | index_writer_ |
uint32 | stream_eof_size_ |
std::auto_ptr< StreamerOutputFile > | stream_writer_ |
Definition at line 23 of file StreamerFileWriter.h.
edm::StreamerFileWriter::StreamerFileWriter | ( | edm::ParameterSet const & | ps | ) | [explicit] |
Definition at line 7 of file StreamerFileWriter.cc.
00007 : 00008 stream_writer_(new StreamerOutputFile( 00009 ps.getUntrackedParameter<std::string>("fileName","teststreamfile.dat"))), 00010 index_writer_(new StreamerOutputIndexFile( 00011 ps.getUntrackedParameter<std::string>("indexFileName","testindexfile.ind"))), 00012 hltCount_(0), 00013 index_eof_size_(0), 00014 stream_eof_size_(0) 00015 { 00016 }
edm::StreamerFileWriter::StreamerFileWriter | ( | std::string const & | fileName, | |
std::string const & | indexFileName | |||
) | [explicit] |
Definition at line 19 of file StreamerFileWriter.cc.
00019 : 00020 stream_writer_(new StreamerOutputFile(fileName)), 00021 index_writer_(new StreamerOutputIndexFile(indexFileName)), 00022 hltCount_(0), 00023 index_eof_size_(0), 00024 stream_eof_size_(0) 00025 { 00026 }
edm::StreamerFileWriter::~StreamerFileWriter | ( | ) |
void edm::StreamerFileWriter::doOutputEvent | ( | EventMsgView const & | msg | ) |
Definition at line 74 of file StreamerFileWriter.cc.
References hltCount_, EventMsgView::hltTriggerBits(), index_writer_, stream_writer_, and updateHLTStats().
00075 { 00076 //Write the Event Message to Streamer file 00077 uint64 event_offset = stream_writer_->write(msg); 00078 00079 index_writer_->write(msg, event_offset); 00080 00081 // Lets update HLT Stat, know how many 00082 // Events for which Trigger are being written 00083 00084 //get the HLT Packed bytes 00085 std::vector<uint8> packedHlt; 00086 uint32 hlt_sz = 0; 00087 if (hltCount_ != 0) hlt_sz = 1 + ((hltCount_-1)/4); 00088 packedHlt.resize(hlt_sz); 00089 msg.hltTriggerBits(&packedHlt[0]); 00090 updateHLTStats(packedHlt); 00091 }
void edm::StreamerFileWriter::doOutputEvent | ( | EventMsgBuilder const & | msg | ) |
Definition at line 94 of file StreamerFileWriter.cc.
References EventMsgBuilder::startAddress().
00095 { 00096 00097 EventMsgView eview(msg.startAddress()); 00098 doOutputEvent(eview); 00099 00100 }
void edm::StreamerFileWriter::doOutputHeader | ( | InitMsgView const & | init_message | ) |
Definition at line 54 of file StreamerFileWriter.cc.
References InitMsgView::get_hlt_bit_cnt(), hltCount_, hltStats_, i, index_writer_, and stream_writer_.
00055 { 00056 00057 //Write the Init Message to Streamer file 00058 stream_writer_->write(init_message); 00059 00060 uint32 magic = 22; 00061 uint64 reserved = 666; 00062 index_writer_->writeIndexFileHeader(magic, reserved); 00063 index_writer_->write(init_message); 00064 00065 //HLT Count 00066 hltCount_ = init_message.get_hlt_bit_cnt(); 00067 00068 //Initialize the HLT Stat vector with all ZEROs 00069 for(uint32 i = 0; i != hltCount_; ++i) 00070 hltStats_.push_back(0); 00071 }
void edm::StreamerFileWriter::doOutputHeader | ( | InitMsgBuilder const & | init_message | ) |
Definition at line 46 of file StreamerFileWriter.cc.
References InitMsgBuilder::startAddress().
00047 { 00048 00049 //Let us turn it into a View 00050 InitMsgView view(init_message.startAddress()); 00051 doOutputHeader(view); 00052 00053 }
uint32 edm::StreamerFileWriter::get_adler32_index | ( | ) | const [inline] |
Definition at line 47 of file StreamerFileWriter.h.
References index_writer_.
00047 { return index_writer_->adler32();}
uint32 edm::StreamerFileWriter::get_adler32_stream | ( | ) | const [inline] |
Definition at line 46 of file StreamerFileWriter.h.
References stream_writer_.
00046 { return stream_writer_->adler32();}
uint32 edm::StreamerFileWriter::getIndexEOFSize | ( | ) | const [inline] |
Definition at line 44 of file StreamerFileWriter.h.
References index_eof_size_.
00044 {return index_eof_size_;}
uint32 edm::StreamerFileWriter::getStreamEOFSize | ( | ) | const [inline] |
Definition at line 43 of file StreamerFileWriter.h.
References stream_eof_size_.
00043 {return stream_eof_size_;}
void edm::StreamerFileWriter::stop | ( | ) |
Definition at line 33 of file StreamerFileWriter.cc.
References hltStats_, index_eof_size_, index_writer_, stream_eof_size_, and stream_writer_.
00034 { 00035 00036 // User code of this class MUST call method 00037 00038 //Write the EOF Record Both at the end of Streamer file and Index file 00039 uint32 dummyStatusCode = 1234; 00040 00041 index_eof_size_ = index_writer_->writeEOF(dummyStatusCode, hltStats_); 00042 stream_eof_size_ = stream_writer_->writeEOF(dummyStatusCode, hltStats_); 00043 00044 }
Definition at line 103 of file StreamerFileWriter.cc.
References hltCount_, hltStats_, and i.
Referenced by doOutputEvent().
00104 { 00105 unsigned int packInOneByte = 4; 00106 unsigned char testAgaint = 0x01; 00107 for(unsigned int i = 0; i != hltCount_; ++i) 00108 { 00109 unsigned int whichByte = i/packInOneByte; 00110 unsigned int indxWithinByte = i % packInOneByte; 00111 if ((testAgaint << (2 * indxWithinByte)) & (packedHlt.at(whichByte))) { 00112 ++hltStats_[i]; 00113 } 00114 //else std::cout <<"Bit "<<i<<" is not set"<< std::endl; 00115 } 00116 }
uint32 edm::StreamerFileWriter::hltCount_ [private] |
Definition at line 54 of file StreamerFileWriter.h.
Referenced by doOutputEvent(), doOutputHeader(), and updateHLTStats().
std::vector<uint32> edm::StreamerFileWriter::hltStats_ [private] |
Definition at line 55 of file StreamerFileWriter.h.
Referenced by doOutputHeader(), stop(), and updateHLTStats().
std::auto_ptr<StreamerOutputIndexFile> edm::StreamerFileWriter::index_writer_ [private] |
Definition at line 53 of file StreamerFileWriter.h.
Referenced by doOutputEvent(), doOutputHeader(), get_adler32_index(), and stop().
std::auto_ptr<StreamerOutputFile> edm::StreamerFileWriter::stream_writer_ [private] |
Definition at line 52 of file StreamerFileWriter.h.
Referenced by doOutputEvent(), doOutputHeader(), get_adler32_stream(), and stop().