CMS 3D CMS Logo

MtdGlobalRecoHarvester.cc
Go to the documentation of this file.
1 #include <string>
2 
7 
10 
12 
14 public:
15  explicit MtdGlobalRecoHarvester(const edm::ParameterSet& iConfig);
16  ~MtdGlobalRecoHarvester() override;
17 
18  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
19 
20 protected:
22 
23 private:
25 
26  // --- Histograms
33 };
34 
35 // ------------ constructor and destructor --------------
37  : folder_(iConfig.getParameter<std::string>("folder")) {}
38 
40 
41 // ------------ endjob tasks ----------------------------
43  // --- Get the monitoring histograms
44  MonitorElement* meBTLTrackEffEtaTot = igetter.get(folder_ + "TrackBTLEffEtaTot");
45  MonitorElement* meBTLTrackEffPhiTot = igetter.get(folder_ + "TrackBTLEffPhiTot");
46  MonitorElement* meBTLTrackEffPtTot = igetter.get(folder_ + "TrackBTLEffPtTot");
47  MonitorElement* meBTLTrackEffEtaMtd = igetter.get(folder_ + "TrackBTLEffEtaMtd");
48  MonitorElement* meBTLTrackEffPhiMtd = igetter.get(folder_ + "TrackBTLEffPhiMtd");
49  MonitorElement* meBTLTrackEffPtMtd = igetter.get(folder_ + "TrackBTLEffPtMtd");
50  MonitorElement* meETLTrackEffEtaTotZneg = igetter.get(folder_ + "TrackETLEffEtaTotZneg");
51  MonitorElement* meETLTrackEffPhiTotZneg = igetter.get(folder_ + "TrackETLEffPhiTotZneg");
52  MonitorElement* meETLTrackEffPtTotZneg = igetter.get(folder_ + "TrackETLEffPtTotZneg");
53  MonitorElement* meETLTrackEffEtaMtdZneg = igetter.get(folder_ + "TrackETLEffEtaMtdZneg");
54  MonitorElement* meETLTrackEffPhiMtdZneg = igetter.get(folder_ + "TrackETLEffPhiMtdZneg");
55  MonitorElement* meETLTrackEffPtMtdZneg = igetter.get(folder_ + "TrackETLEffPtMtdZneg");
56  MonitorElement* meETLTrackEffEtaTotZpos = igetter.get(folder_ + "TrackETLEffEtaTotZpos");
57  MonitorElement* meETLTrackEffPhiTotZpos = igetter.get(folder_ + "TrackETLEffPhiTotZpos");
58  MonitorElement* meETLTrackEffPtTotZpos = igetter.get(folder_ + "TrackETLEffPtTotZpos");
59  MonitorElement* meETLTrackEffEtaMtdZpos = igetter.get(folder_ + "TrackETLEffEtaMtdZpos");
60  MonitorElement* meETLTrackEffPhiMtdZpos = igetter.get(folder_ + "TrackETLEffPhiMtdZpos");
61  MonitorElement* meETLTrackEffPtMtdZpos = igetter.get(folder_ + "TrackETLEffPtMtdZpos");
62 
63  if (!meBTLTrackEffEtaTot || !meBTLTrackEffPhiTot || !meBTLTrackEffPtTot || !meBTLTrackEffEtaMtd ||
64  !meBTLTrackEffPhiMtd || !meBTLTrackEffPtMtd || !meETLTrackEffEtaTotZneg || !meETLTrackEffPhiTotZneg ||
65  !meETLTrackEffPtTotZneg || !meETLTrackEffEtaMtdZneg || !meETLTrackEffPhiMtdZneg || !meETLTrackEffPtMtdZneg ||
66  !meETLTrackEffEtaTotZpos || !meETLTrackEffPhiTotZpos || !meETLTrackEffPtTotZpos || !meETLTrackEffEtaMtdZpos ||
67  !meETLTrackEffPhiMtdZpos || !meETLTrackEffPtMtdZpos) {
68  edm::LogError("MtdGlobalRecoHarvester") << "Monitoring histograms not found!" << std::endl;
69  return;
70  }
71 
72  // --- Book histograms
73  ibook.cd(folder_);
74  meBtlEtaEff_ = ibook.book1D("BtlEtaEff",
75  " Track Efficiency VS Eta;#eta;Efficiency",
76  meBTLTrackEffEtaTot->getNbinsX(),
77  meBTLTrackEffEtaTot->getTH1()->GetXaxis()->GetXmin(),
78  meBTLTrackEffEtaTot->getTH1()->GetXaxis()->GetXmax());
79  meBtlPhiEff_ = ibook.book1D("BtlPhiEff",
80  "Track Efficiency VS Phi;#phi [rad];Efficiency",
81  meBTLTrackEffPhiTot->getNbinsX(),
82  meBTLTrackEffPhiTot->getTH1()->GetXaxis()->GetXmin(),
83  meBTLTrackEffPhiTot->getTH1()->GetXaxis()->GetXmax());
84  meBtlPtEff_ = ibook.book1D("BtlPtEff",
85  "Track Efficiency VS Pt;Pt [GeV];Efficiency",
86  meBTLTrackEffPtTot->getNbinsX(),
87  meBTLTrackEffPtTot->getTH1()->GetXaxis()->GetXmin(),
88  meBTLTrackEffPtTot->getTH1()->GetXaxis()->GetXmax());
89  meEtlEtaEff_[0] = ibook.book1D("EtlEtaEffZneg",
90  " Track Efficiency VS Eta (-Z);#eta;Efficiency",
91  meETLTrackEffEtaTotZneg->getNbinsX(),
92  meETLTrackEffEtaTotZneg->getTH1()->GetXaxis()->GetXmin(),
93  meETLTrackEffEtaTotZneg->getTH1()->GetXaxis()->GetXmax());
94  meEtlPhiEff_[0] = ibook.book1D("EtlPhiEffZneg",
95  "Track Efficiency VS Phi (-Z);#phi [rad];Efficiency",
96  meETLTrackEffPhiTotZneg->getNbinsX(),
97  meETLTrackEffPhiTotZneg->getTH1()->GetXaxis()->GetXmin(),
98  meETLTrackEffPhiTotZneg->getTH1()->GetXaxis()->GetXmax());
99  meEtlPtEff_[0] = ibook.book1D("EtlPtEffZneg",
100  "Track Efficiency VS Pt (-Z);Pt [GeV];Efficiency",
101  meETLTrackEffPtTotZneg->getNbinsX(),
102  meETLTrackEffPtTotZneg->getTH1()->GetXaxis()->GetXmin(),
103  meETLTrackEffPtTotZneg->getTH1()->GetXaxis()->GetXmax());
104  meEtlEtaEff_[1] = ibook.book1D("EtlEtaEffZpos",
105  " Track Efficiency VS Eta (+Z);#eta;Efficiency",
106  meETLTrackEffEtaTotZpos->getNbinsX(),
107  meETLTrackEffEtaTotZpos->getTH1()->GetXaxis()->GetXmin(),
108  meETLTrackEffEtaTotZpos->getTH1()->GetXaxis()->GetXmax());
109  meEtlPhiEff_[1] = ibook.book1D("EtlPhiEffZpos",
110  "Track Efficiency VS Phi (+Z);#phi [rad];Efficiency",
111  meETLTrackEffPhiTotZpos->getNbinsX(),
112  meETLTrackEffPhiTotZpos->getTH1()->GetXaxis()->GetXmin(),
113  meETLTrackEffPhiTotZpos->getTH1()->GetXaxis()->GetXmax());
114  meEtlPtEff_[1] = ibook.book1D("EtlPtEffZpos",
115  "Track Efficiency VS Pt (+Z);Pt [GeV];Efficiency",
116  meETLTrackEffPtTotZpos->getNbinsX(),
117  meETLTrackEffPtTotZpos->getTH1()->GetXaxis()->GetXmin(),
118  meETLTrackEffPtTotZpos->getTH1()->GetXaxis()->GetXmax());
119  meBtlEtaEff_->getTH1()->SetMinimum(0.);
120  meBtlPhiEff_->getTH1()->SetMinimum(0.);
121  meBtlPtEff_->getTH1()->SetMinimum(0.);
122  meEtlEtaEff_[0]->getTH1()->SetMinimum(0.);
123  meEtlPhiEff_[0]->getTH1()->SetMinimum(0.);
124  meEtlPtEff_[0]->getTH1()->SetMinimum(0.);
125  meEtlEtaEff_[1]->getTH1()->SetMinimum(0.);
126  meEtlPhiEff_[1]->getTH1()->SetMinimum(0.);
127  meEtlPtEff_[1]->getTH1()->SetMinimum(0.);
128 
129  // --- Calculate efficiency BTL
130  for (int ibin = 1; ibin <= meBTLTrackEffEtaTot->getNbinsX(); ibin++) {
131  double eff = meBTLTrackEffEtaMtd->getBinContent(ibin) / meBTLTrackEffEtaTot->getBinContent(ibin);
132  double bin_err = sqrt((meBTLTrackEffEtaMtd->getBinContent(ibin) *
133  (meBTLTrackEffEtaTot->getBinContent(ibin) - meBTLTrackEffEtaMtd->getBinContent(ibin))) /
134  pow(meBTLTrackEffEtaTot->getBinContent(ibin), 3));
135  if (meBTLTrackEffEtaTot->getBinContent(ibin) == 0) {
136  eff = 0;
137  bin_err = 0;
138  }
139  meBtlEtaEff_->setBinContent(ibin, eff);
140  meBtlEtaEff_->setBinError(ibin, bin_err);
141  }
142  for (int ibin = 1; ibin <= meBTLTrackEffPhiTot->getNbinsX(); ibin++) {
143  double eff = meBTLTrackEffPhiMtd->getBinContent(ibin) / meBTLTrackEffPhiTot->getBinContent(ibin);
144  double bin_err = sqrt((meBTLTrackEffPhiMtd->getBinContent(ibin) *
145  (meBTLTrackEffPhiTot->getBinContent(ibin) - meBTLTrackEffPhiMtd->getBinContent(ibin))) /
146  pow(meBTLTrackEffPhiTot->getBinContent(ibin), 3));
147  if (meBTLTrackEffPhiTot->getBinContent(ibin) == 0) {
148  eff = 0;
149  bin_err = 0;
150  }
151  meBtlPhiEff_->setBinContent(ibin, eff);
152  meBtlPhiEff_->setBinError(ibin, bin_err);
153  }
154  for (int ibin = 1; ibin <= meBTLTrackEffPtTot->getNbinsX(); ibin++) {
155  double eff = meBTLTrackEffPtMtd->getBinContent(ibin) / meBTLTrackEffPtTot->getBinContent(ibin);
156  double bin_err = sqrt((meBTLTrackEffPtMtd->getBinContent(ibin) *
157  (meBTLTrackEffPtTot->getBinContent(ibin) - meBTLTrackEffPtMtd->getBinContent(ibin))) /
158  pow(meBTLTrackEffPtTot->getBinContent(ibin), 3));
159  if (meBTLTrackEffPtTot->getBinContent(ibin) == 0) {
160  eff = 0;
161  bin_err = 0;
162  }
163  meBtlPtEff_->setBinContent(ibin, eff);
164  meBtlPtEff_->setBinError(ibin, bin_err);
165  }
166  // --- Calculate efficiency ETL
167  for (int ibin = 1; ibin <= meETLTrackEffEtaTotZneg->getNbinsX(); ibin++) {
168  double eff = meETLTrackEffEtaMtdZneg->getBinContent(ibin) / meETLTrackEffEtaTotZneg->getBinContent(ibin);
169  double bin_err =
170  sqrt((meETLTrackEffEtaMtdZneg->getBinContent(ibin) *
171  (meETLTrackEffEtaTotZneg->getBinContent(ibin) - meETLTrackEffEtaMtdZneg->getBinContent(ibin))) /
172  pow(meETLTrackEffEtaTotZneg->getBinContent(ibin), 3));
173  if (meETLTrackEffEtaTotZneg->getBinContent(ibin) == 0) {
174  eff = 0;
175  bin_err = 0;
176  }
177  meEtlEtaEff_[0]->setBinContent(ibin, eff);
178  meEtlEtaEff_[0]->setBinError(ibin, bin_err);
179  }
180 
181  for (int ibin = 1; ibin <= meETLTrackEffEtaTotZpos->getNbinsX(); ibin++) {
182  double eff = meETLTrackEffEtaMtdZpos->getBinContent(ibin) / meETLTrackEffEtaTotZpos->getBinContent(ibin);
183  double bin_err =
184  sqrt((meETLTrackEffEtaMtdZpos->getBinContent(ibin) *
185  (meETLTrackEffEtaTotZpos->getBinContent(ibin) - meETLTrackEffEtaMtdZpos->getBinContent(ibin))) /
186  pow(meETLTrackEffEtaTotZpos->getBinContent(ibin), 3));
187  if (meETLTrackEffEtaTotZpos->getBinContent(ibin) == 0) {
188  eff = 0;
189  bin_err = 0;
190  }
191  meEtlEtaEff_[1]->setBinContent(ibin, eff);
192  meEtlEtaEff_[1]->setBinError(ibin, bin_err);
193  }
194 
195  for (int ibin = 1; ibin <= meETLTrackEffPhiTotZneg->getNbinsX(); ibin++) {
196  double eff = meETLTrackEffPhiMtdZneg->getBinContent(ibin) / meETLTrackEffPhiTotZneg->getBinContent(ibin);
197  double bin_err =
198  sqrt((meETLTrackEffPhiMtdZneg->getBinContent(ibin) *
199  (meETLTrackEffPhiTotZneg->getBinContent(ibin) - meETLTrackEffPhiMtdZneg->getBinContent(ibin))) /
200  pow(meETLTrackEffPhiTotZneg->getBinContent(ibin), 3));
201  if (meETLTrackEffPhiTotZneg->getBinContent(ibin) == 0) {
202  eff = 0;
203  bin_err = 0;
204  }
205  meEtlPhiEff_[0]->setBinContent(ibin, eff);
206  meEtlPhiEff_[0]->setBinError(ibin, bin_err);
207  }
208 
209  for (int ibin = 1; ibin <= meETLTrackEffPhiTotZpos->getNbinsX(); ibin++) {
210  double eff = meETLTrackEffPhiMtdZpos->getBinContent(ibin) / meETLTrackEffPhiTotZpos->getBinContent(ibin);
211  double bin_err =
212  sqrt((meETLTrackEffPhiMtdZpos->getBinContent(ibin) *
213  (meETLTrackEffPhiTotZpos->getBinContent(ibin) - meETLTrackEffPhiMtdZpos->getBinContent(ibin))) /
214  pow(meETLTrackEffPhiTotZpos->getBinContent(ibin), 3));
215  if (meETLTrackEffPhiTotZpos->getBinContent(ibin) == 0) {
216  eff = 0;
217  bin_err = 0;
218  }
219  meEtlPhiEff_[1]->setBinContent(ibin, eff);
220  meEtlPhiEff_[1]->setBinError(ibin, bin_err);
221  }
222 
223  for (int ibin = 1; ibin <= meETLTrackEffPtTotZneg->getNbinsX(); ibin++) {
224  double eff = meETLTrackEffPtMtdZneg->getBinContent(ibin) / meETLTrackEffPtTotZneg->getBinContent(ibin);
225  double bin_err =
226  sqrt((meETLTrackEffPtMtdZneg->getBinContent(ibin) *
227  (meETLTrackEffPtTotZneg->getBinContent(ibin) - meETLTrackEffPtMtdZneg->getBinContent(ibin))) /
228  pow(meETLTrackEffPtTotZneg->getBinContent(ibin), 3));
229  if (meETLTrackEffPtTotZneg->getBinContent(ibin) == 0) {
230  eff = 0;
231  bin_err = 0;
232  }
233  meEtlPtEff_[0]->setBinContent(ibin, eff);
234  meEtlPtEff_[0]->setBinError(ibin, bin_err);
235  }
236 
237  for (int ibin = 1; ibin <= meETLTrackEffPtTotZpos->getNbinsX(); ibin++) {
238  double eff = meETLTrackEffPtMtdZpos->getBinContent(ibin) / meETLTrackEffPtTotZpos->getBinContent(ibin);
239  double bin_err =
240  sqrt((meETLTrackEffPtMtdZpos->getBinContent(ibin) *
241  (meETLTrackEffPtTotZpos->getBinContent(ibin) - meETLTrackEffPtMtdZpos->getBinContent(ibin))) /
242  pow(meETLTrackEffPtTotZpos->getBinContent(ibin), 3));
243  if (meETLTrackEffPtTotZpos->getBinContent(ibin) == 0) {
244  eff = 0;
245  bin_err = 0;
246  }
247  meEtlPtEff_[1]->setBinContent(ibin, eff);
248  meEtlPtEff_[1]->setBinError(ibin, bin_err);
249  }
250 }
251 
252 // ------------ method fills 'descriptions' with the allowed parameters for the module ----------
255 
256  desc.add<std::string>("folder", "MTD/GlobalReco/");
257 
258  descriptions.add("MtdGlobalRecoPostProcessor", desc);
259 }
260 
DQMEDHarvester.h
MtdGlobalRecoHarvester::meBtlPtEff_
MonitorElement * meBtlPtEff_
Definition: MtdGlobalRecoHarvester.cc:29
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
MtdGlobalRecoHarvester
Definition: MtdGlobalRecoHarvester.cc:13
DQMStore.h
MtdGlobalRecoHarvester::meEtlPhiEff_
MonitorElement * meEtlPhiEff_[2]
Definition: MtdGlobalRecoHarvester.cc:31
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
ETLDetId.h
MtdGlobalRecoHarvester::meEtlEtaEff_
MonitorElement * meEtlEtaEff_[2]
Definition: MtdGlobalRecoHarvester.cc:30
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
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
dqm::legacy::MonitorElement::getTH1
virtual TH1 * getTH1() const
Definition: MonitorElement.h:474
MtdGlobalRecoHarvester::folder_
const std::string folder_
Definition: MtdGlobalRecoHarvester.cc:24
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
folder_
std::string folder_
Definition: DQMEDAnalyzer.cc:60
MtdGlobalRecoHarvester::~MtdGlobalRecoHarvester
~MtdGlobalRecoHarvester() override
Definition: MtdGlobalRecoHarvester.cc:39
MtdGlobalRecoHarvester::meBtlEtaEff_
MonitorElement * meBtlEtaEff_
Definition: MtdGlobalRecoHarvester.cc:27
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
MtdGlobalRecoHarvester::MtdGlobalRecoHarvester
MtdGlobalRecoHarvester(const edm::ParameterSet &iConfig)
Definition: MtdGlobalRecoHarvester.cc:36
MtdGlobalRecoHarvester::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: MtdGlobalRecoHarvester.cc:253
MtdGlobalRecoHarvester::meBtlPhiEff_
MonitorElement * meBtlPhiEff_
Definition: MtdGlobalRecoHarvester.cc:28
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
std
Definition: JetResolutionObject.h:76
dqm::implementation::IGetter
Definition: DQMStore.h:484
dqm::impl::MonitorElement::getNbinsX
virtual int getNbinsX() const
get # of bins in X-axis
Definition: MonitorElement.cc:574
dqm::impl::MonitorElement::setBinError
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
Definition: MonitorElement.cc:709
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
dqm::implementation::IBooker
Definition: DQMStore.h:43
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
MtdGlobalRecoHarvester::dqmEndJob
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: MtdGlobalRecoHarvester.cc:42
ParameterSet.h
MtdGlobalRecoHarvester::meEtlPtEff_
MonitorElement * meEtlPtEff_[2]
Definition: MtdGlobalRecoHarvester.cc:32
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:592
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98