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");
80 if(standAlone_) runClient();
84 if(!standAlone_) runClient();
91 if(batch_)
dbe_->
open(inputFileName_);
95 std::cout <<
"Folder Egamma/"+analyzerName_+
" does not exist - Abort the efficiency calculation " << std::endl;
100 histo_index_photons_ =
dbe_->
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInPhotonsFolder")->
getIntValue();
101 histo_index_conversions_ =
dbe_->
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInConversionsFolder")->
getIntValue();
102 histo_index_efficiency_ =
dbe_->
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInEfficiencyFolder")->
getIntValue();
103 histo_index_invMass_ =
dbe_->
get(
"Egamma/"+analyzerName_+
"/numberOfHistogramsInInvMassFolder")->
getIntValue();
111 string AllPath =
"Egamma/"+analyzerName_+
"/AllPhotons/";
112 string IsoPath =
"Egamma/"+analyzerName_+
"/GoodCandidatePhotons/";
113 string NonisoPath =
"Egamma/"+analyzerName_+
"/BackgroundPhotons/";
114 string EffPath =
"Egamma/"+analyzerName_+
"/Efficiencies/";
119 p_efficiencyVsEtaLoose_ = bookHisto(
"EfficiencyVsEtaLoose",
"Fraction of Photons passing Loose Isolation vs #eta;#eta",etaBin,etaMin, etaMax);
120 p_efficiencyVsEtLoose_ = bookHisto(
"EfficiencyVsEtLoose",
"Fraction of Photons passing Loose Isolation vs E_{T};E_{T} (GeV)",etBin,etMin,etMax);
121 p_efficiencyVsEtaTight_ = bookHisto(
"EfficiencyVsEtaTight",
"Fraction of Photons passing Tight Isolation vs #eta;#eta",etaBin,etaMin, etaMax);
122 p_efficiencyVsEtTight_ = bookHisto(
"EfficiencyVsEtTight",
"Fraction of Photons passing Tight Isolation vs E_{T};E_{T} (GeV)",etBin,etMin,etMax);
124 p_efficiencyVsEtaHLT_ = bookHisto(
"EfficiencyVsEtaHLT",
"Fraction of Photons firing HLT vs #eta;#eta",etaBin,etaMin, etaMax);
125 p_efficiencyVsEtHLT_ = bookHisto(
"EfficiencyVsEtHLT",
"Fraction of Photons firing HLT vs E_{T};E_{T} (GeV)",etBin,etMin,etMax);
127 p_convFractionVsEtaLoose_ = bookHisto(
"ConvFractionVsEtaLoose",
"Fraction of Loosely Isolated Photons which are matched to two tracks vs #eta;#eta",etaBin,etaMin, etaMax);
128 p_convFractionVsEtLoose_ = bookHisto(
"ConvFractionVsEtLoose",
"Fraction of Loosely Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",etBin,etMin,etMax);
129 p_convFractionVsEtaTight_ = bookHisto(
"ConvFractionVsEtaTight",
"Fraction of Tightly Isolated Photons which are matched to two tracks vs #eta;#eta",etaBin,etaMin, etaMax);
130 p_convFractionVsEtTight_ = bookHisto(
"ConvFractionVsEtTight",
"Fraction of Tightly Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",etBin,etMin,etMax);
132 p_vertexReconstructionEfficiencyVsEta_ = bookHisto(
"VertexReconstructionEfficiencyVsEta",
"Fraction of Converted Photons which have a valid vertex vs #eta;#eta",etaBin,etaMin, etaMax);
136 p_convFractionVsEt_ = book2DHistoVector(
"1D",
"convFractionVsEt",
"Fraction of Converted Photons vs E_{T};E_{T} (GeV)",etBin,etMin,etMax);
137 p_convFractionVsPhi_ = book3DHistoVector(
"1D",
"convFractionVsPhi",
"Fraction of Converted Photons vs #phi;#phi",phiBin,phiMin,phiMax);
138 p_convFractionVsEta_ = book2DHistoVector(
"1D",
"convFractionVsEta",
"Fraction of Converted Photons vs #eta;#eta",etaBin,etaMin,etaMax);
142 p_badChannelsFractionVsPhi_ = book2DHistoVector(
"1D",
"badChannelsFractionVsPhi",
"Fraction of Photons which have at least one bad channel vs #phi;#phi",phiBin,phiMin,phiMax);
143 p_badChannelsFractionVsEta_ = book2DHistoVector(
"1D",
"badChannelsFractionVsEta",
"Fraction of Photons which have at least one bad channel vs #eta;#eta",etaBin,etaMin, etaMax);
144 p_badChannelsFractionVsEt_ = book2DHistoVector(
"1D",
"badChannelsFractionVsEt",
"Fraction of Photons which have at least one bad channel vs E_{T};E_{T} (GeV)",etBin,etMin,etMax);
151 currentFolder_.str(
"");
152 currentFolder_ << AllPath <<
"Et above 20 GeV/";
155 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtaHLT");
156 numerator = retrieveHisto(EffPath,
"phoEtaPostHLT");
157 denominator = retrieveHisto(EffPath,
"phoEtaPreHLT");
158 dividePlots(dividend,numerator,denominator);
160 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtHLT");
161 numerator = retrieveHisto(EffPath,
"phoEtPostHLT");
162 denominator = retrieveHisto(EffPath,
"phoEtPreHLT");
163 dividePlots(dividend,numerator,denominator);
166 denominator = retrieveHisto(currentFolder_.str(),
"phoEta");
168 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtaLoose");
169 numerator = retrieveHisto(EffPath,
"phoEtaLoose");
170 dividePlots(dividend,numerator,denominator);
172 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtaTight");
173 numerator = retrieveHisto(EffPath,
"phoEtaTight");
174 dividePlots(dividend,numerator,denominator);
177 denominator = retrieveHisto(currentFolder_.str(),
"phoEtAllEcal");
179 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtLoose");
180 numerator = retrieveHisto(EffPath,
"phoEtLoose");
181 dividePlots(dividend,numerator,denominator);
183 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtTight");
184 numerator = retrieveHisto(EffPath,
"phoEtTight");
185 dividePlots(dividend,numerator,denominator);
188 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtaLoose");
189 numerator = retrieveHisto(EffPath,
"convEtaLoose");
190 denominator = retrieveHisto(EffPath,
"phoEtaLoose");
191 dividePlots(dividend,numerator,denominator);
193 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtaTight");
194 numerator = retrieveHisto(EffPath,
"convEtaTight");
195 denominator = retrieveHisto(EffPath,
"phoEtaTight");
196 dividePlots(dividend,numerator,denominator);
199 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtLoose");
200 numerator = retrieveHisto(EffPath,
"convEtLoose");
201 denominator = retrieveHisto(EffPath,
"phoEtLoose");
202 dividePlots(dividend,numerator,denominator);
204 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtTight");
205 numerator = retrieveHisto(EffPath,
"convEtTight");
206 denominator = retrieveHisto(EffPath,
"phoEtTight");
207 dividePlots(dividend,numerator,denominator);
210 dividend = retrieveHisto(EffPath,
"VertexReconstructionEfficiencyVsEta");
211 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvEta");
212 denominator = retrieveHisto(EffPath,
"phoEtaVertex");
213 dividePlots(dividend,numerator,denominator);
233 for (
int cut = 0;
cut !=numberOfSteps_; ++
cut) {
235 currentFolder_.str(
"");
236 currentFolder_ <<
"Egamma/"+analyzerName_+
"/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV/";
241 dividend = retrieveHisto(currentFolder_.str(),
"badChannelsFractionVsEt");
242 numerator = retrieveHisto(currentFolder_.str(),
"phoEtBadChannels");
243 denominator = retrieveHisto(currentFolder_.str(),
"phoEtAllEcal");
244 dividePlots(dividend,numerator,denominator);
247 dividend = retrieveHisto(currentFolder_.str(),
"badChannelsFractionVsEta");
248 numerator = retrieveHisto(currentFolder_.str(),
"phoEtaBadChannels");
249 denominator = retrieveHisto(currentFolder_.str(),
"phoEta");
250 dividePlots(dividend,numerator,denominator);
253 dividend = retrieveHisto(currentFolder_.str(),
"badChannelsFractionVsPhi");
254 numerator = retrieveHisto(currentFolder_.str(),
"phoPhiBadChannels");
255 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiAllEcal");
256 dividePlots(dividend,numerator,denominator);
261 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsEt");
262 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvEtAllEcal");
263 denominator = retrieveHisto(currentFolder_.str(),
"phoEtAllEcal");
264 dividePlots(dividend,numerator,denominator);
267 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsEta");
268 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvEtaForEfficiency");
269 denominator = retrieveHisto(currentFolder_.str(),
"phoEta");
270 dividePlots(dividend,numerator,denominator);
273 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsPhiAllEcal");
274 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyAllEcal");
275 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiAllEcal");
276 dividePlots(dividend,numerator,denominator);
277 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsPhiBarrel");
278 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyBarrel");
279 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiBarrel");
280 dividePlots(dividend,numerator,denominator);
281 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsPhiEndcaps");
282 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyEndcaps");
283 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiEndcaps");
284 dividePlots(dividend,numerator,denominator);
295 if(standAlone_)
dbe_->
save(outputFileName_);
296 else if(batch_)
dbe_->
save(inputFileName_);
329 err =
sqrt( value*(1-value) / denominator);
344 stringstream histo_number_stream;
348 if(
dbe_->
pwd().find(
"InvMass" ) != string::npos){
349 histo_index_invMass_++;
350 histo_index = histo_index_invMass_;
352 if(
dbe_->
pwd().find(
"Efficiencies" ) != string::npos){
353 histo_index_efficiency_++;
354 histo_index = histo_index_efficiency_;
356 histo_number_stream <<
"h_";
357 if(histo_index<10) histo_number_stream <<
"0";
358 histo_number_stream << histo_index;
370 vector<MonitorElement*> temp1DVector;
371 vector<vector<MonitorElement*> > temp2DVector;
374 bool conversionPlot =
false;
375 if(
dbe_->
pwd().find(
"Conversions" ) != string::npos) conversionPlot =
true;
379 histo_index_conversions_++;
380 histo_index = histo_index_conversions_;
383 histo_index_photons_++;
384 histo_index = histo_index_photons_;
388 stringstream histo_number_stream;
389 histo_number_stream <<
"h_";
390 if(histo_index<10) histo_number_stream <<
"0";
391 histo_number_stream << histo_index <<
"_";
394 for(
int cut = 0;
cut != numberOfSteps_; ++
cut){
398 currentFolder_.str(
"");
399 currentFolder_ <<
"Egamma/"+analyzerName_+
"/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV";
400 if(conversionPlot) currentFolder_ <<
"/Conversions";
405 if(conversionPlot) kind =
" Conversions: ";
406 else kind =
" Photons: ";
408 if(histoType==
"1D") temp1DVector.push_back(
dbe_->
book1D(histo_number_stream.str()+histoName,types_[
type]+kind+
title,xbin,
xmin,
xmax));
414 temp2DVector.push_back(temp1DVector);
415 temp1DVector.clear();
430 vector<MonitorElement*> temp1DVector;
431 vector<vector<MonitorElement*> > temp2DVector;
432 vector<vector<vector<MonitorElement*> > > temp3DVector;
436 bool conversionPlot =
false;
437 if(
dbe_->
pwd().find(
"Conversions" ) != string::npos) conversionPlot =
true;
441 histo_index_conversions_++;
442 histo_index = histo_index_conversions_;
445 histo_index_photons_++;
446 histo_index = histo_index_photons_;
449 stringstream histo_number_stream;
450 histo_number_stream <<
"h_";
451 if(histo_index<10) histo_number_stream <<
"0";
452 histo_number_stream << histo_index <<
"_";
455 for(
int cut = 0;
cut != numberOfSteps_; ++
cut){
461 currentFolder_.str(
"");
462 currentFolder_ <<
"Egamma/"+analyzerName_+
"/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV";
463 if(conversionPlot) currentFolder_ <<
"/Conversions";
468 if(conversionPlot) kind =
" Conversions: ";
469 else kind =
" Photons: ";
479 temp2DVector.push_back(temp1DVector);
480 temp1DVector.clear();
483 temp3DVector.push_back(temp2DVector);
484 temp2DVector.clear();
494 vector<MonitorElement*> histoVector;
495 uint indexOfRelevantHistogram=0;
496 string fullMEName =
"";
499 string MEName = histoVector[
index]->getName();
500 if(MEName.find( name ) != string::npos){
501 indexOfRelevantHistogram =
index;
505 return histoVector[indexOfRelevantHistogram];
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 * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
virtual void analyze(const edm::Event &, const edm::EventSetup &)
PhotonOfflineClient(const edm::ParameterSet &pset)
double getEntries(void) const
get # of entries
virtual void endRun(const edm::Run &, const edm::EventSetup &)
std::vector< std::vector< std::vector< MonitorElement * > > > book3DHistoVector(std::string histoType, std::string histoName, std::string title, int xbin, double xmin, double xmax, int ybin=1, double ymin=1, double ymax=2)
std::vector< std::vector< MonitorElement * > > book2DHistoVector(std::string histoType, std::string histoName, std::string title, int xbin, double xmin, double xmax, int ybin=1, double ymin=1, double ymax=2)
const T & max(const T &a, const T &b)
void removeElement(const std::string &name)
void dividePlots(MonitorElement *dividend, MonitorElement *numerator, MonitorElement *denominator)
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
void setVerbose(unsigned level)
void setEntries(double nentries)
set # of entries
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
std::vector< MonitorElement * > getContents(const std::string &path) const
bool dirExists(const std::string &path) const
true if directory exists
virtual ~PhotonOfflineClient()
MonitorElement * retrieveHisto(std::string dir, std::string name)
MonitorElement * bookHisto(std::string histoName, std::string title, int bin, double min, double max)
int64_t getIntValue(void) const
double getBinContent(int binx) const
get content of bin (1-D)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
virtual void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
int getNbinsX(void) const
get # of bins in X-axis
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
void setEfficiencyFlag(void)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void setCurrentFolder(const std::string &fullpath)
const std::string & pwd(void) const