34 numberOfSteps_ = pset.
getParameter<
int>(
"numberOfSteps");
48 excludeBkgHistos_ = pset.
getParameter<
bool>(
"excludeBkgHistos");
50 outputFileName_ = pset.
getParameter<
string>(
"OutputFileName");
53 histo_index_photons_ = 0;
54 histo_index_conversions_ = 0;
55 histo_index_efficiency_ = 0;
56 histo_index_invMass_ = 0;
58 types_.push_back(
"All");
59 types_.push_back(
"GoodCandidate");
60 if (!excludeBkgHistos_) types_.push_back(
"Background");
62 parts_.push_back(
"AllEcal");
63 parts_.push_back(
"Barrel");
64 parts_.push_back(
"Endcaps");
79 if(standAlone_) runClient();
83 if(!standAlone_) runClient();
90 if(batch_)
dbe_->
open(inputFileName_);
98 histo_index_photons_ =
dbe_->
get(
"Egamma/PhotonAnalyzer/numberOfHistogramsInPhotonsFolder")->
getIntValue();
99 histo_index_conversions_ =
dbe_->
get(
"Egamma/PhotonAnalyzer/numberOfHistogramsInConversionsFolder")->
getIntValue();
100 histo_index_efficiency_ =
dbe_->
get(
"Egamma/PhotonAnalyzer/numberOfHistogramsInEfficiencyFolder")->
getIntValue();
101 histo_index_invMass_ =
dbe_->
get(
"Egamma/PhotonAnalyzer/numberOfHistogramsInInvMassFolder")->
getIntValue();
109 string AllPath =
"Egamma/PhotonAnalyzer/AllPhotons/";
110 string IsoPath =
"Egamma/PhotonAnalyzer/GoodCandidatePhotons/";
111 string NonisoPath =
"Egamma/PhotonAnalyzer/BackgroundPhotons/";
112 string EffPath =
"Egamma/PhotonAnalyzer/Efficiencies/";
117 p_efficiencyVsEtaLoose_ = bookHisto(
"EfficiencyVsEtaLoose",
"Fraction of Photons passing Loose Isolation vs #eta;#eta",etaBin,
etaMin,
etaMax);
118 p_efficiencyVsEtLoose_ = bookHisto(
"EfficiencyVsEtLoose",
"Fraction of Photons passing Loose Isolation vs E_{T};E_{T} (GeV)",etBin,etMin,
etMax);
119 p_efficiencyVsEtaTight_ = bookHisto(
"EfficiencyVsEtaTight",
"Fraction of Photons passing Tight Isolation vs #eta;#eta",etaBin,
etaMin,
etaMax);
120 p_efficiencyVsEtTight_ = bookHisto(
"EfficiencyVsEtTight",
"Fraction of Photons passing Tight Isolation vs E_{T};E_{T} (GeV)",etBin,etMin,
etMax);
122 p_efficiencyVsEtaHLT_ = bookHisto(
"EfficiencyVsEtaHLT",
"Fraction of Photons firing HLT vs #eta;#eta",etaBin,
etaMin,
etaMax);
123 p_efficiencyVsEtHLT_ = bookHisto(
"EfficiencyVsEtHLT",
"Fraction of Photons firing HLT vs E_{T};E_{T} (GeV)",etBin,etMin,
etMax);
125 p_convFractionVsEtaLoose_ = bookHisto(
"ConvFractionVsEtaLoose",
"Fraction of Loosely Isolated Photons which are matched to two tracks vs #eta;#eta",etaBin,
etaMin,
etaMax);
126 p_convFractionVsEtLoose_ = bookHisto(
"ConvFractionVsEtLoose",
"Fraction of Loosely Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",etBin,etMin,
etMax);
127 p_convFractionVsEtaTight_ = bookHisto(
"ConvFractionVsEtaTight",
"Fraction of Tightly Isolated Photons which are matched to two tracks vs #eta;#eta",etaBin,
etaMin,
etaMax);
128 p_convFractionVsEtTight_ = bookHisto(
"ConvFractionVsEtTight",
"Fraction of Tightly Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",etBin,etMin,
etMax);
130 p_vertexReconstructionEfficiencyVsEta_ = bookHisto(
"VertexReconstructionEfficiencyVsEta",
"Fraction of Converted Photons which have a valid vertex vs #eta;#eta",etaBin,
etaMin,
etaMax);
134 p_convFractionVsEt_ = book2DHistoVector(
"1D",
"convFractionVsEt",
"Fraction of Converted Photons vs E_{T};E_{T} (GeV)",etBin,etMin,
etMax);
135 p_convFractionVsPhi_ = book3DHistoVector(
"1D",
"convFractionVsPhi",
"Fraction of Converted Photons vs #phi;#phi",phiBin,
phiMin,
phiMax);
136 p_convFractionVsEta_ = book2DHistoVector(
"1D",
"convFractionVsEta",
"Fraction of Converted Photons vs #eta;#eta",etaBin,
etaMin,
etaMax);
140 p_badChannelsFractionVsPhi_ = book2DHistoVector(
"1D",
"badChannelsFractionVsPhi",
"Fraction of Photons which have at least one bad channel vs #phi;#phi",phiBin,
phiMin,
phiMax);
141 p_badChannelsFractionVsEta_ = book2DHistoVector(
"1D",
"badChannelsFractionVsEta",
"Fraction of Photons which have at least one bad channel vs #eta;#eta",etaBin,
etaMin,
etaMax);
142 p_badChannelsFractionVsEt_ = book2DHistoVector(
"1D",
"badChannelsFractionVsEt",
"Fraction of Photons which have at least one bad channel vs E_{T};E_{T} (GeV)",etBin,etMin,
etMax);
149 currentFolder_.str(
"");
150 currentFolder_ << AllPath <<
"Et above 20 GeV/";
153 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtaHLT");
154 numerator = retrieveHisto(EffPath,
"phoEtaPostHLT");
155 denominator = retrieveHisto(EffPath,
"phoEtaPreHLT");
156 dividePlots(dividend,numerator,denominator);
158 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtHLT");
159 numerator = retrieveHisto(EffPath,
"phoEtPostHLT");
160 denominator = retrieveHisto(EffPath,
"phoEtPreHLT");
161 dividePlots(dividend,numerator,denominator);
164 denominator = retrieveHisto(currentFolder_.str(),
"phoEta");
166 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtaLoose");
167 numerator = retrieveHisto(EffPath,
"phoEtaLoose");
168 dividePlots(dividend,numerator,denominator);
170 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtaTight");
171 numerator = retrieveHisto(EffPath,
"phoEtaTight");
172 dividePlots(dividend,numerator,denominator);
175 denominator = retrieveHisto(currentFolder_.str(),
"phoEtAllEcal");
177 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtLoose");
178 numerator = retrieveHisto(EffPath,
"phoEtLoose");
179 dividePlots(dividend,numerator,denominator);
181 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtTight");
182 numerator = retrieveHisto(EffPath,
"phoEtTight");
183 dividePlots(dividend,numerator,denominator);
186 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtaLoose");
187 numerator = retrieveHisto(EffPath,
"convEtaLoose");
188 denominator = retrieveHisto(EffPath,
"phoEtaLoose");
189 dividePlots(dividend,numerator,denominator);
191 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtaTight");
192 numerator = retrieveHisto(EffPath,
"convEtaTight");
193 denominator = retrieveHisto(EffPath,
"phoEtaTight");
194 dividePlots(dividend,numerator,denominator);
197 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtLoose");
198 numerator = retrieveHisto(EffPath,
"convEtLoose");
199 denominator = retrieveHisto(EffPath,
"phoEtLoose");
200 dividePlots(dividend,numerator,denominator);
202 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtTight");
203 numerator = retrieveHisto(EffPath,
"convEtTight");
204 denominator = retrieveHisto(EffPath,
"phoEtTight");
205 dividePlots(dividend,numerator,denominator);
208 dividend = retrieveHisto(EffPath,
"VertexReconstructionEfficiencyVsEta");
209 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvEta");
210 denominator = retrieveHisto(EffPath,
"phoEtaVertex");
211 dividePlots(dividend,numerator,denominator);
231 for (
int cut = 0;
cut !=numberOfSteps_; ++
cut) {
233 currentFolder_.str(
"");
234 currentFolder_ <<
"Egamma/PhotonAnalyzer/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV/";
239 dividend = retrieveHisto(currentFolder_.str(),
"badChannelsFractionVsEt");
240 numerator = retrieveHisto(currentFolder_.str(),
"phoEtBadChannels");
241 denominator = retrieveHisto(currentFolder_.str(),
"phoEtAllEcal");
242 dividePlots(dividend,numerator,denominator);
245 dividend = retrieveHisto(currentFolder_.str(),
"badChannelsFractionVsEta");
246 numerator = retrieveHisto(currentFolder_.str(),
"phoEtaBadChannels");
247 denominator = retrieveHisto(currentFolder_.str(),
"phoEta");
248 dividePlots(dividend,numerator,denominator);
251 dividend = retrieveHisto(currentFolder_.str(),
"badChannelsFractionVsPhi");
252 numerator = retrieveHisto(currentFolder_.str(),
"phoPhiBadChannels");
253 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiAllEcal");
254 dividePlots(dividend,numerator,denominator);
259 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsEt");
260 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvEtAllEcal");
261 denominator = retrieveHisto(currentFolder_.str(),
"phoEtAllEcal");
262 dividePlots(dividend,numerator,denominator);
265 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsEta");
266 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvEtaForEfficiency");
267 denominator = retrieveHisto(currentFolder_.str(),
"phoEta");
268 dividePlots(dividend,numerator,denominator);
271 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsPhiAllEcal");
272 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyAllEcal");
273 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiAllEcal");
274 dividePlots(dividend,numerator,denominator);
275 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsPhiBarrel");
276 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyBarrel");
277 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiBarrel");
278 dividePlots(dividend,numerator,denominator);
279 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsPhiEndcaps");
280 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyEndcaps");
281 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiEndcaps");
282 dividePlots(dividend,numerator,denominator);
293 if(standAlone_)
dbe_->
save(outputFileName_);
294 else if(batch_)
dbe_->
save(inputFileName_);
327 err =
sqrt( value*(1-value) / denominator);
342 stringstream histo_number_stream;
346 if(
dbe_->
pwd().find(
"InvMass" ) != string::npos){
347 histo_index_invMass_++;
348 histo_index = histo_index_invMass_;
350 if(
dbe_->
pwd().find(
"Efficiencies" ) != string::npos){
351 histo_index_efficiency_++;
352 histo_index = histo_index_efficiency_;
354 histo_number_stream <<
"h_";
355 if(histo_index<10) histo_number_stream <<
"0";
356 histo_number_stream << histo_index;
368 vector<MonitorElement*> temp1DVector;
369 vector<vector<MonitorElement*> > temp2DVector;
372 bool conversionPlot =
false;
373 if(
dbe_->
pwd().find(
"Conversions" ) != string::npos) conversionPlot =
true;
377 histo_index_conversions_++;
378 histo_index = histo_index_conversions_;
381 histo_index_photons_++;
382 histo_index = histo_index_photons_;
386 stringstream histo_number_stream;
387 histo_number_stream <<
"h_";
388 if(histo_index<10) histo_number_stream <<
"0";
389 histo_number_stream << histo_index <<
"_";
392 for(
int cut = 0;
cut != numberOfSteps_; ++
cut){
396 currentFolder_.str(
"");
397 currentFolder_ <<
"Egamma/PhotonAnalyzer/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV";
398 if(conversionPlot) currentFolder_ <<
"/Conversions";
403 if(conversionPlot) kind =
" Conversions: ";
404 else kind =
" Photons: ";
406 if(histoType==
"1D") temp1DVector.push_back(
dbe_->
book1D(histo_number_stream.str()+histoName,types_[
type]+kind+
title,xbin,
xmin,
xmax));
412 temp2DVector.push_back(temp1DVector);
413 temp1DVector.clear();
428 vector<MonitorElement*> temp1DVector;
429 vector<vector<MonitorElement*> > temp2DVector;
430 vector<vector<vector<MonitorElement*> > > temp3DVector;
434 bool conversionPlot =
false;
435 if(
dbe_->
pwd().find(
"Conversions" ) != string::npos) conversionPlot =
true;
439 histo_index_conversions_++;
440 histo_index = histo_index_conversions_;
443 histo_index_photons_++;
444 histo_index = histo_index_photons_;
447 stringstream histo_number_stream;
448 histo_number_stream <<
"h_";
449 if(histo_index<10) histo_number_stream <<
"0";
450 histo_number_stream << histo_index <<
"_";
453 for(
int cut = 0;
cut != numberOfSteps_; ++
cut){
459 currentFolder_.str(
"");
460 currentFolder_ <<
"Egamma/PhotonAnalyzer/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV";
461 if(conversionPlot) currentFolder_ <<
"/Conversions";
466 if(conversionPlot) kind =
" Conversions: ";
467 else kind =
" Photons: ";
477 temp2DVector.push_back(temp1DVector);
478 temp1DVector.clear();
481 temp3DVector.push_back(temp2DVector);
482 temp2DVector.clear();
492 vector<MonitorElement*> histoVector;
493 uint indexOfRelevantHistogram=0;
494 string fullMEName =
"";
497 string MEName = histoVector[
index]->getName();
498 if(MEName.find( name ) != string::npos){
499 indexOfRelevantHistogram =
index;
503 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 save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
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)
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