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 &,
32  DQMStore::IGetter &,
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 refineSummaryHistogram(edm::Service<DQMStore> &);
38  void refineSummaryHistogramCore(TH3F *, std::string &, TH2F *&, std::string strTmpPrefix = "tmp_");
39 
40  void fillUnderOverflowBunchCrossing(edm::Service<DQMStore> &, std::string);
41 
44 };
45 
47  m_fReportSummary = -1.0;
48  strOutFile_ = cfg.getParameter<std::string>("fromFile");
49 }
50 
53  desc.add<std::string>("fromFile", "");
54  descriptions.add("GEMDQMHarvester", desc);
55 }
56 
57 void GEMDQMHarvester::dqmEndLuminosityBlock(DQMStore::IBooker &,
58  DQMStore::IGetter &,
59  edm::LuminosityBlock const &,
60  edm::EventSetup const &) {
62  refineSummaryHistogram(store);
63 
64  store->setCurrentFolder("GEM/StatusDigi");
65  auto listME = store->getMEs();
66 
67  for (auto strName : listME) {
68  if (strName.find("vfatStatus_BC_") != std::string::npos) {
69  fillUnderOverflowBunchCrossing(store, strName);
70  }
71  }
72 }
73 
75  std::string strDirCurr = "GEM/EventInfo";
76  std::string strNameSrc = "reportSummaryMapPreliminary";
77  std::string strNewName = "reportSummaryMap";
78 
79  store->setCurrentFolder(strDirCurr);
80 
81  MonitorElement *h3Curr = store->get(strDirCurr + "/" + strNameSrc);
82  if (h3Curr) {
83  TH2F *h2New = nullptr;
84 
85  refineSummaryHistogramCore(h3Curr->getTH3F(), strNewName, h2New);
86  store->book2D(strNewName, h2New);
87  }
88 
89  store->bookFloat("reportSummary")->Fill(m_fReportSummary);
90 }
91 
93  std::string &strNewName,
94  TH2F *&h2New,
95  std::string strTmpPrefix) {
96  Int_t i, j;
97 
98  Int_t nNBinX = h3Src->GetNbinsX();
99  Int_t nNBinY = h3Src->GetNbinsY();
100 
101  Float_t arrfBinX[128], arrfBinY[32];
102 
103  Float_t fNumPass, fNumError, fNumTotal;
104 
105  for (i = 0; i <= nNBinX; i++)
106  arrfBinX[i] = h3Src->GetXaxis()->GetBinLowEdge(i + 1);
107  for (i = 0; i <= nNBinY; i++)
108  arrfBinY[i] = h3Src->GetYaxis()->GetBinLowEdge(i + 1);
109 
110  h2New = new TH2F(strNewName.c_str(), h3Src->GetTitle(), nNBinX, arrfBinX, nNBinY, arrfBinY);
111 
112  fNumTotal = fNumPass = fNumError = 0.0;
113 
114  for (i = 0; i < nNBinX; i++) {
115  h2New->GetXaxis()->SetBinLabel(i + 1, h3Src->GetXaxis()->GetBinLabel(i + 1));
116  for (j = 0; j < nNBinY; j++) {
117  h2New->GetYaxis()->SetBinLabel(j + 1, h3Src->GetYaxis()->GetBinLabel(j + 1));
118 
119  if (h3Src->GetBinContent(i + 1, j + 1, 2) != 0) {
120  h2New->SetBinContent(i + 1, j + 1, 2);
121  fNumError += 1.0;
122  } else if (h3Src->GetBinContent(i + 1, j + 1, 1) != 0) {
123  h2New->SetBinContent(i + 1, j + 1, 1);
124  fNumPass += 1.0;
125  }
126 
127  fNumTotal += 1.0;
128  }
129  }
130 
131  if (fNumPass > 0.0 || fNumError > 0.0)
132  m_fReportSummary = fNumPass / fNumTotal;
133 }
134 
136  std::string strDirCurr = "GEM/StatusDigi";
137 
138  store->setCurrentFolder(strDirCurr);
139  MonitorElement *h2Curr = store->get(strDirCurr + "/" + strNameSrc);
140 
141  Int_t nNBinX = h2Curr->getNbinsX();
142  Int_t nNBinY = h2Curr->getNbinsY();
143 
144  for (Int_t i = 0; i < nNBinY; i++) {
145  h2Curr->setBinContent(1, i, h2Curr->getBinContent(0, i) + h2Curr->getBinContent(1, i));
146  h2Curr->setBinContent(nNBinX, i, h2Curr->getBinContent(nNBinX, i) + h2Curr->getBinContent(nNBinX + 1, i));
147  }
148 }
149 
DQMEDHarvester.h
GEMDQMHarvester::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GEMDQMHarvester.cc:51
GEMDQMHarvester::fillUnderOverflowBunchCrossing
void fillUnderOverflowBunchCrossing(edm::Service< DQMStore > &, std::string)
Definition: GEMDQMHarvester.cc:135
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
GEMDQMHarvester::strOutFile_
std::string strOutFile_
Definition: GEMDQMHarvester.cc:43
ESHandle.h
GEMDQMHarvester::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: GEMDQMHarvester.cc:57
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
GEMDQMHarvester::m_fReportSummary
Float_t m_fReportSummary
Definition: GEMDQMHarvester.cc:42
MakerMacros.h
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
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
GEMDQMHarvester::~GEMDQMHarvester
~GEMDQMHarvester() override
Definition: GEMDQMHarvester.cc:27
Run.h
GEMDQMHarvester::refineSummaryHistogram
void refineSummaryHistogram(edm::Service< DQMStore > &)
Definition: GEMDQMHarvester.cc:74
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GEMDQMHarvester::GEMDQMHarvester
GEMDQMHarvester(const edm::ParameterSet &)
Definition: GEMDQMHarvester.cc:46
MonitorElement.h
edm::ParameterSet
Definition: ParameterSet.h:36
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::legacy::MonitorElement::getTH3F
virtual TH3F * getTH3F() const
Definition: MonitorElement.h:502
edm::EventSetup
Definition: EventSetup.h:57
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
Frameworkfwd.h
dqm::impl::MonitorElement::getNbinsX
virtual int getNbinsX() const
get # of bins in X-axis
Definition: MonitorElement.cc:574
EventSetup.h
GEMDQMHarvester::refineSummaryHistogramCore
void refineSummaryHistogramCore(TH3F *, std::string &, TH2F *&, std::string strTmpPrefix="tmp_")
Definition: GEMDQMHarvester.cc:92
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