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");
77 if(!standAlone_) runClient(iBooker, iGetter);
88 if(!iGetter.
dirExists(
"Egamma/"+analyzerName_)){
89 std::cout <<
"Folder Egamma/"+analyzerName_+
" does not exist - Abort the efficiency calculation " << std::endl;
94 histo_index_photons_ = iGetter.
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInPhotonsFolder")->
getIntValue();
95 histo_index_conversions_ = iGetter.
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInConversionsFolder")->
getIntValue();
96 histo_index_efficiency_ = iGetter.
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInEfficiencyFolder")->
getIntValue();
97 histo_index_invMass_ = iGetter.
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInInvMassFolder")->
getIntValue();
101 iGetter.
removeElement(
"numberOfHistogramsInConversionsFolder");
102 iGetter.
removeElement(
"numberOfHistogramsInEfficiencyFolder");
105 string AllPath =
"Egamma/"+analyzerName_+
"/AllPhotons/";
106 string IsoPath =
"Egamma/"+analyzerName_+
"/GoodCandidatePhotons/";
107 string NonisoPath =
"Egamma/"+analyzerName_+
"/BackgroundPhotons/";
108 string EffPath =
"Egamma/"+analyzerName_+
"/Efficiencies/";
113 p_efficiencyVsEtaLoose_ = bookHisto(iBooker,
"EfficiencyVsEtaLoose",
"Fraction of Photons passing Loose Isolation vs #eta;#eta",
etaBin,
etaMin,
etaMax);
114 p_efficiencyVsEtLoose_ = bookHisto(iBooker,
"EfficiencyVsEtLoose",
"Fraction of Photons passing Loose Isolation vs E_{T};E_{T} (GeV)",etBin,
etMin,etMax);
115 p_efficiencyVsEtaTight_ = bookHisto(iBooker,
"EfficiencyVsEtaTight",
"Fraction of Photons passing Tight Isolation vs #eta;#eta",
etaBin,
etaMin,
etaMax);
116 p_efficiencyVsEtTight_ = bookHisto(iBooker,
"EfficiencyVsEtTight",
"Fraction of Photons passing Tight Isolation vs E_{T};E_{T} (GeV)",etBin,
etMin,etMax);
118 p_efficiencyVsEtaHLT_ = bookHisto(iBooker,
"EfficiencyVsEtaHLT",
"Fraction of Photons firing HLT vs #eta;#eta",
etaBin,
etaMin,
etaMax);
119 p_efficiencyVsEtHLT_ = bookHisto(iBooker,
"EfficiencyVsEtHLT",
"Fraction of Photons firing HLT vs E_{T};E_{T} (GeV)",etBin,
etMin,etMax);
121 p_convFractionVsEtaLoose_ = bookHisto(iBooker,
"ConvFractionVsEtaLoose",
"Fraction of Loosely Isolated Photons which are matched to two tracks vs #eta;#eta",
etaBin,
etaMin,
etaMax);
122 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);
123 p_convFractionVsEtaTight_ = bookHisto(iBooker,
"ConvFractionVsEtaTight",
"Fraction of Tightly Isolated Photons which are matched to two tracks vs #eta;#eta",
etaBin,
etaMin,
etaMax);
124 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);
126 p_vertexReconstructionEfficiencyVsEta_ = bookHisto(iBooker,
"VertexReconstructionEfficiencyVsEta",
"Fraction of Converted Photons which have a valid vertex vs #eta;#eta",
etaBin,
etaMin,
etaMax);
130 book2DHistoVector(iBooker, p_convFractionVsEt_,
"1D",
"convFractionVsEt",
"Fraction of Converted Photons vs E_{T};E_{T} (GeV)",etBin,
etMin,etMax);
131 book3DHistoVector(iBooker, p_convFractionVsPhi_,
"1D",
"convFractionVsPhi",
"Fraction of Converted Photons vs #phi;#phi",phiBin,phiMin,phiMax);
132 book2DHistoVector(iBooker, p_convFractionVsEta_,
"1D",
"convFractionVsEta",
"Fraction of Converted Photons vs #eta;#eta",
etaBin,
etaMin,
etaMax);
136 book2DHistoVector(iBooker, p_badChannelsFractionVsPhi_,
"1D",
"badChannelsFractionVsPhi",
"Fraction of Photons which have at least one bad channel vs #phi;#phi",phiBin,phiMin,phiMax);
137 book2DHistoVector(iBooker, p_badChannelsFractionVsEta_,
"1D",
"badChannelsFractionVsEta",
"Fraction of Photons which have at least one bad channel vs #eta;#eta",
etaBin,
etaMin,
etaMax);
138 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);
145 currentFolder_.str(
"");
146 currentFolder_ << AllPath <<
"Et above 20 GeV/";
149 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtaHLT");
150 numerator = retrieveHisto(iGetter,EffPath,
"phoEtaPostHLT");
151 denominator = retrieveHisto(iGetter,EffPath,
"phoEtaPreHLT");
152 dividePlots(dividend,numerator,denominator);
154 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtHLT");
155 numerator = retrieveHisto(iGetter,EffPath,
"phoEtPostHLT");
156 denominator = retrieveHisto(iGetter,EffPath,
"phoEtPreHLT");
157 dividePlots(dividend,numerator,denominator);
160 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEta");
162 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtaLoose");
163 numerator = retrieveHisto(iGetter,EffPath,
"phoEtaLoose");
164 dividePlots(dividend,numerator,denominator);
166 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtaTight");
167 numerator = retrieveHisto(iGetter,EffPath,
"phoEtaTight");
168 dividePlots(dividend,numerator,denominator);
171 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEtAllEcal");
173 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtLoose");
174 numerator = retrieveHisto(iGetter,EffPath,
"phoEtLoose");
175 dividePlots(dividend,numerator,denominator);
177 dividend = retrieveHisto(iGetter,EffPath,
"EfficiencyVsEtTight");
178 numerator = retrieveHisto(iGetter,EffPath,
"phoEtTight");
179 dividePlots(dividend,numerator,denominator);
182 dividend = retrieveHisto(iGetter,EffPath,
"ConvFractionVsEtaLoose");
183 numerator = retrieveHisto(iGetter,EffPath,
"convEtaLoose");
184 denominator = retrieveHisto(iGetter,EffPath,
"phoEtaLoose");
185 dividePlots(dividend,numerator,denominator);
187 dividend = retrieveHisto(iGetter,EffPath,
"ConvFractionVsEtaTight");
188 numerator = retrieveHisto(iGetter,EffPath,
"convEtaTight");
189 denominator = retrieveHisto(iGetter,EffPath,
"phoEtaTight");
190 dividePlots(dividend,numerator,denominator);
193 dividend = retrieveHisto(iGetter,EffPath,
"ConvFractionVsEtLoose");
194 numerator = retrieveHisto(iGetter,EffPath,
"convEtLoose");
195 denominator = retrieveHisto(iGetter,EffPath,
"phoEtLoose");
196 dividePlots(dividend,numerator,denominator);
198 dividend = retrieveHisto(iGetter,EffPath,
"ConvFractionVsEtTight");
199 numerator = retrieveHisto(iGetter,EffPath,
"convEtTight");
200 denominator = retrieveHisto(iGetter,EffPath,
"phoEtTight");
201 dividePlots(dividend,numerator,denominator);
204 dividend = retrieveHisto(iGetter,EffPath,
"VertexReconstructionEfficiencyVsEta");
205 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvEta");
206 denominator = retrieveHisto(iGetter,EffPath,
"phoEtaVertex");
207 dividePlots(dividend,numerator,denominator);
227 for (
int cut = 0;
cut !=numberOfSteps_; ++
cut) {
229 currentFolder_.str(
"");
230 currentFolder_ <<
"Egamma/"+analyzerName_+
"/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV/";
235 dividend = retrieveHisto(iGetter,currentFolder_.str(),
"badChannelsFractionVsEt");
236 numerator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEtBadChannels");
237 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEtAllEcal");
238 dividePlots(dividend,numerator,denominator);
241 dividend = retrieveHisto(iGetter,currentFolder_.str(),
"badChannelsFractionVsEta");
242 numerator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEtaBadChannels");
243 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEta");
244 dividePlots(dividend,numerator,denominator);
247 dividend = retrieveHisto(iGetter,currentFolder_.str(),
"badChannelsFractionVsPhi");
248 numerator = retrieveHisto(iGetter,currentFolder_.str(),
"phoPhiBadChannels");
249 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoPhiAllEcal");
250 dividePlots(dividend,numerator,denominator);
255 dividend = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"convFractionVsEt");
256 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvEtAllEcal");
257 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEtAllEcal");
258 dividePlots(dividend,numerator,denominator);
261 dividend = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"convFractionVsEta");
262 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvEtaForEfficiency");
263 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoEta");
264 dividePlots(dividend,numerator,denominator);
267 dividend = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"convFractionVsPhiAllEcal");
268 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyAllEcal");
269 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoPhiAllEcal");
270 dividePlots(dividend,numerator,denominator);
271 dividend = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"convFractionVsPhiBarrel");
272 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyBarrel");
273 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoPhiBarrel");
274 dividePlots(dividend,numerator,denominator);
275 dividend = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"convFractionVsPhiEndcaps");
276 numerator = retrieveHisto(iGetter,currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyEndcaps");
277 denominator = retrieveHisto(iGetter,currentFolder_.str(),
"phoPhiEndcaps");
278 dividePlots(dividend,numerator,denominator);
323 err =
sqrt( value*(1-value) / denominator);
338 stringstream histo_number_stream;
342 if(iBooker.
pwd().find(
"InvMass" ) != string::npos){
343 histo_index_invMass_++;
344 histo_index = histo_index_invMass_;
346 if(iBooker.
pwd().find(
"Efficiencies" ) != string::npos){
347 histo_index_efficiency_++;
348 histo_index = histo_index_efficiency_;
350 histo_number_stream <<
"h_";
351 if(histo_index<10) histo_number_stream <<
"0";
352 histo_number_stream << histo_index;
367 vector<MonitorElement*> temp1DVector;
370 bool conversionPlot =
false;
371 if(iBooker.
pwd().find(
"Conversions" ) != string::npos) conversionPlot =
true;
375 histo_index_conversions_++;
376 histo_index = histo_index_conversions_;
379 histo_index_photons_++;
380 histo_index = histo_index_photons_;
384 stringstream histo_number_stream;
385 histo_number_stream <<
"h_";
386 if(histo_index<10) histo_number_stream <<
"0";
387 histo_number_stream << histo_index <<
"_";
390 for(
int cut = 0;
cut != numberOfSteps_; ++
cut){
394 currentFolder_.str(
"");
395 currentFolder_ <<
"Egamma/"+analyzerName_+
"/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV";
396 if(conversionPlot) currentFolder_ <<
"/Conversions";
401 if(conversionPlot) kind =
" Conversions: ";
402 else kind =
" Photons: ";
404 if(histoType==
"1D") temp1DVector.push_back(iBooker.
book1D(histo_number_stream.str()+histoName,types_[
type]+kind+
title,xbin,
xmin,
xmax));
405 else if(histoType==
"2D") temp1DVector.push_back(iBooker.
book2D(histo_number_stream.str()+histoName,types_[
type]+kind+
title,xbin,
xmin,
xmax,ybin,
ymin,
ymax));
410 temp2DVector.push_back(temp1DVector);
411 temp1DVector.clear();
428 vector<MonitorElement*> temp1DVector;
429 vector<vector<MonitorElement*> > temp2DVector;
432 bool conversionPlot =
false;
433 if(iBooker.
pwd().find(
"Conversions" ) != string::npos) conversionPlot =
true;
437 histo_index_conversions_++;
438 histo_index = histo_index_conversions_;
441 histo_index_photons_++;
442 histo_index = histo_index_photons_;
445 stringstream histo_number_stream;
446 histo_number_stream <<
"h_";
447 if(histo_index<10) histo_number_stream <<
"0";
448 histo_number_stream << histo_index <<
"_";
451 for(
int cut = 0;
cut != numberOfSteps_; ++
cut){
457 currentFolder_.str(
"");
458 currentFolder_ <<
"Egamma/"+analyzerName_+
"/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV";
459 if(conversionPlot) currentFolder_ <<
"/Conversions";
464 if(conversionPlot) kind =
" Conversions: ";
465 else kind =
" Photons: ";
467 if(histoType==
"1D") temp1DVector.push_back(iBooker.
book1D( histo_number_stream.str()+histoName+parts_[
part],types_[
type]+kind+parts_[
part]+
": "+
title,xbin,
xmin,
xmax));
475 temp2DVector.push_back(temp1DVector);
476 temp1DVector.clear();
479 temp3DVector.push_back(temp2DVector);
480 temp2DVector.clear();
490 vector<MonitorElement*> histoVector;
491 uint indexOfRelevantHistogram=0;
492 string fullMEName =
"";
495 string MEName = histoVector[
index]->getName();
496 if(MEName.find( name ) != string::npos){
497 indexOfRelevantHistogram =
index;
501 return histoVector[indexOfRelevantHistogram];
std::vector< MonitorElement * > getContents(Args &&...args)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * bookProfile(Args &&...args)
MonitorElement * get(const std::string &path)
const std::string & pwd(void)
PhotonOfflineClient(const edm::ParameterSet &pset)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
double getEntries(void) const
get # of entries
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
virtual ~PhotonOfflineClient()
bool dirExists(const std::string &path)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
int64_t getIntValue(void) const
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(void) const
get # of bins in X-axis
void setEfficiencyFlag(void)
MonitorElement * bookHisto(DQMStore::IBooker &iBooker, std::string histoName, std::string title, int bin, double min, double max)
void removeElement(Args &&...args)