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  *
6  */
7 #include "DQMEventInfo.h"
11 #include <TSystem.h>
12 
13 #include <stdio.h>
14 #include <sstream>
15 #include <math.h>
16 
17 
18 static inline double stampToReal(edm::Timestamp time)
19 { return (time.value() >> 32) + 1e-6*(time.value() & 0xffffffff); }
20 
21 static inline double stampToReal(const timeval &time)
22 { return time.tv_sec + 1e-6*time.tv_usec; }
23 
24 
26 
27  struct timeval now;
28  gettimeofday(&now, 0);
29 
30  parameters_ = ps;
31  pEvent_ = 0;
32  evtRateCount_ = 0;
34 
35  // read config parms
36  std::string folder = parameters_.getUntrackedParameter<std::string>("eventInfoFolder", "EventInfo") ;
37  subsystemname_ = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "YourSubsystem") ;
38 
39  eventInfoFolder_ = subsystemname_ + "/" + folder ;
40  evtRateWindow_ = parameters_.getUntrackedParameter<double>("eventRateWindow", 0.5);
41  if(evtRateWindow_<=0.15) evtRateWindow_=0.15;
42 
43 }
44 
46 }
47 
49  edm::Run const & /* iRun*/,
50  edm::EventSetup const & /* iSetup */)
51 {
53 
54  //Event specific contents
55  runId_ = ibooker.bookInt("iRun");
56  runId_->Fill(-1);
57  lumisecId_ = ibooker.bookInt("iLumiSection");
58  lumisecId_->Fill(-1);
59  eventId_ = ibooker.bookInt("iEvent");
60  eventId_->Fill(-1);
61  eventTimeStamp_ = ibooker.bookFloat("eventTimeStamp");
62 
64  //Process specific contents
65  processTimeStamp_ = ibooker.bookFloat("processTimeStamp");
67  processLatency_ = ibooker.bookFloat("processLatency");
69  processEvents_ = ibooker.bookInt("processedEvents");
71  processEventRate_ = ibooker.bookFloat("processEventRate");
73  nUpdates_= ibooker.bookInt("processUpdates");
74  nUpdates_->Fill(-1);
75 
76  //Static Contents
77  processId_= ibooker.bookInt("processID");
78  processId_->Fill(gSystem->GetPid());
79  processStartTimeStamp_ = ibooker.bookFloat("processStartTimeStamp");
81  runStartTimeStamp_ = ibooker.bookFloat("runStartTimeStamp");
82  hostName_= ibooker.bookString("hostName",gSystem->HostName());
83  processName_= ibooker.bookString("processName",subsystemname_);
84  workingDir_= ibooker.bookString("workingDir",gSystem->pwd());
85  cmsswVer_= ibooker.bookString("CMSSW_Version",edm::getReleaseVersion());
86 
87  // Folder to be populated by sub-systems' code
88  std::string subfolder = eventInfoFolder_ + "/reportSummaryContents" ;
89  ibooker.setCurrentFolder(subfolder);
90 
91  //Online static histograms
92  const edm::ParameterSet &sourcePSet = edm::getProcessParameterSet().getParameterSet("@main_input");
93  if (sourcePSet.getParameter<std::string>("@module_type") == "EventStreamHttpReader" ){
94  std::string evSelection;
95  std::vector<std::string> evSelectionList;
96  const edm::ParameterSet &evSelectionPSet = sourcePSet.getUntrackedParameterSet("SelectEvents");
97  evSelectionList = evSelectionPSet.getParameter<std::vector<std::string> >("SelectEvents");
98  for ( std::vector<std::string>::iterator it = evSelectionList.begin(); it < evSelectionList.end(); it++ )
99  evSelection += "'"+ *it + "', ";
100 
101  evSelection.resize(evSelection.length()-2);
103  ibooker.bookString("eventSelection",evSelection);
104  }
105 
106 }
107 
109 {
110  runId_->Fill(r.id().run());
112 }
113 
115 {
117 }
118 
120 
121  eventId_->Fill(int64_t(e.id().event()));
123 
124  pEvent_++;
125  evtRateCount_++;
127 
128  struct timeval now;
129  gettimeofday(&now, 0);
131  currentTime_ = stampToReal(now);
132 
135 
136  double delta = currentTime_ - lastAvgTime_;
137  if (delta >= (evtRateWindow_*60.0))
138  {
140  evtRateCount_ = 0;
141  lastAvgTime_ = currentTime_;
142  }
143 
144  return;
145 }
LuminosityBlockID id() const
dbl * delta
Definition: mlp_gen.cc:36
double evtRateWindow_
Definition: DQMEventInfo.h:65
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
double currentTime_
Definition: DQMEventInfo.h:63
MonitorElement * hostName_
of event processed so far
Definition: DQMEventInfo.h:89
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * workingDir_
DQM &quot;name&quot; of the job (eg, Hcal or DT)
Definition: DQMEventInfo.h:91
double lastUpdateTime_
Definition: DQMEventInfo.h:63
RunID const & id() const
Definition: RunBase.h:41
MonitorElement * eventTimeStamp_
Definition: DQMEventInfo.h:77
RunNumber_t run() const
Definition: RunID.h:43
edm::ParameterSet parameters_
Definition: DQMEventInfo.h:56
MonitorElement * processId_
Number of collector updates (TBD)
Definition: DQMEventInfo.h:83
MonitorElement * processStartTimeStamp_
The PID associated with this job.
Definition: DQMEventInfo.h:84
MonitorElement * bookInt(Args &&...args)
Definition: DQMStore.h:98
MonitorElement * bookString(Args &&...args)
Definition: DQMStore.h:92
int64_t pEvent_
Definition: DQMEventInfo.h:67
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
void Fill(long long x)
MonitorElement * cmsswVer_
Current working directory of the job.
Definition: DQMEventInfo.h:92
MonitorElement * eventId_
UTC time of the run start.
Definition: DQMEventInfo.h:75
std::string eventInfoFolder_
Definition: DQMEventInfo.h:57
MonitorElement * lumisecId_
Definition: DQMEventInfo.h:76
MonitorElement * runStartTimeStamp_
Definition: DQMEventInfo.h:74
DQMEventInfo(const edm::ParameterSet &ps)
Constructor.
Definition: DQMEventInfo.cc:25
double lastAvgTime_
Definition: DQMEventInfo.h:63
MonitorElement * processEvents_
Avg # of events in programmable window (default: 5 min)
Definition: DQMEventInfo.h:88
MonitorElement * processLatency_
The UTC time of the last event.
Definition: DQMEventInfo.h:86
MonitorElement * processName_
Hostname of the local machine.
Definition: DQMEventInfo.h:90
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DQMEventInfo.cc:48
std::string getReleaseVersion()
int64_t evtRateCount_
Definition: DQMEventInfo.h:66
MonitorElement * runId_
Definition: DQMEventInfo.h:73
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:266
ParameterSet const & getProcessParameterSet()
Definition: Registry.cc:82
ParameterSet const & getParameterSet(std::string const &) const
MonitorElement * nUpdates_
These MEs are either static or updated upon each analyze() call.
Definition: DQMEventInfo.h:82
LuminosityBlockNumber_t luminosityBlock() const
MonitorElement * processEventRate_
Time elapsed since the last event.
Definition: DQMEventInfo.h:87
virtual ~DQMEventInfo()
Destructor.
Definition: DQMEventInfo.cc:45
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 * bookFloat(Args &&...args)
Definition: DQMStore.h:104
MonitorElement * processTimeStamp_
The UTC time of the first event processed.
Definition: DQMEventInfo.h:85
static double stampToReal(edm::Timestamp time)
Definition: DQMEventInfo.cc:18
TimeValue_t value() const
Definition: Timestamp.h:56
std::string subsystemname_
Definition: DQMEventInfo.h:58
edm::Timestamp time() const
Definition: EventBase.h:57
Definition: Run.h:41
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c)