CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMEventInfo.cc
Go to the documentation of this file.
1 /*
2  * \file DQMEventInfo.cc
3  * \author M. Zanetti - CERN PH
4  * Last Update:
5  * $Date: 2011/03/25 09:26:49 $
6  * $Revision: 1.33 $
7  * $Author: lilopera $
8  *
9  */
10 #include "DQMEventInfo.h"
14 #include <TSystem.h>
15 
16 #include <stdio.h>
17 #include <sstream>
18 #include <math.h>
19 
20 
21 static inline double stampToReal(edm::Timestamp time)
22 { return (time.value() >> 32) + 1e-6*(time.value() & 0xffffffff); }
23 
24 static inline double stampToReal(const timeval &time)
25 { return time.tv_sec + 1e-6*time.tv_usec; }
26 
27 
29 
30  struct timeval now;
31  gettimeofday(&now, 0);
32 
33  parameters_ = ps;
34  pEvent_ = 0;
35  evtRateCount_ = 0;
37 
38  // read config parms
39  std::string folder = parameters_.getUntrackedParameter<std::string>("eventInfoFolder", "EventInfo") ;
40  std::string subsystemname = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "YourSubsystem") ;
41 
42  eventInfoFolder_ = subsystemname + "/" + folder ;
43  evtRateWindow_ = parameters_.getUntrackedParameter<double>("eventRateWindow", 0.5);
44  if(evtRateWindow_<=0.15) evtRateWindow_=0.15;
45 
46  //
48 
49  dbe_->setCurrentFolder(eventInfoFolder_) ;
50 
51  //Event specific contents
52  runId_ = dbe_->bookInt("iRun");
53  runId_->Fill(-1);
54  lumisecId_ = dbe_->bookInt("iLumiSection");
55  lumisecId_->Fill(-1);
56  eventId_ = dbe_->bookInt("iEvent");
57  eventId_->Fill(-1);
58  eventTimeStamp_ = dbe_->bookFloat("eventTimeStamp");
59 
60  dbe_->setCurrentFolder(eventInfoFolder_) ;
61  //Process specific contents
62  processTimeStamp_ = dbe_->bookFloat("processTimeStamp");
64  processLatency_ = dbe_->bookFloat("processLatency");
66  processEvents_ = dbe_->bookInt("processedEvents");
68  processEventRate_ = dbe_->bookFloat("processEventRate");
69  processEventRate_->Fill(-1);
70  nUpdates_= dbe_->bookInt("processUpdates");
71  nUpdates_->Fill(-1);
72 
73  //Static Contents
74  processId_= dbe_->bookInt("processID");
75  processId_->Fill(gSystem->GetPid());
76  processStartTimeStamp_ = dbe_->bookFloat("processStartTimeStamp");
78  runStartTimeStamp_ = dbe_->bookFloat("runStartTimeStamp");
79  hostName_= dbe_->bookString("hostName",gSystem->HostName());
80  processName_= dbe_->bookString("processName",subsystemname);
81  workingDir_= dbe_->bookString("workingDir",gSystem->pwd());
82  cmsswVer_= dbe_->bookString("CMSSW_Version",edm::getReleaseVersion());
83 
84  // Folder to be populated by sub-systems' code
85  std::string subfolder = eventInfoFolder_ + "/reportSummaryContents" ;
86  dbe_->setCurrentFolder(subfolder);
87 
88 }
89 
91 }
92 
94 {
95 
96  runId_->Fill(r.id().run());
98 
99  //Online static histograms
100  const edm::ParameterSet &sourcePSet = edm::getProcessParameterSet().getParameterSet("@main_input");
101  if (sourcePSet.getParameter<std::string>("@module_type") == "EventStreamHttpReader" ){
102  std::string evSelection;
103  std::vector<std::string> evSelectionList;
104  const edm::ParameterSet &evSelectionPSet = sourcePSet.getUntrackedParameterSet("SelectEvents");
105  evSelectionList = evSelectionPSet.getParameter<std::vector<std::string> >("SelectEvents");
106  for ( std::vector<std::string>::iterator it = evSelectionList.begin(); it < evSelectionList.end(); it++ )
107  evSelection += "'"+ *it + "', ";
108 
109  evSelection.resize(evSelection.length()-2);
111  dbe_->bookString("eventSelection",evSelection);
112  }
113 
114 }
115 
117 
119 
120 }
121 
123 
124  eventId_->Fill(int64_t(e.id().event()));
126 
127  pEvent_++;
128  evtRateCount_++;
130 
131  struct timeval now;
132  gettimeofday(&now, 0);
134  currentTime_ = stampToReal(now);
135 
138 
139  double delta = currentTime_ - lastAvgTime_;
140  if (delta >= (evtRateWindow_*60.0))
141  {
143  evtRateCount_ = 0;
144  lastAvgTime_ = currentTime_;
145  }
146 
147  return;
148 }
LuminosityBlockID id() const
dbl * delta
Definition: mlp_gen.cc:36
double evtRateWindow_
Definition: DQMEventInfo.h:64
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
double currentTime_
Definition: DQMEventInfo.h:62
MonitorElement * hostName_
of event processed so far
Definition: DQMEventInfo.h:88
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * workingDir_
DQM &quot;name&quot; of the job (eg, Hcal or DT)
Definition: DQMEventInfo.h:90
double lastUpdateTime_
Definition: DQMEventInfo.h:62
RunID const & id() const
Definition: RunBase.h:41
MonitorElement * eventTimeStamp_
Definition: DQMEventInfo.h:76
RunNumber_t run() const
Definition: RunID.h:44
DQMStore * dbe_
Definition: DQMEventInfo.h:54
edm::ParameterSet parameters_
Definition: DQMEventInfo.h:56
MonitorElement * processId_
Number of collector updates (TBD)
Definition: DQMEventInfo.h:82
MonitorElement * processStartTimeStamp_
The PID associated with this job.
Definition: DQMEventInfo.h:83
int64_t pEvent_
Definition: DQMEventInfo.h:66
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:654
void Fill(long long x)
MonitorElement * cmsswVer_
Current working directory of the job.
Definition: DQMEventInfo.h:91
MonitorElement * eventId_
UTC time of the run start.
Definition: DQMEventInfo.h:74
std::string eventInfoFolder_
Definition: DQMEventInfo.h:57
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:683
ParameterSet const & getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
MonitorElement * lumisecId_
Definition: DQMEventInfo.h:75
void beginRun(const edm::Run &r, const edm::EventSetup &c)
Definition: DQMEventInfo.cc:93
MonitorElement * runStartTimeStamp_
Definition: DQMEventInfo.h:73
DQMEventInfo(const edm::ParameterSet &ps)
Constructor.
Definition: DQMEventInfo.cc:28
double lastAvgTime_
Definition: DQMEventInfo.h:62
MonitorElement * processEvents_
Avg # of events in programmable window (default: 5 min)
Definition: DQMEventInfo.h:87
MonitorElement * processLatency_
The UTC time of the last event.
Definition: DQMEventInfo.h:85
MonitorElement * processName_
Hostname of the local machine.
Definition: DQMEventInfo.h:89
std::string getReleaseVersion()
int64_t evtRateCount_
Definition: DQMEventInfo.h:65
TimeValue_t value() const
Definition: Timestamp.cc:72
MonitorElement * runId_
Definition: DQMEventInfo.h:72
ParameterSet const & getProcessParameterSet()
Definition: Registry.cc:34
ParameterSet const & getParameterSet(std::string const &) const
MonitorElement * nUpdates_
These MEs are either static or updated upon each analyze() call.
Definition: DQMEventInfo.h:81
LuminosityBlockNumber_t luminosityBlock() const
MonitorElement * processEventRate_
Time elapsed since the last event.
Definition: DQMEventInfo.h:86
virtual ~DQMEventInfo()
Destructor.
Definition: DQMEventInfo.cc:90
Timestamp const & beginTime() const
Definition: RunBase.h:43
edm::EventID id() const
Definition: EventBase.h:56
void beginLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c)
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:624
MonitorElement * processTimeStamp_
The UTC time of the first event processed.
Definition: DQMEventInfo.h:84
static double stampToReal(edm::Timestamp time)
Definition: DQMEventInfo.cc:21
edm::Timestamp time() const
Definition: EventBase.h:57
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
Definition: Run.h:33