CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EvFRecordInserter.cc
Go to the documentation of this file.
1 #include "EvFRecordInserter.h"
2 
6 
7 #include <sys/time.h>
8 
9 
10 namespace evf{
11 
13  : evc_(0)
14  , ehi_(0LL)
15  , last_(0)
16  , label_(pset.getParameter<edm::InputTag>("inputTag"))
17  {}
19  {
21  e.getByLabel(label_,rawdata);
22  unsigned int id = fedinterface::EVFFED_ID;
23  const FEDRawData& data = rawdata->FEDData(id);
24  size_t size=data.size();
25  unsigned char * cdata = const_cast<unsigned char*>(data.data());
26  timeval now;
27  gettimeofday(&now,0);
28  evc_++;
29  uint32_t ldiff = 0;
30  if(e.id().event()-last_ < 0xff)
31  ldiff = e.id().event()-last_;
32  else
33  ldiff = 0xff;
34  ehi_ = (ehi_<<8)+(uint64_t)ldiff;
35  last_ = e.id().event();
36  if(size>0){
37  ef_.setEPTimeStamp(((uint64_t)(now.tv_sec) << 32)
38  + (uint64_t)(now.tv_usec),cdata);
39 
40  ef_.setEPProcessId(getpid(),cdata);
41  ef_.setEPEventId(e.id().event(), cdata);
42  ef_.setEPEventCount(evc_, cdata);
43  ef_.setEPEventHisto(ehi_, cdata);
44  }
45  }
46 
47 
48 } // end namespace evf
EventNumber_t event() const
Definition: EventID.h:41
void setEPEventId(uint32_t eid, unsigned char *payload)
const unsigned int EVFFED_ID
Definition: FED1023.h:28
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
EvFRecordInserter(const edm::ParameterSet &)
void setEPProcessId(pid_t pid, unsigned char *payload)
void setEPTimeStamp(uint64_t ts, unsigned char *payload)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
void setEPEventCount(uint32_t evc, unsigned char *payload)
unsigned long long uint64_t
Definition: Time.h:15
edm::EventID id() const
Definition: EventBase.h:60
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void analyze(const edm::Event &e, const edm::EventSetup &c)
void setEPEventHisto(uint64_t ehi, unsigned char *payload)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
dictionary rawdata
Definition: lumiPlot.py:393
tuple size
Write out results.