CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMHttpSource.cc
Go to the documentation of this file.
1 // $Id: DQMHttpSource.cc,v 1.32 2012/11/01 17:08:57 wmtan Exp $
3 
8 #include "EventFilter/StorageManager/src/EventServerProxy.icc"
12 
13 #include "TClass.h"
14 
15 #include <memory>
16 #include <string>
17 #include <vector>
18 
19 
20 namespace edm
21 {
23 
24 
26  (
27  const ParameterSet& pset,
28  const InputSourceDescription& desc
29  ) :
30  edm::RawInputSource(pset, desc),
31  eventAuxiliary_(),
32  dqmEventServerProxy_(pset),
33  dqmStore_(0)
34  {}
35 
36 
40 
42  if ( data.empty() ) return false;
43 
44  HeaderView hdrView(&data[0]);
45  if (hdrView.code() == Header::DONE) return false;
46 
47  const DQMEventMsgView dqmEventMsgView(&data[0]);
48  addEventToDQMBackend(dqmStore_, dqmEventMsgView, true);
49 
50  EventID id(dqmEventMsgView.runNumber(), dqmEventMsgView.lumiSection(), dqmEventMsgView.eventNumberAtUpdate());
51 
52  setEventAuxiliary(std::unique_ptr<EventAuxiliary>(new EventAuxiliary(id, std::string(), dqmEventMsgView.timeStamp(), true, EventAuxiliary::PhysicsTrigger)));
53 
54  if(!runAuxiliary() || runAuxiliary()->run() != eventAuxiliary().run()) {
56  }
59  }
61  return true;
62  }
63 
65  {
66  // make a fake event principal containing no data but the evId and runId from DQMEvent
67  // and the time stamp from the event at update
69  eventPrincipal,
71  );
72 
73  return e;
74  }
75 
76 
78  (
79  DQMStore* dqmStore,
80  const DQMEventMsgView& dqmEventMsgView,
81  const bool overwrite
82  )
83  {
84  boost::mutex::scoped_lock sl(mutex_);
85 
86  MonitorElement* me = dqmStore->get("SM_SMPS_Stats/mergeCount");
87  if (!me){
88  dqmStore->setCurrentFolder("SM_SMPS_Stats");
89  me = dqmStore->bookInt("mergeCount");
90  }
91  me->Fill(dqmEventMsgView.mergeCount());
92 
93  edm::StreamDQMDeserializer deserializeWorker;
94  std::auto_ptr<DQMEvent::TObjectTable> toTablePtr =
95  deserializeWorker.deserializeDQMEvent(dqmEventMsgView);
96 
97  for (DQMEvent::TObjectTable::const_iterator tableIter = toTablePtr->begin(),
98  tableIterEnd = toTablePtr->end(); tableIter != tableIterEnd; ++tableIter)
99  {
100  const std::string subFolderName = tableIter->first;
101  std::vector<TObject*> toList = tableIter->second;
102  dqmStore->setCurrentFolder(subFolderName); // creates dir if needed
103 
104  for (std::vector<TObject*>::const_iterator objectIter = toList.begin(),
105  objectIterEnd = toList.end(); objectIter != objectIterEnd; ++objectIter)
106  {
107  dqmStore->extract(*objectIter, dqmStore->pwd(), overwrite);
108  // TObject cloned into DQMStore. Thus, delete it here.
109  delete *objectIter;
110  }
111  }
112  }
113 
114 
116  {
117  if ( ! dqmStore_ )
119 
120  if ( ! dqmStore_ )
121  throw cms::Exception("readOneEvent", "DQMHttpSource")
122  << "Unable to lookup the DQMStore service!\n";
123  }
124 
125 } // namespace edm
126 
127 
static void addEventToDQMBackend(DQMStore *, const DQMEventMsgView &, const bool overwrite)
EventPrincipal * makeEvent(EventPrincipal &eventPrincipal, EventAuxiliary const &eventAuxiliary)
static boost::mutex mutex
Definition: LHEProxy.cc:11
DQMHttpSource(const edm::ParameterSet &, const edm::InputSourceDescription &)
RunNumber_t run() const
boost::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:247
RunNumber_t run() const
Accessor for current run number.
Definition: InputSource.cc:605
uint32 eventNumberAtUpdate() const
uint32 code() const
Definition: MsgHeader.h:34
virtual bool checkNextEvent()
void Fill(long long x)
static boost::mutex mutex_
Definition: DQMHttpSource.h:65
bool extract(TObject *obj, const std::string &dir, bool overwrite)
Definition: DQMStore.cc:1776
std::auto_ptr< DQMEvent::TObjectTable > deserializeDQMEvent(DQMEventMsgView const &dqmEventView)
stor::EventServerProxy< stor::DQMEventConsumerRegistrationInfo > dqmEventServerProxy_
Definition: DQMHttpSource.h:62
void setLuminosityBlockAuxiliary(LuminosityBlockAuxiliary *lbp)
Definition: InputSource.h:322
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 setEventAuxiliary(std::unique_ptr< EventAuxiliary > aux)
Definition: DQMHttpSource.h:54
void setEventCached()
Called by the framework to merge or ached() const {return eventCached_;}.
Definition: InputSource.h:349
EventAuxiliary const & eventAuxiliary() const
Definition: DQMHttpSource.h:51
LuminosityBlockNumber_t luminosityBlock() const
Accessor for current luminosity block number.
Definition: InputSource.cc:611
static Timestamp const & invalidTimestamp()
Definition: Timestamp.cc:83
boost::shared_ptr< RunAuxiliary > runAuxiliary() const
Called by the framework to merge or insert run in principal cache.
Definition: InputSource.h:244
uint32 lumiSection() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void setRunAuxiliary(RunAuxiliary *rp)
Definition: InputSource.h:318
void getOneEvent(CurlInterface::Content &data)
DQMStore * dqmStore_
Definition: DQMHttpSource.h:63
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:629
virtual EventPrincipal * read(EventPrincipal &eventPrincipal)
uint32 runNumber() const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
edm::Timestamp timeStamp() const
uint32 mergeCount() const
const std::string & pwd(void) const
Definition: DQMStore.cc:406
std::vector< char > Content
Definition: CurlInterface.h:31