CMS 3D CMS Logo

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

#include <StreamerFileWriter.h>

Public Member Functions

void doOutputEvent (EventMsgBuilder const &msg)
 
void doOutputEvent (EventMsgView const &msg)
 
void doOutputEventFragment (StreamerFileWriterEventParams const &)
 
void doOutputHeader (InitMsgBuilder const &init_message)
 
void doOutputHeader (InitMsgView const &init_message)
 
void doOutputHeaderFragment (StreamerFileWriterHeaderParams const &)
 
uint32 get_adler32 () const
 
uint32 getStreamEOFSize () const
 
void start ()
 
void stop ()
 
 StreamerFileWriter (edm::ParameterSet const &ps)
 
 StreamerFileWriter (std::string const &fileName)
 
 ~StreamerFileWriter ()
 

Static Public Member Functions

static void fillDescription (ParameterSetDescription &desc)
 

Private Member Functions

void updateHLTStats (std::vector< uint8 > const &packedHlt)
 

Private Attributes

uint32 hltCount_
 
std::vector< uint32hltStats_
 
uint32 stream_eof_size_
 
std::auto_ptr< StreamerOutputFilestream_writer_
 

Detailed Description

Definition at line 46 of file StreamerFileWriter.h.

Constructor & Destructor Documentation

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

Definition at line 5 of file StreamerFileWriter.cc.

5  :
7  ps.getUntrackedParameter<std::string>("fileName"))),
8  hltCount_(0),
10  }
std::auto_ptr< StreamerOutputFile > stream_writer_
edm::StreamerFileWriter::StreamerFileWriter ( std::string const &  fileName)
explicit

Definition at line 12 of file StreamerFileWriter.cc.

edm::StreamerFileWriter::~StreamerFileWriter ( )

Definition at line 18 of file StreamerFileWriter.cc.

18  {
19  }

Member Function Documentation

void edm::StreamerFileWriter::doOutputEvent ( EventMsgBuilder const &  msg)

Definition at line 81 of file StreamerFileWriter.cc.

References EventMsgBuilder::startAddress().

81  {
82  EventMsgView eview(msg.startAddress());
83  doOutputEvent(eview);
84  }
void doOutputEvent(EventMsgBuilder const &msg)
void edm::StreamerFileWriter::doOutputEvent ( EventMsgView const &  msg)

Definition at line 66 of file StreamerFileWriter.cc.

References hltCount_, EventMsgView::hltTriggerBits(), stream_writer_, and updateHLTStats().

66  {
67  //Write the Event Message to Streamer file
68  stream_writer_->write(msg);
69 
70  // Lets update HLT Stat, know how many
71  // Events for which Trigger are being written
72 
73  //get the HLT Packed bytes
74  std::vector<uint8> packedHlt;
75  uint32 const hlt_sz = (hltCount_ != 0 ? 1 + ((hltCount_ - 1) / 4) : 0);
76  packedHlt.resize(hlt_sz);
77  msg.hltTriggerBits(&packedHlt[0]);
78  updateHLTStats(packedHlt);
79  }
unsigned int uint32
Definition: MsgTools.h:13
void updateHLTStats(std::vector< uint8 > const &packedHlt)
std::auto_ptr< StreamerOutputFile > stream_writer_
void edm::StreamerFileWriter::doOutputEventFragment ( StreamerFileWriterEventParams const &  evtParams)

Definition at line 86 of file StreamerFileWriter.cc.

References edm::StreamerFileWriterEventParams::dataPtr, edm::StreamerFileWriterEventParams::dataSize, edm::StreamerFileWriterEventParams::fragmentCount, edm::StreamerFileWriterEventParams::fragmentIndex, edm::StreamerFileWriterEventParams::hltBits, stream_writer_, and updateHLTStats().

86  {
87  //Write the Event Message to Streamer file
88  stream_writer_->writeEventFragment(evtParams.fragmentIndex,
89  evtParams.fragmentCount,
90  evtParams.dataPtr,
91  evtParams.dataSize);
92  if (evtParams.fragmentIndex == 0) {
93  // Lets update HLT Stat, know how many
94  // Events for which Trigger are being written
95  updateHLTStats(evtParams.hltBits);
96  }
97  }
void updateHLTStats(std::vector< uint8 > const &packedHlt)
std::auto_ptr< StreamerOutputFile > stream_writer_
void edm::StreamerFileWriter::doOutputHeader ( InitMsgBuilder const &  init_message)

Definition at line 30 of file StreamerFileWriter.cc.

References InitMsgBuilder::startAddress().

30  {
31  //Let us turn it into a View
32  InitMsgView view(init_message.startAddress());
33  doOutputHeader(view);
34  }
void doOutputHeader(InitMsgBuilder const &init_message)
void edm::StreamerFileWriter::doOutputHeader ( InitMsgView const &  init_message)

Definition at line 36 of file StreamerFileWriter.cc.

References InitMsgView::get_hlt_bit_cnt(), hltCount_, hltStats_, i, and stream_writer_.

36  {
37  //Write the Init Message to Streamer file
38  stream_writer_->write(init_message);
39 
40  //HLT Count
41  hltCount_ = init_message.get_hlt_bit_cnt();
42 
43  //Initialize the HLT Stat vector with all ZEROs
44  for(uint32 i = 0; i != hltCount_; ++i) {
45  hltStats_.push_back(0);
46  }
47  }
int i
Definition: DBlmapReader.cc:9
std::vector< uint32 > hltStats_
unsigned int uint32
Definition: MsgTools.h:13
std::auto_ptr< StreamerOutputFile > stream_writer_
void edm::StreamerFileWriter::doOutputHeaderFragment ( StreamerFileWriterHeaderParams const &  hdrParams)

Definition at line 49 of file StreamerFileWriter.cc.

References edm::StreamerFileWriterHeaderParams::dataPtr, edm::StreamerFileWriterHeaderParams::dataSize, edm::StreamerFileWriterHeaderParams::fragmentCount, edm::StreamerFileWriterHeaderParams::fragmentIndex, edm::StreamerFileWriterHeaderParams::hltCount, hltCount_, hltStats_, i, and stream_writer_.

49  {
50  //Write the Init Message to Streamer file
51  stream_writer_->writeInitFragment(hdrParams.fragmentIndex,
52  hdrParams.fragmentCount,
53  hdrParams.dataPtr,
54  hdrParams.dataSize);
55  if (hdrParams.fragmentIndex == 0) {
56  //HLT Count
57  hltCount_ = hdrParams.hltCount;
58 
59  //Initialize the HLT Stat vector with all ZEROs
60  for(uint32 i = 0; i != hltCount_; ++i) {
61  hltStats_.push_back(0);
62  }
63  }
64  }
int i
Definition: DBlmapReader.cc:9
std::vector< uint32 > hltStats_
unsigned int uint32
Definition: MsgTools.h:13
std::auto_ptr< StreamerOutputFile > stream_writer_
void edm::StreamerFileWriter::fillDescription ( ParameterSetDescription desc)
static

Definition at line 112 of file StreamerFileWriter.cc.

References edm::ParameterSetDescription::addUntracked(), edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

112  {
113  desc.setComment("Writes events into a streamer output file.");
114  desc.addUntracked<std::string>("fileName", "teststreamfile.dat")->setComment("Name of output file.");
115  }
uint32 edm::StreamerFileWriter::get_adler32 ( ) const
inline

Definition at line 70 of file StreamerFileWriter.h.

References stream_writer_.

70 { return stream_writer_->adler32();}
std::auto_ptr< StreamerOutputFile > stream_writer_
uint32 edm::StreamerFileWriter::getStreamEOFSize ( ) const
inline

Definition at line 68 of file StreamerFileWriter.h.

References stream_eof_size_.

void edm::StreamerFileWriter::start ( void  )
inline

Definition at line 64 of file StreamerFileWriter.h.

Referenced by progressbar.ProgressBar::__next__().

64 {}
void edm::StreamerFileWriter::stop ( )

Definition at line 21 of file StreamerFileWriter.cc.

References hltStats_, stream_eof_size_, and stream_writer_.

21  {
22  // User code of this class MUST call method
23 
24  //Write the EOF Record Both at the end of Streamer file
25  uint32 const dummyStatusCode = 1234;
26 
27  stream_eof_size_ = stream_writer_->writeEOF(dummyStatusCode, hltStats_);
28  }
std::vector< uint32 > hltStats_
unsigned int uint32
Definition: MsgTools.h:13
std::auto_ptr< StreamerOutputFile > stream_writer_
void edm::StreamerFileWriter::updateHLTStats ( std::vector< uint8 > const &  packedHlt)
private

Definition at line 99 of file StreamerFileWriter.cc.

References hltCount_, hltStats_, and i.

Referenced by doOutputEvent(), and doOutputEventFragment().

99  {
100  unsigned int const packInOneByte = 4;
101  unsigned char const testAgaint = 0x01;
102  for(unsigned int i = 0; i != hltCount_; ++i) {
103  unsigned int const whichByte = i/packInOneByte;
104  unsigned int const indxWithinByte = i % packInOneByte;
105  if ((testAgaint << (2 * indxWithinByte)) & (packedHlt.at(whichByte))) {
106  ++hltStats_[i];
107  }
108  //else std::cout <<"Bit "<<i<<" is not set"<< std::endl;
109  }
110  }
int i
Definition: DBlmapReader.cc:9
std::vector< uint32 > hltStats_

Member Data Documentation

uint32 edm::StreamerFileWriter::hltCount_
private
std::vector<uint32> edm::StreamerFileWriter::hltStats_
private

Definition at line 77 of file StreamerFileWriter.h.

Referenced by doOutputHeader(), doOutputHeaderFragment(), stop(), and updateHLTStats().

uint32 edm::StreamerFileWriter::stream_eof_size_
private

Definition at line 78 of file StreamerFileWriter.h.

Referenced by getStreamEOFSize(), and stop().

std::auto_ptr<StreamerOutputFile> edm::StreamerFileWriter::stream_writer_
private