28 analyzerName_ = pset.
getParameter<
string>(
"analyzerName");
30 numberOfSteps_ = pset.
getParameter<
int>(
"numberOfSteps");
44 excludeBkgHistos_ = pset.
getParameter<
bool>(
"excludeBkgHistos");
46 outputFileName_ = pset.
getParameter<
string>(
"OutputFileName");
49 histo_index_photons_ = 0;
50 histo_index_conversions_ = 0;
51 histo_index_efficiency_ = 0;
52 histo_index_invMass_ = 0;
54 types_.push_back(
"All");
55 types_.push_back(
"GoodCandidate");
56 if (!excludeBkgHistos_)
57 types_.push_back(
"Background");
59 parts_.push_back(
"AllEcal");
60 parts_.push_back(
"Barrel");
61 parts_.push_back(
"Endcaps");
70 runClient(iBooker, iGetter);
80 if (!iGetter.
dirExists(
"Egamma/" + analyzerName_)) {
81 std::cout <<
"Folder Egamma/" + analyzerName_ +
" does not exist - Abort the efficiency calculation " << std::endl;
86 histo_index_photons_ = iGetter.
get(
"Egamma/" + analyzerName_ +
"/numberOfHistogramsInPhotonsFolder")->
getIntValue();
87 histo_index_conversions_ =
88 iGetter.
get(
"Egamma/" + analyzerName_ +
"/numberOfHistogramsInConversionsFolder")->
getIntValue();
89 histo_index_efficiency_ =
90 iGetter.
get(
"Egamma/" + analyzerName_ +
"/numberOfHistogramsInEfficiencyFolder")->
getIntValue();
91 histo_index_invMass_ = iGetter.
get(
"Egamma/" + analyzerName_ +
"/numberOfHistogramsInInvMassFolder")->
getIntValue();
95 string AllPath =
"Egamma/" + analyzerName_ +
"/AllPhotons/";
96 string IsoPath =
"Egamma/" + analyzerName_ +
"/GoodCandidatePhotons/";
97 string NonisoPath =
"Egamma/" + analyzerName_ +
"/BackgroundPhotons/";
98 string EffPath =
"Egamma/" + analyzerName_ +
"/Efficiencies/";
103 p_efficiencyVsEtaLoose_ = bookHisto(iBooker,
104 "EfficiencyVsEtaLoose",
105 "Fraction of Photons passing Loose Isolation vs #eta;#eta",
109 p_efficiencyVsEtLoose_ = bookHisto(iBooker,
110 "EfficiencyVsEtLoose",
111 "Fraction of Photons passing Loose Isolation vs E_{T};E_{T} (GeV)",
115 p_efficiencyVsEtaTight_ = bookHisto(iBooker,
116 "EfficiencyVsEtaTight",
117 "Fraction of Photons passing Tight Isolation vs #eta;#eta",
121 p_efficiencyVsEtTight_ = bookHisto(iBooker,
122 "EfficiencyVsEtTight",
123 "Fraction of Photons passing Tight Isolation vs E_{T};E_{T} (GeV)",
128 p_efficiencyVsEtaHLT_ =
129 bookHisto(iBooker,
"EfficiencyVsEtaHLT",
"Fraction of Photons firing HLT vs #eta;#eta",
etaBin,
etaMin,
etaMax);
130 p_efficiencyVsEtHLT_ = bookHisto(
131 iBooker,
"EfficiencyVsEtHLT",
"Fraction of Photons firing HLT vs E_{T};E_{T} (GeV)",
etBin,
etMin,
etMax);
133 p_convFractionVsEtaLoose_ =
135 "ConvFractionVsEtaLoose",
136 "Fraction of Loosely Isolated Photons which are matched to two tracks vs #eta;#eta",
140 p_convFractionVsEtLoose_ =
142 "ConvFractionVsEtLoose",
143 "Fraction of Loosely Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",
147 p_convFractionVsEtaTight_ =
149 "ConvFractionVsEtaTight",
150 "Fraction of Tightly Isolated Photons which are matched to two tracks vs #eta;#eta",
154 p_convFractionVsEtTight_ =
156 "ConvFractionVsEtTight",
157 "Fraction of Tightly Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",
162 p_vertexReconstructionEfficiencyVsEta_ =
164 "VertexReconstructionEfficiencyVsEta",
165 "Fraction of Converted Photons which have a valid vertex vs #eta;#eta",
172 book2DHistoVector(iBooker,
176 "Fraction of Converted Photons vs E_{T};E_{T} (GeV)",
180 book3DHistoVector(iBooker,
181 p_convFractionVsPhi_,
184 "Fraction of Converted Photons vs #phi;#phi",
188 book2DHistoVector(iBooker,
189 p_convFractionVsEta_,
192 "Fraction of Converted Photons vs #eta;#eta",
199 book2DHistoVector(iBooker,
200 p_badChannelsFractionVsPhi_,
202 "badChannelsFractionVsPhi",
203 "Fraction of Photons which have at least one bad channel vs #phi;#phi",
207 book2DHistoVector(iBooker,
208 p_badChannelsFractionVsEta_,
210 "badChannelsFractionVsEta",
211 "Fraction of Photons which have at least one bad channel vs #eta;#eta",
215 book2DHistoVector(iBooker,
216 p_badChannelsFractionVsEt_,
218 "badChannelsFractionVsEt",
219 "Fraction of Photons which have at least one bad channel vs E_{T};E_{T} (GeV)",
229 currentFolder_.str(
"");
230 currentFolder_ << AllPath <<
"Et above 20 GeV/";
233 dividend = retrieveHisto(iGetter, EffPath,
"EfficiencyVsEtaHLT");
234 numerator = retrieveHisto(iGetter, EffPath,
"phoEtaPostHLT");
235 denominator = retrieveHisto(iGetter, EffPath,
"phoEtaPreHLT");
236 dividePlots(dividend, numerator, denominator);
238 dividend = retrieveHisto(iGetter, EffPath,
"EfficiencyVsEtHLT");
239 numerator = retrieveHisto(iGetter, EffPath,
"phoEtPostHLT");
240 denominator = retrieveHisto(iGetter, EffPath,
"phoEtPreHLT");
241 dividePlots(dividend, numerator, denominator);
244 denominator = retrieveHisto(iGetter, currentFolder_.str(),
"phoEta");
246 dividend = retrieveHisto(iGetter, EffPath,
"EfficiencyVsEtaLoose");
247 numerator = retrieveHisto(iGetter, EffPath,
"phoEtaLoose");
248 dividePlots(dividend, numerator, denominator);
250 dividend = retrieveHisto(iGetter, EffPath,
"EfficiencyVsEtaTight");
251 numerator = retrieveHisto(iGetter, EffPath,
"phoEtaTight");
252 dividePlots(dividend, numerator, denominator);
255 denominator = retrieveHisto(iGetter, currentFolder_.str(),
"phoEtAllEcal");
257 dividend = retrieveHisto(iGetter, EffPath,
"EfficiencyVsEtLoose");
258 numerator = retrieveHisto(iGetter, EffPath,
"phoEtLoose");
259 dividePlots(dividend, numerator, denominator);
261 dividend = retrieveHisto(iGetter, EffPath,
"EfficiencyVsEtTight");
262 numerator = retrieveHisto(iGetter, EffPath,
"phoEtTight");
263 dividePlots(dividend, numerator, denominator);
266 dividend = retrieveHisto(iGetter, EffPath,
"ConvFractionVsEtaLoose");
267 numerator = retrieveHisto(iGetter, EffPath,
"convEtaLoose");
268 denominator = retrieveHisto(iGetter, EffPath,
"phoEtaLoose");
269 dividePlots(dividend, numerator, denominator);
271 dividend = retrieveHisto(iGetter, EffPath,
"ConvFractionVsEtaTight");
272 numerator = retrieveHisto(iGetter, EffPath,
"convEtaTight");
273 denominator = retrieveHisto(iGetter, EffPath,
"phoEtaTight");
274 dividePlots(dividend, numerator, denominator);
277 dividend = retrieveHisto(iGetter, EffPath,
"ConvFractionVsEtLoose");
278 numerator = retrieveHisto(iGetter, EffPath,
"convEtLoose");
279 denominator = retrieveHisto(iGetter, EffPath,
"phoEtLoose");
280 dividePlots(dividend, numerator, denominator);
282 dividend = retrieveHisto(iGetter, EffPath,
"ConvFractionVsEtTight");
283 numerator = retrieveHisto(iGetter, EffPath,
"convEtTight");
284 denominator = retrieveHisto(iGetter, EffPath,
"phoEtTight");
285 dividePlots(dividend, numerator, denominator);
288 dividend = retrieveHisto(iGetter, EffPath,
"VertexReconstructionEfficiencyVsEta");
289 numerator = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"phoConvEta");
290 denominator = retrieveHisto(iGetter, EffPath,
"phoEtaVertex");
291 dividePlots(dividend, numerator, denominator);
296 for (
int cut = 0;
cut != numberOfSteps_; ++
cut) {
297 currentFolder_.str(
"");
298 currentFolder_ <<
"Egamma/" + analyzerName_ +
"/" << types_[
type] <<
"Photons/Et above " << (
cut + 1) * cutStep_
304 dividend = retrieveHisto(iGetter, currentFolder_.str(),
"badChannelsFractionVsEt");
305 numerator = retrieveHisto(iGetter, currentFolder_.str(),
"phoEtBadChannels");
306 denominator = retrieveHisto(iGetter, currentFolder_.str(),
"phoEtAllEcal");
307 dividePlots(dividend, numerator, denominator);
310 dividend = retrieveHisto(iGetter, currentFolder_.str(),
"badChannelsFractionVsEta");
311 numerator = retrieveHisto(iGetter, currentFolder_.str(),
"phoEtaBadChannels");
312 denominator = retrieveHisto(iGetter, currentFolder_.str(),
"phoEta");
313 dividePlots(dividend, numerator, denominator);
316 dividend = retrieveHisto(iGetter, currentFolder_.str(),
"badChannelsFractionVsPhi");
317 numerator = retrieveHisto(iGetter, currentFolder_.str(),
"phoPhiBadChannels");
318 denominator = retrieveHisto(iGetter, currentFolder_.str(),
"phoPhiAllEcal");
319 dividePlots(dividend, numerator, denominator);
324 dividend = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"convFractionVsEt");
325 numerator = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"phoConvEtAllEcal");
326 denominator = retrieveHisto(iGetter, currentFolder_.str(),
"phoEtAllEcal");
327 dividePlots(dividend, numerator, denominator);
330 dividend = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"convFractionVsEta");
331 numerator = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"phoConvEtaForEfficiency");
332 denominator = retrieveHisto(iGetter, currentFolder_.str(),
"phoEta");
333 dividePlots(dividend, numerator, denominator);
336 dividend = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"convFractionVsPhiAllEcal");
337 numerator = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"phoConvPhiForEfficiencyAllEcal");
338 denominator = retrieveHisto(iGetter, currentFolder_.str(),
"phoPhiAllEcal");
339 dividePlots(dividend, numerator, denominator);
340 dividend = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"convFractionVsPhiBarrel");
341 numerator = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"phoConvPhiForEfficiencyBarrel");
342 denominator = retrieveHisto(iGetter, currentFolder_.str(),
"phoPhiBarrel");
343 dividePlots(dividend, numerator, denominator);
344 dividend = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"convFractionVsPhiEndcaps");
345 numerator = retrieveHisto(iGetter, currentFolder_.str() +
"Conversions/",
"phoConvPhiForEfficiencyEndcaps");
346 denominator = retrieveHisto(iGetter, currentFolder_.str(),
"phoPhiEndcaps");
347 dividePlots(dividend, numerator, denominator);
385 if (denominator != 0) {
387 err =
sqrt(value * (1 - value) / denominator);
399 stringstream histo_number_stream;
402 if (iBooker.
pwd().find(
"InvMass") != string::npos) {
403 histo_index_invMass_++;
404 histo_index = histo_index_invMass_;
406 if (iBooker.
pwd().find(
"Efficiencies") != string::npos) {
407 histo_index_efficiency_++;
408 histo_index = histo_index_efficiency_;
410 histo_number_stream <<
"h_";
411 if (histo_index < 10)
412 histo_number_stream <<
"0";
413 histo_number_stream << histo_index;
419 std::vector<vector<MonitorElement*> >& temp2DVector,
431 vector<MonitorElement*> temp1DVector;
434 bool conversionPlot =
false;
435 if (iBooker.
pwd().find(
"Conversions") != string::npos)
436 conversionPlot =
true;
438 if (conversionPlot) {
439 histo_index_conversions_++;
440 histo_index = histo_index_conversions_;
442 histo_index_photons_++;
443 histo_index = histo_index_photons_;
446 stringstream histo_number_stream;
447 histo_number_stream <<
"h_";
448 if (histo_index < 10)
449 histo_number_stream <<
"0";
450 histo_number_stream << histo_index <<
"_";
452 for (
int cut = 0;
cut != numberOfSteps_; ++
cut) {
456 currentFolder_.str(
"");
457 currentFolder_ <<
"Egamma/" + analyzerName_ +
"/" << types_[
type] <<
"Photons/Et above " << (
cut + 1) * cutStep_
460 currentFolder_ <<
"/Conversions";
466 kind =
" Conversions: ";
470 if (histoType ==
"1D")
471 temp1DVector.push_back(
473 else if (histoType ==
"2D")
474 temp1DVector.push_back(iBooker.
book2D(
476 else if (histoType ==
"Profile")
482 temp2DVector.push_back(temp1DVector);
483 temp1DVector.clear();
488 std::vector<vector<vector<MonitorElement*> > >& temp3DVector,
500 vector<MonitorElement*> temp1DVector;
501 vector<vector<MonitorElement*> > temp2DVector;
504 bool conversionPlot =
false;
505 if (iBooker.
pwd().find(
"Conversions") != string::npos)
506 conversionPlot =
true;
508 if (conversionPlot) {
509 histo_index_conversions_++;
510 histo_index = histo_index_conversions_;
512 histo_index_photons_++;
513 histo_index = histo_index_photons_;
516 stringstream histo_number_stream;
517 histo_number_stream <<
"h_";
518 if (histo_index < 10)
519 histo_number_stream <<
"0";
520 histo_number_stream << histo_index <<
"_";
522 for (
int cut = 0;
cut != numberOfSteps_; ++
cut) {
528 currentFolder_.str(
"");
529 currentFolder_ <<
"Egamma/" + analyzerName_ +
"/" << types_[
type] <<
"Photons/Et above " << (
cut + 1) * cutStep_
532 currentFolder_ <<
"/Conversions";
538 kind =
" Conversions: ";
542 if (histoType ==
"1D")
543 temp1DVector.push_back(iBooker.
book1D(histo_number_stream.str() + histoName + parts_[
part],
548 else if (histoType ==
"2D")
549 temp1DVector.push_back(iBooker.
book2D(histo_number_stream.str() + histoName + parts_[
part],
557 else if (histoType ==
"Profile")
558 temp1DVector.push_back(iBooker.
bookProfile(histo_number_stream.str() + histoName + parts_[
part],
570 temp2DVector.push_back(temp1DVector);
571 temp1DVector.clear();
574 temp3DVector.push_back(temp2DVector);
575 temp2DVector.clear();
584 vector<MonitorElement*> histoVector;
585 uint indexOfRelevantHistogram = 0;
586 string fullMEName =
"";
589 string MEName = histoVector[
index]->getName();
590 if (MEName.find(name) != string::npos) {
591 indexOfRelevantHistogram =
index;
595 return histoVector[indexOfRelevantHistogram];
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void setEntries(double nentries)
set # of entries
~PhotonOfflineClient() override
void setCurrentFolder(std::string const &fullpath)
std::vector< MonitorElement * > getContents(Args &&...args)
PhotonOfflineClient(const edm::ParameterSet &pset)
virtual int64_t getIntValue() const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
MonitorElement * retrieveHisto(DQMStore::IGetter &iGetter, std::string dir, std::string name)
void book2DHistoVector(DQMStore::IBooker &iBooker, std::vector< std::vector< MonitorElement * > > &vecOfHist, std::string histoType, std::string histoName, std::string title, int xbin, double xmin, double xmax, int ybin=1, double ymin=1, double ymax=2)
bool dirExists(std::string const &path)
virtual int getNbinsX() const
get # of bins in X-axis
virtual double getEntries() const
get # of entries
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
void dividePlots(MonitorElement *dividend, MonitorElement *numerator, MonitorElement *denominator)
virtual double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * bookHisto(DQMStore::IBooker &iBooker, std::string histoName, std::string title, int bin, double min, double max)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
void book3DHistoVector(DQMStore::IBooker &iBooker, std::vector< std::vector< std::vector< MonitorElement * > > > &vecOfHist, std::string histoType, std::string histoName, std::string title, int xbin, double xmin, double xmax, int ybin=1, double ymin=1, double ymax=2)
virtual void runClient(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter)
std::string const & pwd()
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * get(std::string const &path)
void setCurrentFolder(std::string const &fullpath)