CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventStreamHttpReader.cc
Go to the documentation of this file.
1 // $Id: EventStreamHttpReader.cc,v 1.54 2012/10/31 17:09:27 wmtan Exp $
3 
6 #include "EventFilter/StorageManager/src/EventServerProxy.icc"
11 
12 #include <string>
13 
14 
15 namespace edm
16 {
18  (
19  ParameterSet const& pset,
20  InputSourceDescription const& desc
21  ):
22  StreamerInputSource(pset, desc),
23  eventServerProxy_(pset),
24  dqmStore_(0),
25  dqmStoreAvailabiltyChecked_(false),
26  dropOldLumisectionEvents_(pset.getUntrackedParameter<bool>("dropOldLumisectionEvents", false)),
27  consumerName_(pset.getUntrackedParameter<std::string>("consumerName")),
28  totalDroppedEvents_(0),
29  lastLS_(0)
30  {
31  // Default in StreamerInputSource is 'false'
32  bool inputFileTransitionsEachEvent = pset.getUntrackedParameter<bool>("inputFileTransitionsEachEvent", true);
33  if(inputFileTransitionsEachEvent) {
34  setInputFileTransitionsEachEvent();
35  }
36 
37  readHeader();
38  }
39 
41  {
43 
45  unsigned int currentLS(0);
46  unsigned int droppedEvents(0);
47 
48  do
49  {
51  if ( data.empty() ) return false;
52 
53  HeaderView hdrView(&data[0]);
54  if (hdrView.code() == Header::DONE)
55  {
56  return false;
57  }
58 
59  EventMsgView eventView(&data[0]);
60  currentLS = eventView.lumi();
61  droppedEvents += eventView.droppedEventsCount();
62  }
63  while (
65  lastLS_ > currentLS
66  );
67 
68  lastLS_ = currentLS;
69 
70  if (dqmStore_)
71  {
72  MonitorElement* me = dqmStore_->get("SM_SMPS_Stats/droppedEventsCount_" + consumerName_ );
73  if (!me){
74  dqmStore_->setCurrentFolder("SM_SMPS_Stats");
75  me = dqmStore_->bookInt("droppedEventsCount_" + consumerName_ );
76  }
77  totalDroppedEvents_ += droppedEvents;
79  }
80 
81  deserializeEvent(EventMsgView(&data[0]));
82  return true;
83  }
84 
85 
87  {
89 
91  InitMsgView initView(&data[0]);
93  }
94 
95 
97  {
99  {
100  try
101  {
103  }
104  catch (cms::Exception& e)
105  {
106  edm::LogInfo("EventStreamHttpReader")
107  << "Service DQMStore not defined. Will not record the number of dropped events.";
108  }
110  }
111  }
112 
113 
114 } //namespace edm
115 
116 
T getUntrackedParameter(std::string const &, T const &) const
uint32 lumi() const
Definition: EventMessage.cc:85
uint32 code() const
Definition: MsgHeader.h:34
void Fill(long long x)
void readHeader(xercesc::DOMNode *parentNode, EcalCondHeader &header)
read header from
void deserializeEvent(EventMsgView const &eventView)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
void getInitMsg(CurlInterface::Content &data)
uint32 droppedEventsCount() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void getOneEvent(CurlInterface::Content &data)
stor::EventServerProxy< stor::EventConsumerRegistrationInfo > eventServerProxy_
EventStreamHttpReader(edm::ParameterSet const &, edm::InputSourceDescription const &)
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:629
void deserializeAndMergeWithRegistry(InitMsgView const &initView, bool subsequent=false)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
std::vector< char > Content
Definition: CurlInterface.h:31