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.52 2011/09/02 08:13:31 mommsen 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  inputFileTransitionsEachEvent_ =
33  pset.getUntrackedParameter<bool>("inputFileTransitionsEachEvent", true);
34 
35  readHeader();
36  }
37 
38 
40  {
42 
44  unsigned int currentLS(0);
45  unsigned int droppedEvents(0);
46 
47  do
48  {
50  if ( data.empty() ) return 0;
51 
52  HeaderView hdrView(&data[0]);
53  if (hdrView.code() == Header::DONE)
54  {
55  setEndRun();
56  return 0;
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  return deserializeEvent(EventMsgView(&data[0]));
82  }
83 
84 
86  {
88 
90  InitMsgView initView(&data[0]);
92  }
93 
94 
96  {
98  {
99  try
100  {
102  }
103  catch (cms::Exception& e)
104  {
105  edm::LogInfo("EventStreamHttpReader")
106  << "Service DQMStore not defined. Will not record the number of dropped events.";
107  }
109  }
110  }
111 
112 
113 } //namespace edm
114 
115 
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
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
void getInitMsg(CurlInterface::Content &data)
uint32 droppedEventsCount() const
EventPrincipal * deserializeEvent(EventMsgView const &eventView)
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:624
void deserializeAndMergeWithRegistry(InitMsgView const &initView, bool subsequent=false)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
std::vector< char > Content
Definition: CurlInterface.h:31
virtual EventPrincipal * read()