#include <FUShmOutputModule.h>
Public Member Functions | |
void | doOutputEvent (EventMsgBuilder const &eventMessage) |
void | doOutputHeader (InitMsgBuilder const &initMessage) |
FUShmOutputModule (edm::ParameterSet const &ps) | |
unsigned int | getCounts () |
void | start () |
void | stop () |
~FUShmOutputModule () | |
Static Public Member Functions | |
static void | fillDescription (ParameterSetDescription &) |
Private Attributes | |
unsigned int | count_ |
std::string | name_ |
evf::FUShmBuffer * | shmBuffer_ |
Static Private Attributes | |
static uint32 | fuGuidValue_ = 0 |
static bool | fuIdsInitialized_ = false |
Definition at line 51 of file FUShmOutputModule.h.
edm::FUShmOutputModule::FUShmOutputModule | ( | edm::ParameterSet const & | ps | ) |
Definition at line 45 of file FUShmOutputModule.cc.
References FDEBUG, fuGuidValue_, fuIdsInitialized_, dttmaxenums::L, name_, and edm::Guid::toString().
: shmBuffer_(0) , name_(ps.getParameter<std::string>( "@module_label" )) , count_(0) { FDEBUG(9) << "FUShmOutputModule: constructor" << endl; if(edm::Service<evf::ShmOutputModuleRegistry>()) edm::Service<evf::ShmOutputModuleRegistry>()->registerModule(name_, this); if (! fuIdsInitialized_) { fuIdsInitialized_ = true; edm::Guid guidObj(true); std::string guidString = guidObj.toString(); uLong crc = crc32(0L, Z_NULL, 0); Bytef* buf = (Bytef*)guidString.data(); crc = crc32(crc, buf, guidString.length()); fuGuidValue_ = crc; } }
edm::FUShmOutputModule::~FUShmOutputModule | ( | ) |
Definition at line 66 of file FUShmOutputModule.cc.
References SM_SharedMemoryHandle::detachShmBuffer(), FDEBUG, and sm_sharedmemory.
{ FDEBUG(9) << "FUShmOutputModule: FUShmOutputModule destructor" << endl; sm_sharedmemory.detachShmBuffer(); //shmdt(shmBuffer_); }
void edm::FUShmOutputModule::doOutputEvent | ( | EventMsgBuilder const & | eventMessage | ) |
Definition at line 96 of file FUShmOutputModule.cc.
References count_, FDEBUG, fuGuidValue_, SM_SharedMemoryHandle::getShmBuffer(), runTheMatrix::ret, EventMsgView::run(), shmBuffer_, findQualityFiles::size, EventMsgBuilder::size(), sm_sharedmemory, EventMsgBuilder::startAddress(), and evf::FUShmBuffer::writeRecoEventData().
{ if(!shmBuffer_) edm::LogError("FUShmOutputModule") << " Invalid shared memory buffer at first event" << " Make sure you configure the ResourceBroker before the FUEventProcessor! " << " No event is sent - this is fatal! Should throw here"; else { count_++; unsigned char* buffer = (unsigned char*) eventMessage.startAddress(); unsigned int size = eventMessage.size(); EventMsgView eventView(eventMessage.startAddress()); unsigned int runid = eventView.run(); unsigned int eventid = eventView.event(); unsigned int outModId = eventView.outModId(); FDEBUG(10) << "FUShmOutputModule: event size = " << size << std::endl; //bool ret = shmBuffer_->writeRecoEventData(runid, eventid, outModId, buffer, size); bool ret = sm_sharedmemory.getShmBuffer()->writeRecoEventData(runid, eventid, outModId, getpid(), fuGuidValue_, buffer, size); if(!ret) edm::LogError("FUShmOutputModule") << " Error with writing data to ShmBuffer"; } }
void edm::FUShmOutputModule::doOutputHeader | ( | InitMsgBuilder const & | initMessage | ) |
Definition at line 73 of file FUShmOutputModule.cc.
References count_, FDEBUG, fuGuidValue_, SM_SharedMemoryHandle::getShmBuffer(), InitMsgView::outputModuleId(), runTheMatrix::ret, shmBuffer_, findQualityFiles::size, InitMsgBuilder::size(), sm_sharedmemory, InitMsgBuilder::startAddress(), and evf::FUShmBuffer::writeRecoInitMsg().
{ count_ = 0; if(!shmBuffer_) shmBuffer_ = sm_sharedmemory.getShmBuffer(); if(!shmBuffer_) edm::LogError("FUShmOutputModule") << " Error getting shared memory buffer for INIT. " << " Make sure you configure the ResourceBroker before the FUEventProcessor! " << " No INIT is sent - this is probably fatal!"; if(shmBuffer_) { unsigned char* buffer = (unsigned char*) initMessage.startAddress(); unsigned int size = initMessage.size(); FDEBUG(10) << "writing out INIT message with size = " << size << std::endl; // no method in InitMsgBuilder to get the output module id, recast InitMsgView dummymsg(buffer); uint32 dmoduleId = dummymsg.outputModuleId(); //bool ret = shmBuffer_->writeRecoInitMsg(dmoduleId, buffer, size); bool ret = sm_sharedmemory.getShmBuffer()->writeRecoInitMsg(dmoduleId, getpid(), fuGuidValue_, buffer, size); if(!ret) edm::LogError("FUShmOutputModule") << " Error writing preamble to ShmBuffer"; } }
static void edm::FUShmOutputModule::fillDescription | ( | ParameterSetDescription & | ) | [inline, static] |
Definition at line 66 of file FUShmOutputModule.h.
{}
unsigned int edm::FUShmOutputModule::getCounts | ( | ) | [inline] |
Definition at line 60 of file FUShmOutputModule.h.
References count_.
Referenced by evf::fuep::TriggerReportHelpers::packTriggerReport(), and evf::FWEPWrapper::taskWebPage().
{ return count_; }
void edm::FUShmOutputModule::start | ( | void | ) |
Definition at line 118 of file FUShmOutputModule.cc.
References SM_SharedMemoryHandle::getShmBuffer(), shmBuffer_, and sm_sharedmemory.
{ //shmBuffer_ = evf::FUShmBuffer::getShmBuffer(); shmBuffer_ = sm_sharedmemory.getShmBuffer(); if(0==shmBuffer_) edm::LogError("FUShmOutputModule")<<"Failed to attach to shared memory"; }
void edm::FUShmOutputModule::stop | ( | ) |
Definition at line 126 of file FUShmOutputModule.cc.
References SM_SharedMemoryHandle::detachShmBuffer(), FDEBUG, shmBuffer_, and sm_sharedmemory.
{ FDEBUG(9) << "FUShmOutputModule: sending terminate run" << std::endl; if(0!=shmBuffer_){ sm_sharedmemory.detachShmBuffer(); //shmdt(shmBuffer_); shmBuffer_ = 0; } }
unsigned int edm::FUShmOutputModule::count_ [private] |
Definition at line 72 of file FUShmOutputModule.h.
Referenced by doOutputEvent(), doOutputHeader(), and getCounts().
uint32 edm::FUShmOutputModule::fuGuidValue_ = 0 [static, private] |
Definition at line 75 of file FUShmOutputModule.h.
Referenced by doOutputEvent(), doOutputHeader(), and FUShmOutputModule().
bool edm::FUShmOutputModule::fuIdsInitialized_ = false [static, private] |
Initialize the static variables for the filter unit identifiers.
Definition at line 74 of file FUShmOutputModule.h.
Referenced by FUShmOutputModule().
std::string edm::FUShmOutputModule::name_ [private] |
Definition at line 71 of file FUShmOutputModule.h.
Referenced by FUShmOutputModule().
Definition at line 70 of file FUShmOutputModule.h.
Referenced by doOutputEvent(), doOutputHeader(), start(), and stop().