6 #include <boost/regex.hpp> 65 m_dqm_path( config.getUntrackedParameter<
std::
string>(
"dqmPath" ) )
66 , doPlotsVsScalLumi_ ( config.getParameter<bool>(
"doPlotsVsScalLumi" ) )
67 , doPlotsVsPixelLumi_( config.getParameter<bool>(
"doPlotsVsPixelLumi" ) )
68 , scalLumiMEPSet_ ( doPlotsVsScalLumi_ ? getHistoPSet(config.getParameter<
edm::
ParameterSet>(
"scalLumiME")) :
MEPSet{} )
96 static const boost::regex running_n_processes(
".*/Running [0-9]+ processes");
99 std::vector<std::string> subdirs = getter.
getSubdirs();
100 for (
auto const & subdir: subdirs) {
103 if (boost::regex_match(subdir, running_n_processes)) {
106 if ( getter.
get(subdir +
"/event time_real") )
109 std::vector<std::string> subsubdirs = getter.
getSubdirs();
110 for (
auto const & subsubdir: subsubdirs) {
111 if ( getter.
get(subsubdir +
"/event time_real") )
140 static const boost::regex process_name(
".*/process .*");
143 std::vector<std::string> subdirs = getter.
getSubdirs();
144 for (
auto const & subdir: subdirs) {
146 if (boost::regex_match(subdir, process_name)) {
150 std::vector<std::string> subsubdirs = getter.
getSubdirs();
151 for (
auto const & subsubdir: subsubdirs) {
152 if ( getter.
get(subsubdir +
"/path time_real") ) {
168 std::vector<std::string> subsubdirs = getter.
getSubdirs();
169 size_t npaths = subsubdirs.size();
171 MonitorElement* paths_time = booker.
book1D(
"paths_time_real",
"Total (real) time spent in each path", npaths, -0.5,
double(npaths)-0.5);
172 MonitorElement* paths_thread = booker.
book1D(
"paths_time_thread",
"Total (thread) time spent in each path", npaths, -0.5,
double(npaths)-0.5);
173 MonitorElement* paths_allocated = booker.
book1D(
"paths_allocated",
"Total allocated memory in each path", npaths, -0.5,
double(npaths)-0.5);
174 MonitorElement* paths_deallocated = booker.
book1D(
"paths_deallocated",
"Total deallocated in each path", npaths, -0.5,
double(npaths)-0.5);
181 for (
auto const & subsubdir: subsubdirs) {
184 if ( subsubdir.find(test)==std::string::npos )
continue;
186 static const boost::regex
prefix(current_path +
"/path ");
189 paths_time ->
getTH1F()->GetXaxis()->SetBinLabel(ibin,path.c_str());
190 paths_thread ->
getTH1F()->GetXaxis()->SetBinLabel(ibin,path.c_str());
191 paths_allocated ->
getTH1F()->GetXaxis()->SetBinLabel(ibin,path.c_str());
192 paths_deallocated->
getTH1F()->GetXaxis()->SetBinLabel(ibin,path.c_str());
195 if ( (me = getter.
get(subsubdir +
"/path time_real")) ) {
197 paths_time->
getTH1F()->SetBinContent(ibin,mean);
199 if ( (me = getter.
get(subsubdir +
"/path time_thread")) ) {
201 paths_thread->
getTH1F()->SetBinContent(ibin,mean);
203 if ( (me = getter.
get(subsubdir +
"/path allocated")) ) {
205 paths_allocated->
getTH1F()->SetBinContent(ibin,mean);
208 if ( (me = getter.
get(subsubdir +
"/path deallocated")) ) {
210 paths_deallocated->
getTH1F()->SetBinContent(ibin,mean);
217 for (
auto const & subsubdir: subsubdirs) {
224 std::vector<std::string> allmenames = getter.
getMEs();
225 if ( allmenames.size() == 0 )
continue;
228 MonitorElement * me_real_total = getter.
get( subsubdir +
"/module_time_real_total" );
229 MonitorElement * me_thread_total = getter.
get( subsubdir +
"/module_time_thread_total" );
231 if (me_counter == 0
or me_real_total == 0)
235 TH1D * real_total = me_real_total->
getTH1D();
236 TH1D * thread_total = me_thread_total->
getTH1D();
237 uint32_t
bins = counter->GetXaxis()->GetNbins() - 1;
238 double min = counter->GetXaxis()->GetXmin();
239 double max = counter->GetXaxis()->GetXmax() - 1;
243 TH1F * thread_average;
244 TH1F * thread_running;
249 me = getter.
get(
"module_time_real_average" );
252 assert( me->
getTH1F()->GetXaxis()->GetXmin() ==
min );
253 assert( me->
getTH1F()->GetXaxis()->GetXmax() ==
max );
254 real_average->Reset();
256 real_average = booker.
book1D(
"module_time_real_average",
"module real average timing", bins, min, max)->
getTH1F();
257 real_average->SetYTitle(
"average processing (real) time [ms]");
258 for (uint32_t
i = 1;
i <=
bins; ++
i) {
259 const char *
module = counter->GetXaxis()->GetBinLabel(
i);
260 real_average->GetXaxis()->SetBinLabel(
i, module);
264 me = getter.
get(
"module_time_thread_average" );
266 thread_average = me->
getTH1F();
267 assert( me->
getTH1F()->GetXaxis()->GetXmin() ==
min );
268 assert( me->
getTH1F()->GetXaxis()->GetXmax() ==
max );
269 thread_average->Reset();
271 thread_average = booker.
book1D(
"module_time_thread_average",
"module thread average timing", bins, min, max)->
getTH1F();
272 thread_average->SetYTitle(
"average processing (thread) time [ms]");
273 for (uint32_t
i = 1;
i <=
bins; ++
i) {
274 const char *
module = counter->GetXaxis()->GetBinLabel(
i);
275 thread_average->GetXaxis()->SetBinLabel(
i, module);
279 me = getter.
get(
"module_time_real_running" );
282 assert( me->
getTH1F()->GetXaxis()->GetXmin() ==
min );
283 assert( me->
getTH1F()->GetXaxis()->GetXmax() ==
max );
284 real_running->Reset();
286 real_running = booker.
book1D(
"module_time_real_running",
"module real running timing", bins, min, max)->
getTH1F();
287 real_running->SetYTitle(
"running processing (real) time [ms]");
288 for (uint32_t
i = 1;
i <=
bins; ++
i) {
289 const char *
module = counter->GetXaxis()->GetBinLabel(
i);
290 real_running->GetXaxis()->SetBinLabel(
i, module);
294 me = getter.
get(
"module_time_thread_running" );
296 thread_running = me->
getTH1F();
297 assert( me->
getTH1F()->GetXaxis()->GetXmin() ==
min );
298 assert( me->
getTH1F()->GetXaxis()->GetXmax() ==
max );
299 thread_running->Reset();
301 thread_running = booker.
book1D(
"module_time_thread_running",
"module thread running timing", bins, min, max)->
getTH1F();
302 thread_running->SetYTitle(
"running processing (thread) time [ms]");
303 for (uint32_t
i = 1;
i <=
bins; ++
i) {
304 const char *
module = counter->GetXaxis()->GetBinLabel(
i);
305 thread_running->GetXaxis()->SetBinLabel(
i, module);
309 me = getter.
get(
"module_efficiency" );
312 assert( me->
getTH1F()->GetXaxis()->GetXmin() ==
min );
313 assert( me->
getTH1F()->GetXaxis()->GetXmax() ==
max );
316 efficiency = booker.
book1D(
"module_efficiency",
"module efficiency", bins, min, max)->
getTH1F();
317 efficiency->SetYTitle(
"filter efficiency");
318 efficiency->SetMaximum(1.05);
319 for (uint32_t
i = 1;
i <=
bins; ++
i) {
320 const char *
module = counter->GetXaxis()->GetBinLabel(
i);
321 efficiency->GetXaxis()->SetBinLabel(
i, module);
326 for (uint32_t
i = 1;
i <=
bins; ++
i) {
327 double n = counter ->GetBinContent(
i);
328 double p = counter ->GetBinContent(
i+1);
330 efficiency->SetBinContent(
i, p / n);
333 double t = real_total->GetBinContent(
i);
334 real_average->SetBinContent(
i, t / events);
336 real_running->SetBinContent(
i, t / n);
339 t = thread_total->GetBinContent(
i);
340 thread_average->SetBinContent(
i, t / events);
342 thread_running->SetBinContent(
i, t / n);
359 std::vector<std::string> menames;
361 static const boost::regex byls(
".*byls");
362 static const boost::regex
test(suffix);
365 std::vector<std::string> allmenames = getter.
getMEs();
366 for (
const auto &
m : allmenames ) {
368 if (boost::regex_match(
m, byls))
369 menames.push_back(
m);
372 if ( menames.size() == 0 )
387 edm::LogWarning(
"FastTimerServiceClient") <<
"no " << name <<
" ME is available in " << folder << std::endl;
395 std::vector<double>
lumi;
397 for (
size_t ibin=1; ibin <=
size; ++ibin ) {
399 if ( lumiVsLS->
getTProfile()->GetBinContent(ibin) == 0. )
continue;
401 lumi.push_back( lumiVsLS->
getTProfile()->GetBinContent(ibin) );
402 LS.push_back ( lumiVsLS->
getTProfile()->GetXaxis()->GetBinCenter(ibin) );
407 for (
auto m : menames ) {
409 label.erase(label.find(
"_byls"));
416 MonitorElement* meVsLumi = getter.
get( current_path +
"/" + label +
"_" + suffix );
422 meVsLumi = booker.
bookProfile(label +
"_" + suffix, label +
"_" + suffix, nbins, xmin, xmax, ymin, ymax);
424 meVsLumi->
getTProfile()->GetXaxis()->SetTitle(xtitle.c_str());
425 meVsLumi->
getTProfile()->GetYaxis()->SetTitle(ytitle.c_str());
427 for (
size_t ils=0; ils < LS.size(); ++ils ) {
428 int ibin = me->
getTProfile()->GetXaxis()->FindBin(LS[ils]);
431 meVsLumi->
Fill(lumi[ils],y);
442 pset.
add<
int> (
"nbins", 6500 );
443 pset.
add<
double>(
"xmin", 0.);
444 pset.
add<
double>(
"xmax", 13000.);
465 desc.
add<
bool>(
"doPlotsVsScalLumi",
true );
466 desc.
add<
bool>(
"doPlotsVsPixelLumi",
false );
476 descriptions.
add(
"fastTimerServiceClient", desc);
T getParameter(std::string const &) const
static MEPSet getHistoPSet(edm::ParameterSet pset)
void dqmEndLuminosityBlock(DQMStore::IBooker &booker, DQMStore::IGetter &getter, edm::LuminosityBlock const &, edm::EventSetup const &) override
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
MonitorElement * bookProfile(Args &&...args)
void fillPlotsVsLumi(DQMStore::IBooker &booker, DQMStore::IGetter &getter, std::string const ¤t_path, std::string const &suffix, MEPSet pset)
MonitorElement * get(const std::string &path)
#define DEFINE_FWK_MODULE(type)
void fillProcessSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter, std::string const &path)
TH1D * getTH1D(void) const
def setup(process, global_tag, zero_tesla=False)
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
void fillPathSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter, double events, std::string const &path)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
MonitorElement * book1D(Args &&...args)
static void fillLumiMePSetDescription(edm::ParameterSetDescription &pset)
~FastTimerServiceClient()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< std::string > getMEs(void)
FastTimerServiceClient(edm::ParameterSet const &)
void fillSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter)
void setCurrentFolder(const std::string &fullpath)
TH1F * getTH1F(void) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< std::string > getSubdirs(void)
void setCurrentFolder(const std::string &fullpath)
TProfile * getTProfile(void) const
void Reset(void)
reset ME (ie. contents, errors, etc)