CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ThroughputServiceClient.cc
Go to the documentation of this file.
1 // C++ headers
2 #include <string>
3 #include <cstring>
4 
5 // boost headers
6 #include <boost/regex.hpp>
7 
8 // Root headers
9 #include <TH1F.h>
10 
11 // CMSSW headers
25 
27 public:
30 
31  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
32 
33 private:
35 
36  void dqmEndLuminosityBlock(DQMStore::IBooker & booker, DQMStore::IGetter & getter, edm::LuminosityBlock const &, edm::EventSetup const&) override;
37  void dqmEndJob(DQMStore::IBooker & booker, DQMStore::IGetter & getter) override;
38 
39 private:
40  void fillSummaryPlots( DQMStore::IBooker & booker, DQMStore::IGetter & getter);
41 };
42 
43 
45  m_dqm_path( config.getUntrackedParameter<std::string>( "dqmPath" ) )
46 {
47 }
48 
50 {
51 }
52 
53 void
55 {
56  fillSummaryPlots(booker, getter);
57 }
58 
59 void
61 {
62  fillSummaryPlots(booker, getter);
63 }
64 
65 void
67 {
68  // find whether the plots are in the main folder, or in per-number-of-processess subfolders
69  std::vector<std::string> folders;
70  if (getter.get(m_dqm_path + "/throughput_sourced")) {
71  // the plots are in the main folder
72  folders.push_back(m_dqm_path);
73  } else {
74  static const boost::regex running_n_processes(".*/Running [0-9]+ processes");
76  std::vector<std::string> subdirs = getter.getSubdirs();
77  for (auto const & subdir: subdirs) {
78  if (boost::regex_match(subdir, running_n_processes)) {
79  if (getter.get(subdir + "/throughput_sourced"))
80  // the plots are in a per-number-of-processes subfolder
81  folders.push_back(subdir + "/throughput_sourced");
82  }
83  }
84  }
85  for (auto const & folder: folders) {
86  TH1F * sourced = getter.get( folder + "/throughput_sourced" )->getTH1F();
87  TH1F * retired = getter.get( folder + "/throughput_retired" )->getTH1F();
88  TH1F * concurrent = nullptr;
89  booker.setCurrentFolder(folder);
90  unsigned int nbins = sourced->GetXaxis()->GetNbins();
91  double range = sourced->GetXaxis()->GetXmax();
92  MonitorElement * me = getter.get( folder + "/concurrent" );
93  if (me) {
94  concurrent = me->getTH1F();
95  assert( concurrent->GetXaxis()->GetNbins() == (int) nbins );
96  assert( concurrent->GetXaxis()->GetXmax() == range );
97  concurrent->Reset();
98  } else {
99  concurrent = booker.book1D("concurrent", "Concurrent events being processed", nbins, 0., range)->getTH1F();
100  }
101  double sum = 0;
102  // from bin=0 (underflow) to bin=nbins+1 (overflow)
103  for (unsigned int i = 0; i <= nbins+1; ++i) {
104  sum += sourced->GetBinContent(i) - retired->GetBinContent(i);
105  concurrent->Fill( concurrent->GetXaxis()->GetBinCenter(i), sum );
106  }
107  }
108 }
109 
110 void
113  desc.addUntracked<std::string>( "dqmPath", "HLT/Throughput" );
114  descriptions.add("throughputServiceClient", desc);
115 }
116 
117 //define this as a plug-in
int i
Definition: DBlmapReader.cc:9
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:298
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void fillSummaryPlots(DQMStore::IBooker &booker, DQMStore::IGetter &getter)
ThroughputServiceClient(edm::ParameterSet const &)
void dqmEndLuminosityBlock(DQMStore::IBooker &booker, DQMStore::IGetter &getter, edm::LuminosityBlock const &, edm::EventSetup const &) override
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle otherwise a larger ***bin number will have no effects or even make the ***precision lower than before *********************************************************************************************************it lies in three folders
Definition: invegas.h:5
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
TH1F * getTH1F(void) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:302