CMS 3D CMS Logo

GEMDQMHarvester.cc
Go to the documentation of this file.
10 
11 //DQM services
16 
17 #include <TH2F.h>
18 #include <TFile.h>
19 #include <TDirectoryFile.h>
20 #include <TKey.h>
21 
22 using namespace edm;
23 
25 public:
27  ~GEMDQMHarvester() override{};
28  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
29 
30 protected:
31  void dqmEndLuminosityBlock(DQMStore::IBooker &,
33  edm::LuminosityBlock const &,
34  edm::EventSetup const &) override;
35  void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override{}; // Cannot use; it is called after dqmSaver
36 
37  void drawSummaryHistogram(edm::Service<DQMStore> &store);
38  void createSummaryHist(edm::Service<DQMStore> &store, MonitorElement *h2Src, MonitorElement *&h2Sum);
39  void refineSummaryHistogram(MonitorElement *h2Sum,
40  MonitorElement *h2SrcDigiOcc,
41  MonitorElement *h2SrcDigiMal,
42  MonitorElement *h2SrcCStatus);
43 
44  Float_t fReportSummary_;
46 
48 };
49 
51  fReportSummary_ = -1.0;
52  strOutFile_ = cfg.getParameter<std::string>("fromFile");
53  strDirSummary_ = "GEM/EventInfo";
54 }
55 
58  desc.add<std::string>("fromFile", "");
59  descriptions.add("GEMDQMHarvester", desc);
60 }
61 
64  edm::LuminosityBlock const &,
65  edm::EventSetup const &) {
67  drawSummaryHistogram(store);
68 }
69 
71  store->setCurrentFolder(strDirSummary_);
72 
73  Int_t nBinX = h2Src->getNbinsX(), nBinY = h2Src->getNbinsY();
74  h2Sum = store->book2D("reportSummaryMap", "", nBinX, 0.5, nBinX + 0.5, nBinY, 0.5, nBinY + 0.5);
75 
76  for (Int_t i = 1; i <= nBinX; i++)
77  h2Sum->setBinLabel(i, h2Src->getTH2F()->GetXaxis()->GetBinLabel(i), 1);
78  for (Int_t i = 1; i <= nBinY; i++)
79  h2Sum->setBinLabel(i, h2Src->getTH2F()->GetYaxis()->GetBinLabel(i), 2);
80 }
81 
83  std::string strSrcDigiOcc = "GEM/digi/summaryOccDigi";
84  std::string strSrcDigiMal = "GEM/digi/summaryMalfuncDigi";
85  std::string strSrcCStatus = "GEM/DAQStatus/summaryStatus";
86 
87  store->setCurrentFolder(strDirSummary_);
88 
89  MonitorElement *h2SrcDigiOcc = store->get(strSrcDigiOcc);
90  MonitorElement *h2SrcDigiMal = store->get(strSrcDigiMal);
91  MonitorElement *h2SrcCStatus = store->get(strSrcCStatus);
92 
93  if (h2SrcDigiOcc != nullptr && h2SrcDigiMal != nullptr && h2SrcCStatus != nullptr) {
94  MonitorElement *h2Sum = nullptr;
95  createSummaryHist(store, h2SrcCStatus, h2Sum);
96  refineSummaryHistogram(h2Sum, h2SrcDigiOcc, h2SrcDigiMal, h2SrcCStatus);
97  }
98 
99  store->bookFloat("reportSummary")->Fill(fReportSummary_);
100 }
101 
102 // FIXME: Need more study about how to summarize
104  MonitorElement *h2SrcDigiOcc,
105  MonitorElement *h2SrcDigiMal,
106  MonitorElement *h2SrcCStatus) {
107  Int_t nBinY = h2Sum->getNbinsY();
108  for (Int_t j = 1; j <= nBinY; j++) {
109  Int_t nBinX = (Int_t)(h2SrcDigiOcc->getBinContent(0, j) + 0.5);
110  h2Sum->setBinContent(0, j, nBinX);
111  for (Int_t i = 1; i <= nBinX; i++) {
112  Float_t fDigiOcc = h2SrcDigiOcc->getBinContent(i, j);
113  Float_t fDigiMal = h2SrcDigiMal->getBinContent(i, j);
114  Float_t fCStatus = h2SrcCStatus->getBinContent(i, j);
115 
116  Float_t fRes = 0;
117  if (fCStatus > 0 || fDigiMal > 0)
118  fRes = 2;
119  else if (fDigiOcc > 0)
120  fRes = 1;
121 
122  h2Sum->setBinContent(i, j, fRes);
123  }
124  }
125 }
126 
DQMEDHarvester.h
GEMDQMHarvester::drawSummaryHistogram
void drawSummaryHistogram(edm::Service< DQMStore > &store)
Definition: GEMDQMHarvester.cc:82
GEMDQMHarvester::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GEMDQMHarvester.cc:56
mps_fire.i
i
Definition: mps_fire.py:428
GEMDQMHarvester::fReportSummary_
Float_t fReportSummary_
Definition: GEMDQMHarvester.cc:44
MessageLogger.h
dqm::implementation::IBooker::bookFloat
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
GEMDQMHarvester::strOutFile_
std::string strOutFile_
Definition: GEMDQMHarvester.cc:45
ESHandle.h
GEMDQMHarvester::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: GEMDQMHarvester.cc:62
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
EDAnalyzer.h
GEMDQMHarvester
Definition: GEMDQMHarvester.cc:24
MakerMacros.h
GEMDQMHarvester::strDirSummary_
std::string strDirSummary_
Definition: GEMDQMHarvester.cc:47
GEMDQMHarvester::createSummaryHist
void createSummaryHist(edm::Service< DQMStore > &store, MonitorElement *h2Src, MonitorElement *&h2Sum)
Definition: GEMDQMHarvester.cc:70
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
Service.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
GEMDQMHarvester::~GEMDQMHarvester
~GEMDQMHarvester() override
Definition: GEMDQMHarvester.cc:27
Run.h
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GEMDQMHarvester::GEMDQMHarvester
GEMDQMHarvester(const edm::ParameterSet &)
Definition: GEMDQMHarvester.cc:50
anotherprimaryvertexanalyzer_cfi.nBinY
nBinY
Definition: anotherprimaryvertexanalyzer_cfi.py:13
MonitorElement.h
edm::ParameterSet
Definition: ParameterSet.h:47
dqm::impl::MonitorElement::getNbinsY
virtual int getNbinsY() const
get # of bins in Y-axis
Definition: MonitorElement.cc:580
Event.h
edm::Service
Definition: Service.h:30
dqm::impl::MonitorElement::setBinLabel
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:771
edm::EventSetup
Definition: EventSetup.h:57
GEMDQMHarvester::refineSummaryHistogram
void refineSummaryHistogram(MonitorElement *h2Sum, MonitorElement *h2SrcDigiOcc, MonitorElement *h2SrcDigiMal, MonitorElement *h2SrcCStatus)
Definition: GEMDQMHarvester.cc:103
looper.cfg
cfg
Definition: looper.py:297
DQMEDHarvester
Definition: DQMEDHarvester.py:1
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:691
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
Frameworkfwd.h
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
dqm::impl::MonitorElement::getNbinsX
virtual int getNbinsX() const
get # of bins in X-axis
Definition: MonitorElement.cc:574
anotherprimaryvertexanalyzer_cfi.nBinX
nBinX
Definition: anotherprimaryvertexanalyzer_cfi.py:12
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
EventSetup.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
ParameterSet.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
GEMDQMHarvester::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: GEMDQMHarvester.cc:35
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:592
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:490