33 analyzerName_ = pset.
getParameter<
string>(
"analyzerName");
35 numberOfSteps_ = pset.
getParameter<
int>(
"numberOfSteps");
49 excludeBkgHistos_ = pset.
getParameter<
bool>(
"excludeBkgHistos");
51 outputFileName_ = pset.
getParameter<
string>(
"OutputFileName");
54 histo_index_photons_ = 0;
55 histo_index_conversions_ = 0;
56 histo_index_efficiency_ = 0;
57 histo_index_invMass_ = 0;
59 types_.push_back(
"All");
60 types_.push_back(
"GoodCandidate");
61 if (!excludeBkgHistos_) types_.push_back(
"Background");
63 parts_.push_back(
"AllEcal");
64 parts_.push_back(
"Barrel");
65 parts_.push_back(
"Endcaps");
76 if(!standAlone_) runClient(iBooker, iGetter);
87 if(!iGetter.
dirExists(
"Egamma/"+analyzerName_)){
88 std::cout <<
"Folder Egamma/"+analyzerName_+
" does not exist - Abort the efficiency calculation " << std::endl;
93 histo_index_photons_ = iGetter.
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInPhotonsFolder")->
getIntValue();
94 histo_index_conversions_ = iGetter.
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInConversionsFolder")->
getIntValue();
95 histo_index_efficiency_ = iGetter.
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInEfficiencyFolder")->
getIntValue();
96 histo_index_invMass_ = iGetter.
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInInvMassFolder")->
getIntValue();
100 iGetter.
removeElement(
"numberOfHistogramsInConversionsFolder");
101 iGetter.
removeElement(
"numberOfHistogramsInEfficiencyFolder");
104 string AllPath =
"Egamma/"+analyzerName_+
"/AllPhotons/";
105 string IsoPath =
"Egamma/"+analyzerName_+
"/GoodCandidatePhotons/";
106 string NonisoPath =
"Egamma/"+analyzerName_+
"/BackgroundPhotons/";
107 string EffPath =
"Egamma/"+analyzerName_+
"/Efficiencies/";
112 p_efficiencyVsEtaLoose_ = bookHisto(iBooker,
"EfficiencyVsEtaLoose",
"Fraction of Photons passing Loose Isolation vs #eta;#eta",
etaBin,
etaMin,
etaMax);
113 p_efficiencyVsEtLoose_ = bookHisto(iBooker,
"EfficiencyVsEtLoose",
"Fraction of Photons passing Loose Isolation vs E_{T};E_{T} (GeV)",
etBin,
etMin,
etMax);
114 p_efficiencyVsEtaTight_ = bookHisto(iBooker,
"EfficiencyVsEtaTight",
"Fraction of Photons passing Tight Isolation vs #eta;#eta",
etaBin,
etaMin,
etaMax);
115 p_efficiencyVsEtTight_ = bookHisto(iBooker,
"EfficiencyVsEtTight",
"Fraction of Photons passing Tight Isolation vs E_{T};E_{T} (GeV)",
etBin,
etMin,
etMax);
117 p_efficiencyVsEtaHLT_ = bookHisto(iBooker,
"EfficiencyVsEtaHLT",
"Fraction of Photons firing HLT vs #eta;#eta",
etaBin,
etaMin,
etaMax);
118 p_efficiencyVsEtHLT_ = bookHisto(iBooker,
"EfficiencyVsEtHLT",
"Fraction of Photons firing HLT vs E_{T};E_{T} (GeV)",
etBin,
etMin,
etMax);
120 p_convFractionVsEtaLoose_ = bookHisto(iBooker,
"ConvFractionVsEtaLoose",
"Fraction of Loosely Isolated Photons which are matched to two tracks vs #eta;#eta",
etaBin,
etaMin,
etaMax);
121 p_convFractionVsEtLoose_ = bookHisto(iBooker,
"ConvFractionVsEtLoose",
"Fraction of Loosely Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",
etBin,
etMin,
etMax);
122 p_convFractionVsEtaTight_ = bookHisto(iBooker,
"ConvFractionVsEtaTight",
"Fraction of Tightly Isolated Photons which are matched to two tracks vs #eta;#eta",
etaBin,
etaMin,
etaMax);
123 p_convFractionVsEtTight_ = bookHisto(iBooker,
"ConvFractionVsEtTight",
"Fraction of Tightly Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",
etBin,
etMin,
etMax);
125 p_vertexReconstructionEfficiencyVsEta_ = bookHisto(iBooker,
"VertexReconstructionEfficiencyVsEta",
"Fraction of Converted Photons which have a valid vertex vs #eta;#eta",
etaBin,
etaMin,
etaMax);
129 book2DHistoVector(iBooker, p_convFractionVsEt_,
"1D",
"convFractionVsEt",
"Fraction of Converted Photons vs E_{T};E_{T} (GeV)",
etBin,
etMin,
etMax);
130 book3DHistoVector(iBooker, p_convFractionVsPhi_,
"1D",
"convFractionVsPhi",
"Fraction of Converted Photons vs #phi;#phi",
phiBin,
phiMin,
phiMax);
131 book2DHistoVector(iBooker, p_convFractionVsEta_,
"1D",
"convFractionVsEta",
"Fraction of Converted Photons vs #eta;#eta",
etaBin,
etaMin,
etaMax);
135 book2DHistoVector(iBooker, p_badChannelsFractionVsPhi_,
"1D",
"badChannelsFractionVsPhi",
"Fraction of Photons which have at least one bad channel vs #phi;#phi",
phiBin,
phiMin,
phiMax);
136 book2DHistoVector(iBooker, p_badChannelsFractionVsEta_,
"1D",
"badChannelsFractionVsEta",
"Fraction of Photons which have at least one bad channel vs #eta;#eta",
etaBin,
etaMin,
etaMax);
137 book2DHistoVector(iBooker, p_badChannelsFractionVsEt_,
"1D",
"badChannelsFractionVsEt",
"Fraction of Photons which have at least one bad channel vs E_{T};E_{T} (GeV)",
etBin,
etMin,
etMax);
144 currentFolder_.str(
"");
145 currentFolder_ << AllPath <<
"Et above 20 GeV/";
148 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtaHLT");
149 numerator = retrieveHisto(iGetter,EffPath,
"phoEtaPostHLT");
150 denominator = retrieveHisto(iGetter,EffPath,
"phoEtaPreHLT");
151 dividePlots(dividend,numerator,denominator);
153 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtHLT");
154 numerator = retrieveHisto(iGetter,EffPath,
"phoEtPostHLT");
155 denominator = retrieveHisto(iGetter,EffPath,
"phoEtPreHLT");
156 dividePlots(dividend,numerator,denominator);
159 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEta");
161 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtaLoose");
162 numerator = retrieveHisto(iGetter,EffPath,
"phoEtaLoose");
163 dividePlots(dividend,numerator,denominator);
165 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtaTight");
166 numerator = retrieveHisto(iGetter,EffPath,
"phoEtaTight");
167 dividePlots(dividend,numerator,denominator);
170 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEtAllEcal");
172 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtLoose");
173 numerator = retrieveHisto(iGetter,EffPath,
"phoEtLoose");
174 dividePlots(dividend,numerator,denominator);
176 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtTight");
177 numerator = retrieveHisto(iGetter,EffPath,
"phoEtTight");
178 dividePlots(dividend,numerator,denominator);
181 dividend = retrieveHisto(iGetter,EffPath,
"ConvFractionVsEtaLoose");
182 numerator = retrieveHisto(iGetter,EffPath,
"convEtaLoose");
183 denominator = retrieveHisto(iGetter,EffPath,
"phoEtaLoose");
184 dividePlots(dividend,numerator,denominator);
186 dividend = retrieveHisto(iGetter,EffPath,
"ConvFractionVsEtaTight");
187 numerator = retrieveHisto(iGetter,EffPath,
"convEtaTight");
188 denominator = retrieveHisto(iGetter,EffPath,
"phoEtaTight");
189 dividePlots(dividend,numerator,denominator);
192 dividend = retrieveHisto(iGetter,EffPath,
"ConvFractionVsEtLoose");
193 numerator = retrieveHisto(iGetter,EffPath,
"convEtLoose");
194 denominator = retrieveHisto(iGetter,EffPath,
"phoEtLoose");
195 dividePlots(dividend,numerator,denominator);
197 dividend = retrieveHisto(iGetter,EffPath,
"ConvFractionVsEtTight");
198 numerator = retrieveHisto(iGetter,EffPath,
"convEtTight");
199 denominator = retrieveHisto(iGetter,EffPath,
"phoEtTight");
200 dividePlots(dividend,numerator,denominator);
203 dividend = retrieveHisto(iGetter,EffPath,
"VertexReconstructionEfficiencyVsEta");
204 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvEta");
205 denominator = retrieveHisto(iGetter,EffPath,
"phoEtaVertex");
206 dividePlots(dividend,numerator,denominator);
226 for (
int cut = 0;
cut !=numberOfSteps_; ++
cut) {
228 currentFolder_.str(
"");
229 currentFolder_ <<
"Egamma/"+analyzerName_+
"/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV/";
234 dividend = retrieveHisto(iGetter,currentFolder_.str(),
"badChannelsFractionVsEt");
235 numerator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEtBadChannels");
236 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEtAllEcal");
237 dividePlots(dividend,numerator,denominator);
240 dividend = retrieveHisto(iGetter,currentFolder_.str(),
"badChannelsFractionVsEta");
241 numerator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEtaBadChannels");
242 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEta");
243 dividePlots(dividend,numerator,denominator);
246 dividend = retrieveHisto(iGetter,currentFolder_.str(),
"badChannelsFractionVsPhi");
247 numerator = retrieveHisto(iGetter,currentFolder_.str(),
"phoPhiBadChannels");
248 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoPhiAllEcal");
249 dividePlots(dividend,numerator,denominator);
254 dividend = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"convFractionVsEt");
255 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvEtAllEcal");
256 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEtAllEcal");
257 dividePlots(dividend,numerator,denominator);
260 dividend = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"convFractionVsEta");
261 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvEtaForEfficiency");
262 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEta");
263 dividePlots(dividend,numerator,denominator);
266 dividend = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"convFractionVsPhiAllEcal");
267 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyAllEcal");
268 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoPhiAllEcal");
269 dividePlots(dividend,numerator,denominator);
270 dividend = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"convFractionVsPhiBarrel");
271 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyBarrel");
272 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoPhiBarrel");
273 dividePlots(dividend,numerator,denominator);
274 dividend = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"convFractionVsPhiEndcaps");
275 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyEndcaps");
276 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoPhiEndcaps");
277 dividePlots(dividend,numerator,denominator);
299 for (
int j=1; j<=numerator->
getNbinsX(); j++){
319 for (
int j=1; j<=numerator->
getNbinsX(); j++){
322 err =
sqrt( value*(1-value) / denominator);
337 stringstream histo_number_stream;
341 if(iBooker.
pwd().find(
"InvMass" ) != string::npos){
342 histo_index_invMass_++;
343 histo_index = histo_index_invMass_;
345 if(iBooker.
pwd().find(
"Efficiencies" ) != string::npos){
346 histo_index_efficiency_++;
347 histo_index = histo_index_efficiency_;
349 histo_number_stream <<
"h_";
350 if(histo_index<10) histo_number_stream <<
"0";
351 histo_number_stream << histo_index;
366 vector<MonitorElement*> temp1DVector;
369 bool conversionPlot =
false;
370 if(iBooker.
pwd().find(
"Conversions" ) != string::npos) conversionPlot =
true;
374 histo_index_conversions_++;
375 histo_index = histo_index_conversions_;
378 histo_index_photons_++;
379 histo_index = histo_index_photons_;
383 stringstream histo_number_stream;
384 histo_number_stream <<
"h_";
385 if(histo_index<10) histo_number_stream <<
"0";
386 histo_number_stream << histo_index <<
"_";
389 for(
int cut = 0;
cut != numberOfSteps_; ++
cut){
393 currentFolder_.str(
"");
394 currentFolder_ <<
"Egamma/"+analyzerName_+
"/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV";
395 if(conversionPlot) currentFolder_ <<
"/Conversions";
400 if(conversionPlot) kind =
" Conversions: ";
401 else kind =
" Photons: ";
403 if(histoType==
"1D") temp1DVector.push_back(iBooker.
book1D(histo_number_stream.str()+histoName,types_[
type]+kind+
title,xbin,
xmin,
xmax));
404 else if(histoType==
"2D") temp1DVector.push_back(iBooker.
book2D(histo_number_stream.str()+histoName,types_[
type]+kind+
title,xbin,
xmin,
xmax,ybin,
ymin,
ymax));
409 temp2DVector.push_back(temp1DVector);
410 temp1DVector.clear();
427 vector<MonitorElement*> temp1DVector;
428 vector<vector<MonitorElement*> > temp2DVector;
431 bool conversionPlot =
false;
432 if(iBooker.
pwd().find(
"Conversions" ) != string::npos) conversionPlot =
true;
436 histo_index_conversions_++;
437 histo_index = histo_index_conversions_;
440 histo_index_photons_++;
441 histo_index = histo_index_photons_;
444 stringstream histo_number_stream;
445 histo_number_stream <<
"h_";
446 if(histo_index<10) histo_number_stream <<
"0";
447 histo_number_stream << histo_index <<
"_";
450 for(
int cut = 0;
cut != numberOfSteps_; ++
cut){
456 currentFolder_.str(
"");
457 currentFolder_ <<
"Egamma/"+analyzerName_+
"/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV";
458 if(conversionPlot) currentFolder_ <<
"/Conversions";
463 if(conversionPlot) kind =
" Conversions: ";
464 else kind =
" Photons: ";
466 if(histoType==
"1D") temp1DVector.push_back(iBooker.
book1D( histo_number_stream.str()+histoName+parts_[
part],types_[
type]+kind+parts_[
part]+
": "+
title,xbin,
xmin,
xmax));
474 temp2DVector.push_back(temp1DVector);
475 temp1DVector.clear();
478 temp3DVector.push_back(temp2DVector);
479 temp2DVector.clear();
489 vector<MonitorElement*> histoVector;
490 uint indexOfRelevantHistogram=0;
491 string fullMEName =
"";
494 string MEName = histoVector[
index]->getName();
495 if(MEName.find( name ) != string::npos){
496 indexOfRelevantHistogram =
index;
500 return histoVector[indexOfRelevantHistogram];
std::vector< MonitorElement * > getContents(Args &&...args)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int64_t getIntValue() const
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * bookProfile(Args &&...args)
~PhotonOfflineClient() override
MonitorElement * get(const std::string &path)
PhotonOfflineClient(const edm::ParameterSet &pset)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
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)
MonitorElement * retrieveHisto(DQMStore::IGetter &iGetter, std::string dir, std::string name)
void dividePlots(MonitorElement *dividend, MonitorElement *numerator, MonitorElement *denominator)
MonitorElement * book1D(Args &&...args)
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
void setEntries(double nentries)
set # of entries
bin
set the eta bin as selection string.
bool dirExists(const std::string &path)
double getEntries() const
get # of entries
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
const std::string & pwd()
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)
void setCurrentFolder(const std::string &fullpath)
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX() const
get # of bins in X-axis
MonitorElement * bookHisto(DQMStore::IBooker &iBooker, std::string histoName, std::string title, int bin, double min, double max)
void removeElement(Args &&...args)