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(iRun.id().run());
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");
83  hostName_= ibooker.bookString("hostName",gSystem->HostName());
84  processName_= ibooker.bookString("processName",subsystemname_);
85  workingDir_= ibooker.bookString("workingDir",gSystem->pwd());
86  cmsswVer_= ibooker.bookString("CMSSW_Version",edm::getReleaseVersion());
87 
88  // Folder to be populated by sub-systems' code
89  std::string subfolder = eventInfoFolder_ + "/reportSummaryContents" ;
90  ibooker.setCurrentFolder(subfolder);
91 
92  //Online static histograms
93  const edm::ParameterSet &sourcePSet = edm::getProcessParameterSet().getParameterSet("@main_input");
94  if (sourcePSet.getParameter<std::string>("@module_type") == "EventStreamHttpReader" ){
95  std::string evSelection;
96  std::vector<std::string> evSelectionList;
97  const edm::ParameterSet &evSelectionPSet = sourcePSet.getUntrackedParameterSet("SelectEvents");
98  evSelectionList = evSelectionPSet.getParameter<std::vector<std::string> >("SelectEvents");
99  for ( std::vector<std::string>::iterator it = evSelectionList.begin(); it < evSelectionList.end(); it++ )
100  evSelection += "'"+ *it + "', ";
101 
102  evSelection.resize(evSelection.length()-2);
104  ibooker.bookString("eventSelection",evSelection);
105  }
106 
107 
108 }
109 
110 
112 {
114 }
115 
117 
118  eventId_->Fill(int64_t(e.id().event()));
120 
121  pEvent_++;
122  evtRateCount_++;
124 
125  struct timeval now;
126  gettimeofday(&now, 0);
128  currentTime_ = stampToReal(now);
129 
132 
133  double delta = currentTime_ - lastAvgTime_;
134  if (delta >= (evtRateWindow_*60.0))
135  {
137  evtRateCount_ = 0;
138  lastAvgTime_ = currentTime_;
139  }
140 
141  return;
142 }
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:43
edm::ParameterSet parameters_
Definition: DQMEventInfo.h:55
MonitorElement * processId_
Number of collector updates (TBD)
Definition: DQMEventInfo.h:82
MonitorElement * processStartTimeStamp_
The PID associated with this job.
Definition: DQMEventInfo.h:83
MonitorElement * bookInt(Args &&...args)
Definition: DQMStore.h:101
MonitorElement * bookString(Args &&...args)
Definition: DQMStore.h:95
int64_t pEvent_
Definition: DQMEventInfo.h:66
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:91
MonitorElement * eventId_
UTC time of the run start.
Definition: DQMEventInfo.h:74
std::string eventInfoFolder_
Definition: DQMEventInfo.h:56
MonitorElement * lumisecId_
Definition: DQMEventInfo.h:75
MonitorElement * runStartTimeStamp_
Definition: DQMEventInfo.h:73
DQMEventInfo(const edm::ParameterSet &ps)
Constructor.
Definition: DQMEventInfo.cc:25
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
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DQMEventInfo.cc:48
std::string getReleaseVersion()
int64_t evtRateCount_
Definition: DQMEventInfo.h:65
MonitorElement * runId_
Definition: DQMEventInfo.h:72
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
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:81
LuminosityBlockNumber_t luminosityBlock() const
MonitorElement * processEventRate_
Time elapsed since the last event.
Definition: DQMEventInfo.h:86
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:107
MonitorElement * processTimeStamp_
The UTC time of the first event processed.
Definition: DQMEventInfo.h:84
static double stampToReal(edm::Timestamp time)
Definition: DQMEventInfo.cc:18
TimeValue_t value() const
Definition: Timestamp.h:56
std::string subsystemname_
Definition: DQMEventInfo.h:57
edm::Timestamp time() const
Definition: EventBase.h:57
Definition: Run.h:41