6 #include <boost/regex.hpp> 68 m_dqm_path( config.getUntrackedParameter<
std::
string>(
"dqmPath" ) )
69 , doPlotsVsScalLumi_ ( config.getParameter<
bool>(
"doPlotsVsScalLumi" ) )
70 , doPlotsVsPixelLumi_( config.getParameter<
bool>(
"doPlotsVsPixelLumi" ) )
71 , doPlotsVsPU_ ( config.getParameter<
bool>(
"doPlotsVsPU" ) )
72 , scalLumiMEPSet_ ( doPlotsVsScalLumi_ ? getHistoPSet(config.getParameter<
edm::
ParameterSet>(
"scalLumiME") ) :
MEPSet{} )
99 static const boost::regex running_n_processes(
".*/Running .*");
102 std::vector<std::string> subdirs = getter.
getSubdirs();
103 for (
auto const & subdir: subdirs) {
106 if (boost::regex_match(subdir, running_n_processes)) {
109 if ( getter.
get(subdir +
"/event time_real") )
112 std::vector<std::string> subsubdirs = getter.
getSubdirs();
113 for (
auto const & subsubdir: subsubdirs) {
114 if ( getter.
get(subsubdir +
"/event time_real") )
145 static const boost::regex process_name(
".*/process .*");
148 std::vector<std::string> subdirs = getter.
getSubdirs();
149 for (
auto const & subdir: subdirs) {
151 if (boost::regex_match(subdir, process_name)) {
155 std::vector<std::string> subsubdirs = getter.
getSubdirs();
156 for (
auto const & subsubdir: subsubdirs) {
157 if ( getter.
get(subsubdir +
"/path time_real") ) {
173 std::vector<std::string> subsubdirs = getter.
getSubdirs();
174 size_t npaths = subsubdirs.size();
176 MonitorElement* paths_time = booker.
book1D(
"paths_time_real",
"Total (real) time spent in each path", npaths, -0.5,
double(npaths)-0.5);
177 MonitorElement* paths_thread = booker.
book1D(
"paths_time_thread",
"Total (thread) time spent in each path", npaths, -0.5,
double(npaths)-0.5);
178 MonitorElement* paths_allocated = booker.
book1D(
"paths_allocated",
"Total allocated memory in each path", npaths, -0.5,
double(npaths)-0.5);
179 MonitorElement* paths_deallocated = booker.
book1D(
"paths_deallocated",
"Total deallocated in each path", npaths, -0.5,
double(npaths)-0.5);
186 for (
auto const & subsubdir: subsubdirs) {
189 if ( subsubdir.find(test)==std::string::npos )
continue;
191 static const boost::regex
prefix(current_path +
"/path ");
194 paths_time ->
getTH1F()->GetXaxis()->SetBinLabel(ibin,path.c_str());
195 paths_thread ->
getTH1F()->GetXaxis()->SetBinLabel(ibin,path.c_str());
196 paths_allocated ->
getTH1F()->GetXaxis()->SetBinLabel(ibin,path.c_str());
197 paths_deallocated->
getTH1F()->GetXaxis()->SetBinLabel(ibin,path.c_str());
200 if ( (me = getter.
get(subsubdir +
"/path time_real")) ) {
202 paths_time->
getTH1F()->SetBinContent(ibin,mean);
204 if ( (me = getter.
get(subsubdir +
"/path time_thread")) ) {
206 paths_thread->
getTH1F()->SetBinContent(ibin,mean);
208 if ( (me = getter.
get(subsubdir +
"/path allocated")) ) {
210 paths_allocated->
getTH1F()->SetBinContent(ibin,mean);
213 if ( (me = getter.
get(subsubdir +
"/path deallocated")) ) {
215 paths_deallocated->
getTH1F()->SetBinContent(ibin,mean);
222 for (
auto const & subsubdir: subsubdirs) {
229 std::vector<std::string> allmenames = getter.
getMEs();
230 if ( allmenames.empty() )
continue;
233 MonitorElement * me_real_total = getter.
get( subsubdir +
"/module_time_real_total" );
234 MonitorElement * me_thread_total = getter.
get( subsubdir +
"/module_time_thread_total" );
236 if (me_counter ==
nullptr or me_real_total ==
nullptr)
240 TH1D * real_total = me_real_total->
getTH1D();
241 TH1D * thread_total = me_thread_total->
getTH1D();
242 uint32_t
bins = counter->GetXaxis()->GetNbins() - 1;
243 double min = counter->GetXaxis()->GetXmin();
244 double max = counter->GetXaxis()->GetXmax() - 1;
248 TH1F * thread_average;
249 TH1F * thread_running;
254 me = getter.
get(
"module_time_real_average" );
257 assert( me->
getTH1F()->GetXaxis()->GetXmin() ==
min );
258 assert( me->
getTH1F()->GetXaxis()->GetXmax() ==
max );
259 real_average->Reset();
261 real_average = booker.
book1D(
"module_time_real_average",
"module real average timing", bins, min, max)->
getTH1F();
262 real_average->SetYTitle(
"average processing (real) time [ms]");
263 for (uint32_t
i = 1;
i <=
bins; ++
i) {
264 const char *
module = counter->GetXaxis()->GetBinLabel(
i);
265 real_average->GetXaxis()->SetBinLabel(
i, module);
269 me = getter.
get(
"module_time_thread_average" );
271 thread_average = me->
getTH1F();
272 assert( me->
getTH1F()->GetXaxis()->GetXmin() ==
min );
273 assert( me->
getTH1F()->GetXaxis()->GetXmax() ==
max );
274 thread_average->Reset();
276 thread_average = booker.
book1D(
"module_time_thread_average",
"module thread average timing", bins, min, max)->
getTH1F();
277 thread_average->SetYTitle(
"average processing (thread) time [ms]");
278 for (uint32_t
i = 1;
i <=
bins; ++
i) {
279 const char *
module = counter->GetXaxis()->GetBinLabel(
i);
280 thread_average->GetXaxis()->SetBinLabel(
i, module);
284 me = getter.
get(
"module_time_real_running" );
287 assert( me->
getTH1F()->GetXaxis()->GetXmin() ==
min );
288 assert( me->
getTH1F()->GetXaxis()->GetXmax() ==
max );
289 real_running->Reset();
291 real_running = booker.
book1D(
"module_time_real_running",
"module real running timing", bins, min, max)->
getTH1F();
292 real_running->SetYTitle(
"running processing (real) time [ms]");
293 for (uint32_t
i = 1;
i <=
bins; ++
i) {
294 const char *
module = counter->GetXaxis()->GetBinLabel(
i);
295 real_running->GetXaxis()->SetBinLabel(
i, module);
299 me = getter.
get(
"module_time_thread_running" );
301 thread_running = me->
getTH1F();
302 assert( me->
getTH1F()->GetXaxis()->GetXmin() ==
min );
303 assert( me->
getTH1F()->GetXaxis()->GetXmax() ==
max );
304 thread_running->Reset();
306 thread_running = booker.
book1D(
"module_time_thread_running",
"module thread running timing", bins, min, max)->
getTH1F();
307 thread_running->SetYTitle(
"running processing (thread) time [ms]");
308 for (uint32_t
i = 1;
i <=
bins; ++
i) {
309 const char *
module = counter->GetXaxis()->GetBinLabel(
i);
310 thread_running->GetXaxis()->SetBinLabel(
i, module);
314 me = getter.
get(
"module_efficiency" );
317 assert( me->
getTH1F()->GetXaxis()->GetXmin() ==
min );
318 assert( me->
getTH1F()->GetXaxis()->GetXmax() ==
max );
321 efficiency = booker.
book1D(
"module_efficiency",
"module efficiency", bins, min, max)->
getTH1F();
322 efficiency->SetYTitle(
"filter efficiency");
323 efficiency->SetMaximum(1.05);
324 for (uint32_t
i = 1;
i <=
bins; ++
i) {
325 const char *
module = counter->GetXaxis()->GetBinLabel(
i);
326 efficiency->GetXaxis()->SetBinLabel(
i, module);
331 for (uint32_t
i = 1;
i <=
bins; ++
i) {
332 double n = counter ->GetBinContent(
i);
333 double p = counter ->GetBinContent(
i+1);
335 efficiency->SetBinContent(
i, p / n);
338 double t = real_total->GetBinContent(
i);
339 real_average->SetBinContent(
i, t / events);
341 real_running->SetBinContent(
i, t / n);
344 t = thread_total->GetBinContent(
i);
345 thread_average->SetBinContent(
i, t / events);
347 thread_running->SetBinContent(
i, t / n);
366 std::vector<std::string> menames;
368 static const boost::regex byls(
".*byls");
369 static const boost::regex
test(suffix);
372 std::vector<std::string> allmenames = getter.
getMEs();
373 for (
auto const &
m : allmenames) {
375 if (boost::regex_match(
m, byls))
376 menames.push_back(
m);
379 if ( menames.empty() )
394 edm::LogWarning(
"FastTimerServiceClient") <<
"no " << name <<
" ME is available in " << folder << std::endl;
402 std::vector<double>
lumi;
404 for (
size_t ibin=1; ibin <=
size; ++ibin ) {
406 if ( lumiVsLS->
getTProfile()->GetBinContent(ibin) == 0. )
continue;
408 lumi.push_back( lumiVsLS->
getTProfile()->GetBinContent(ibin) );
409 LS.push_back ( lumiVsLS->
getTProfile()->GetXaxis()->GetBinCenter(ibin) );
414 for (
auto const&
m : menames) {
416 label.erase(label.find(
"_byls"));
423 MonitorElement* meVsLumi = getter.
get( current_path +
"/" + label +
"_" + suffix );
429 meVsLumi = booker.
bookProfile(label +
"_" + suffix, label +
"_" + suffix, nbins, xmin, xmax, ymin, ymax);
431 meVsLumi->
getTProfile()->GetXaxis()->SetTitle(xtitle.c_str());
432 meVsLumi->
getTProfile()->GetYaxis()->SetTitle(ytitle.c_str());
434 for (
size_t ils=0; ils < LS.size(); ++ils ) {
435 int ibin = me->
getTProfile()->GetXaxis()->FindBin(LS[ils]);
438 meVsLumi->
Fill(lumi[ils],y);
449 pset.
add<
int> (
"nbins", 440 );
450 pset.
add<
double>(
"xmin", 0.);
451 pset.
add<
double>(
"xmax", 22000.);
459 pset.
add<
int> (
"nbins", 260 );
460 pset.
add<
double>(
"xmin", 0.);
461 pset.
add<
double>(
"xmax", 130.);
482 desc.
add<
bool>(
"doPlotsVsScalLumi",
true );
483 desc.
add<
bool>(
"doPlotsVsPixelLumi",
false );
484 desc.
add<
bool>(
"doPlotsVsPU",
true );
498 descriptions.
add(
"fastTimerServiceClient", desc);
TProfile * getTProfile() const
T getParameter(std::string const &) const
static void fillPUMePSetDescription(edm::ParameterSetDescription &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)
void fillProcessSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter, std::string const &path)
void setCurrentFolder(std::string const &fullpath)
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)
~FastTimerServiceClient() override
void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
static MEPSet getHistoPSet(const edm::ParameterSet &pset)
#define DEFINE_FWK_MODULE(type)
void fillPathSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter, double events, std::string const &path)
void setCurrentFolder(std::string const &fullpath)
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)
void Reset()
reset ME (ie. contents, errors, etc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
MonitorElement * get(std::string const &path)
FastTimerServiceClient(edm::ParameterSet const &)
void fillSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< std::string > getSubdirs()
std::vector< std::string > getMEs()