#include <FRDEventOutputModule.h>
Public Member Functions | |
FRDEventOutputModule (edm::ParameterSet const &ps) | |
~FRDEventOutputModule () | |
Private Types | |
typedef unsigned int | uint32 |
Private Member Functions | |
virtual void | beginRun (edm::RunPrincipal const &) |
virtual void | endRun (edm::RunPrincipal const &) |
virtual void | write (edm::EventPrincipal const &e) |
virtual void | writeLuminosityBlock (edm::LuminosityBlockPrincipal const &) |
virtual void | writeRun (edm::RunPrincipal const &) |
Private Attributes | |
std::string | instance_ |
std::string | label_ |
std::auto_ptr< Consumer > | templateConsumer_ |
Definition at line 13 of file FRDEventOutputModule.h.
typedef unsigned int FRDEventOutputModule< Consumer >::uint32 [private] |
Definition at line 15 of file FRDEventOutputModule.h.
FRDEventOutputModule< Consumer >::FRDEventOutputModule | ( | edm::ParameterSet const & | ps | ) | [explicit] |
Consumers are suppose to provide: void doOutputEvent(const FRDEventMsgView& msg) void start() void stop()
Definition at line 40 of file FRDEventOutputModule.h.
: edm::OutputModule(ps), templateConsumer_(new Consumer(ps)), label_(ps.getUntrackedParameter<std::string>("ProductLabel","source")), instance_(ps.getUntrackedParameter<std::string>("ProductInstance","")) { }
FRDEventOutputModule< Consumer >::~FRDEventOutputModule | ( | ) |
Definition at line 49 of file FRDEventOutputModule.h.
{}
void FRDEventOutputModule< Consumer >::beginRun | ( | edm::RunPrincipal const & | ) | [private, virtual] |
Reimplemented from edm::OutputModule.
Definition at line 95 of file FRDEventOutputModule.h.
{ templateConsumer_->start(); }
void FRDEventOutputModule< Consumer >::endRun | ( | edm::RunPrincipal const & | ) | [private, virtual] |
Reimplemented from edm::OutputModule.
Definition at line 101 of file FRDEventOutputModule.h.
{ templateConsumer_->stop(); }
void FRDEventOutputModule< Consumer >::write | ( | edm::EventPrincipal const & | e | ) | [private, virtual] |
Implements edm::OutputModule.
Definition at line 52 of file FRDEventOutputModule.h.
References FEDRawData::data(), idDealer::description, edm::EventID::event(), event(), edm::EventBase::id(), customizeTrackingMonitorSeedNumber::idx, edm::EventBase::luminosityBlock(), lumiQueryAPI::msg, edm::EventID::run(), and FEDRawData::size().
{ // serialize the FEDRawDataCollection into the format that we expect for // FRDEventMsgView objects (may be better ways to do this) edm::Event event(const_cast<edm::EventPrincipal&>(e), description()); edm::Handle<FEDRawDataCollection> fedBuffers; event.getByLabel(label_, instance_, fedBuffers); // determine the expected size of the FRDEvent int expectedSize = (4 + 1024) * sizeof(uint32); for (int idx = 0; idx < 1024; ++idx) { FEDRawData singleFED = fedBuffers->FEDData(idx); expectedSize += singleFED.size(); //if (singleFED.size() > 0) { // std::cout << "FED #" << idx << " size = " << singleFED.size() << std::endl; //} } // build the FRDEvent into a temporary buffer boost::shared_array<unsigned char> workBuffer(new unsigned char[expectedSize + 256]); uint32 *bufPtr = (uint32*) workBuffer.get(); *bufPtr++ = (uint32) 2; // version number *bufPtr++ = (uint32) event.id().run(); *bufPtr++ = (uint32) event.luminosityBlock(); *bufPtr++ = (uint32) event.id().event(); for (int idx = 0; idx < 1024; ++idx) { FEDRawData singleFED = fedBuffers->FEDData(idx); *bufPtr++ = singleFED.size(); } for (int idx = 0; idx < 1024; ++idx) { FEDRawData singleFED = fedBuffers->FEDData(idx); if (singleFED.size() > 0) { memcpy(bufPtr, singleFED.data(), singleFED.size()); *bufPtr += singleFED.size(); } } // create the FRDEventMsgView and use the template consumer to write it out FRDEventMsgView msg(workBuffer.get()); templateConsumer_->doOutputEvent(msg); }
virtual void FRDEventOutputModule< Consumer >::writeLuminosityBlock | ( | edm::LuminosityBlockPrincipal const & | ) | [inline, private, virtual] |
virtual void FRDEventOutputModule< Consumer >::writeRun | ( | edm::RunPrincipal const & | ) | [inline, private, virtual] |
std::string FRDEventOutputModule< Consumer >::instance_ [private] |
Definition at line 36 of file FRDEventOutputModule.h.
std::string FRDEventOutputModule< Consumer >::label_ [private] |
Definition at line 35 of file FRDEventOutputModule.h.
std::auto_ptr<Consumer> FRDEventOutputModule< Consumer >::templateConsumer_ [private] |
Definition at line 34 of file FRDEventOutputModule.h.