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 Attributes | Static Private Attributes
edm::FUShmOutputModule Class Reference

#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::FUShmBuffershmBuffer_
 

Static Private Attributes

static uint32 fuGuidValue_ = 0
 
static bool fuIdsInitialized_ = false
 

Detailed Description

Definition at line 51 of file FUShmOutputModule.h.

Constructor & Destructor Documentation

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().

45  :
46  shmBuffer_(0)
47  , name_(ps.getParameter<std::string>( "@module_label" ))
48  , count_(0)
49  {
50  FDEBUG(9) << "FUShmOutputModule: constructor" << endl;
52  edm::Service<evf::ShmOutputModuleRegistry>()->registerModule(name_, this);
53  if (! fuIdsInitialized_) {
54  fuIdsInitialized_ = true;
55 
56  edm::Guid guidObj(true);
57  std::string guidString = guidObj.toString();
58 
59  uLong crc = crc32(0L, Z_NULL, 0);
60  Bytef* buf = (Bytef*)guidString.data();
61  crc = crc32(crc, buf, guidString.length());
62  fuGuidValue_ = crc;
63  }
64  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
Definition: Guid.h:23
evf::FUShmBuffer * shmBuffer_
edm::FUShmOutputModule::~FUShmOutputModule ( )

Definition at line 66 of file FUShmOutputModule.cc.

References SM_SharedMemoryHandle::detachShmBuffer(), FDEBUG, and sm_sharedmemory.

67  {
68  FDEBUG(9) << "FUShmOutputModule: FUShmOutputModule destructor" << endl;
70  //shmdt(shmBuffer_);
71  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
static SM_SharedMemoryHandle sm_sharedmemory

Member Function Documentation

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_, EventMsgBuilder::size(), findQualityFiles::size, sm_sharedmemory, EventMsgBuilder::startAddress(), and evf::FUShmBuffer::writeRecoEventData().

97  {
98  if(!shmBuffer_) edm::LogError("FUShmOutputModule")
99  << " Invalid shared memory buffer at first event"
100  << " Make sure you configure the ResourceBroker before the FUEventProcessor! "
101  << " No event is sent - this is fatal! Should throw here";
102  else
103  {
104  count_++;
105  unsigned char* buffer = (unsigned char*) eventMessage.startAddress();
106  unsigned int size = eventMessage.size();
107  EventMsgView eventView(eventMessage.startAddress());
108  unsigned int runid = eventView.run();
109  unsigned int eventid = eventView.event();
110  unsigned int outModId = eventView.outModId();
111  FDEBUG(10) << "FUShmOutputModule: event size = " << size << std::endl;
112  //bool ret = shmBuffer_->writeRecoEventData(runid, eventid, outModId, buffer, size);
113  bool ret = sm_sharedmemory.getShmBuffer()->writeRecoEventData(runid, eventid, outModId, getpid(), fuGuidValue_, buffer, size);
114  if(!ret) edm::LogError("FUShmOutputModule") << " Error with writing data to ShmBuffer";
115  }
116  }
bool writeRecoEventData(unsigned int runNumber, unsigned int evtNumber, unsigned int outModId, unsigned int fuProcessId, unsigned int fuGuid, unsigned char *data, unsigned int dataSize)
Definition: FUShmBuffer.cc:670
#define FDEBUG(lev)
Definition: DebugMacros.h:18
uint32 run() const
Definition: EventMessage.cc:73
evf::FUShmBuffer * getShmBuffer()
static SM_SharedMemoryHandle sm_sharedmemory
tuple size
Write out results.
evf::FUShmBuffer * 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_, InitMsgBuilder::size(), findQualityFiles::size, sm_sharedmemory, InitMsgBuilder::startAddress(), and evf::FUShmBuffer::writeRecoInitMsg().

74  {
75  count_ = 0;
77  if(!shmBuffer_) edm::LogError("FUShmOutputModule")
78  << " Error getting shared memory buffer for INIT. "
79  << " Make sure you configure the ResourceBroker before the FUEventProcessor! "
80  << " No INIT is sent - this is probably fatal!";
81  if(shmBuffer_)
82  {
83  unsigned char* buffer = (unsigned char*) initMessage.startAddress();
84  unsigned int size = initMessage.size();
85  FDEBUG(10) << "writing out INIT message with size = " << size << std::endl;
86  // no method in InitMsgBuilder to get the output module id, recast
87  InitMsgView dummymsg(buffer);
88  uint32 dmoduleId = dummymsg.outputModuleId();
89 
90  //bool ret = shmBuffer_->writeRecoInitMsg(dmoduleId, buffer, size);
91  bool ret = sm_sharedmemory.getShmBuffer()->writeRecoInitMsg(dmoduleId, getpid(), fuGuidValue_, buffer, size);
92  if(!ret) edm::LogError("FUShmOutputModule") << " Error writing preamble to ShmBuffer";
93  }
94  }
bool writeRecoInitMsg(unsigned int outModId, unsigned int fuProcessId, unsigned int fuGuid, unsigned char *data, unsigned int dataSize)
Definition: FUShmBuffer.cc:647
#define FDEBUG(lev)
Definition: DebugMacros.h:18
evf::FUShmBuffer * getShmBuffer()
unsigned int uint32
Definition: MsgTools.h:13
static SM_SharedMemoryHandle sm_sharedmemory
tuple size
Write out results.
evf::FUShmBuffer * shmBuffer_
static void edm::FUShmOutputModule::fillDescription ( ParameterSetDescription )
inlinestatic

Definition at line 66 of file FUShmOutputModule.h.

66 {}
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().

60  {
61  return count_;
62  }
void edm::FUShmOutputModule::start ( void  )

Definition at line 118 of file FUShmOutputModule.cc.

References SM_SharedMemoryHandle::getShmBuffer(), shmBuffer_, and sm_sharedmemory.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

119  {
120  //shmBuffer_ = evf::FUShmBuffer::getShmBuffer();
122  if(0==shmBuffer_)
123  edm::LogError("FUShmOutputModule")<<"Failed to attach to shared memory";
124  }
evf::FUShmBuffer * getShmBuffer()
static SM_SharedMemoryHandle sm_sharedmemory
evf::FUShmBuffer * shmBuffer_
void edm::FUShmOutputModule::stop ( )

Definition at line 126 of file FUShmOutputModule.cc.

References SM_SharedMemoryHandle::detachShmBuffer(), FDEBUG, shmBuffer_, and sm_sharedmemory.

127  {
128  FDEBUG(9) << "FUShmOutputModule: sending terminate run" << std::endl;
129  if(0!=shmBuffer_){
131  //shmdt(shmBuffer_);
132  shmBuffer_ = 0;
133  }
134  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
static SM_SharedMemoryHandle sm_sharedmemory
evf::FUShmBuffer * shmBuffer_

Member Data Documentation

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
staticprivate

Definition at line 75 of file FUShmOutputModule.h.

Referenced by doOutputEvent(), doOutputHeader(), and FUShmOutputModule().

bool edm::FUShmOutputModule::fuIdsInitialized_ = false
staticprivate

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().

evf::FUShmBuffer* edm::FUShmOutputModule::shmBuffer_
private

Definition at line 70 of file FUShmOutputModule.h.

Referenced by doOutputEvent(), doOutputHeader(), start(), and stop().