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");
82 if(standAlone_) runClient();
86 if(!standAlone_) runClient();
96 if(batch_)
dbe_->
open(inputFileName_);
104 histo_index_photons_ =
dbe_->
get(
"Egamma/PhotonAnalyzer/numberOfHistogramsInPhotonsFolder")->
getIntValue();
105 histo_index_conversions_ =
dbe_->
get(
"Egamma/PhotonAnalyzer/numberOfHistogramsInConversionsFolder")->
getIntValue();
106 histo_index_efficiency_ =
dbe_->
get(
"Egamma/PhotonAnalyzer/numberOfHistogramsInEfficiencyFolder")->
getIntValue();
107 histo_index_invMass_ =
dbe_->
get(
"Egamma/PhotonAnalyzer/numberOfHistogramsInInvMassFolder")->
getIntValue();
116 string AllPath =
"Egamma/PhotonAnalyzer/AllPhotons/";
117 string IsoPath =
"Egamma/PhotonAnalyzer/GoodCandidatePhotons/";
118 string NonisoPath =
"Egamma/PhotonAnalyzer/BackgroundPhotons/";
119 string EffPath =
"Egamma/PhotonAnalyzer/Efficiencies/";
125 p_efficiencyVsEtaLoose_ = bookHisto(
"EfficiencyVsEtaLoose",
"Fraction of Photons passing Loose Isolation vs #eta;#eta",etaBin,
etaMin,
etaMax);
126 p_efficiencyVsEtLoose_ = bookHisto(
"EfficiencyVsEtLoose",
"Fraction of Photons passing Loose Isolation vs E_{T};E_{T} (GeV)",etBin,
etMin,
etMax);
127 p_efficiencyVsEtaTight_ = bookHisto(
"EfficiencyVsEtaTight",
"Fraction of Photons passing Tight Isolation vs #eta;#eta",etaBin,
etaMin,
etaMax);
128 p_efficiencyVsEtTight_ = bookHisto(
"EfficiencyVsEtTight",
"Fraction of Photons passing Tight Isolation vs E_{T};E_{T} (GeV)",etBin,
etMin,
etMax);
131 p_efficiencyVsEtaHLT_ = bookHisto(
"EfficiencyVsEtaHLT",
"Fraction of Photons firing HLT vs #eta;#eta",etaBin,
etaMin,
etaMax);
132 p_efficiencyVsEtHLT_ = bookHisto(
"EfficiencyVsEtHLT",
"Fraction of Photons firing HLT vs E_{T};E_{T} (GeV)",etBin,
etMin,
etMax);
135 p_convFractionVsEtaLoose_ = bookHisto(
"ConvFractionVsEtaLoose",
"Fraction of Loosely Isolated Photons which are matched to two tracks vs #eta;#eta",etaBin,
etaMin,
etaMax);
136 p_convFractionVsEtLoose_ = bookHisto(
"ConvFractionVsEtLoose",
"Fraction of Loosely Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",etBin,
etMin,
etMax);
137 p_convFractionVsEtaTight_ = bookHisto(
"ConvFractionVsEtaTight",
"Fraction of Tightly Isolated Photons which are matched to two tracks vs #eta;#eta",etaBin,
etaMin,
etaMax);
138 p_convFractionVsEtTight_ = bookHisto(
"ConvFractionVsEtTight",
"Fraction of Tightly Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",etBin,
etMin,
etMax);
140 p_vertexReconstructionEfficiencyVsEta_ = bookHisto(
"VertexReconstructionEfficiencyVsEta",
"Fraction of Converted Photons which have a valid vertex vs #eta;#eta",etaBin,
etaMin,
etaMax);
145 p_convFractionVsEt_ = book2DHistoVector(
"1D",
"convFractionVsEt",
"Fraction of Converted Photons vs E_{T};E_{T} (GeV)",etBin,
etMin,
etMax);
146 p_convFractionVsPhi_ = book3DHistoVector(
"1D",
"convFractionVsPhi",
"Fraction of Converted Photons vs #phi;#phi",phiBin,
phiMin,
phiMax);
147 p_convFractionVsEta_ = book2DHistoVector(
"1D",
"convFractionVsEta",
"Fraction of Converted Photons vs #eta;#eta",etaBin,
etaMin,
etaMax);
152 p_badChannelsFractionVsPhi_ = book2DHistoVector(
"1D",
"badChannelsFractionVsPhi",
"Fraction of Photons which have at least one bad channel vs #phi;#phi",phiBin,
phiMin,
phiMax);
153 p_badChannelsFractionVsEta_ = book2DHistoVector(
"1D",
"badChannelsFractionVsEta",
"Fraction of Photons which have at least one bad channel vs #eta;#eta",etaBin,
etaMin,
etaMax);
154 p_badChannelsFractionVsEt_ = book2DHistoVector(
"1D",
"badChannelsFractionVsEt",
"Fraction of Photons which have at least one bad channel vs E_{T};E_{T} (GeV)",etBin,
etMin,
etMax);
164 currentFolder_.str(
"");
165 currentFolder_ << AllPath <<
"Et above 20 GeV/";
168 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtaHLT");
169 numerator = retrieveHisto(EffPath,
"phoEtaPostHLT");
170 denominator = retrieveHisto(EffPath,
"phoEtaPreHLT");
171 dividePlots(dividend,numerator,denominator);
173 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtHLT");
174 numerator = retrieveHisto(EffPath,
"phoEtPostHLT");
175 denominator = retrieveHisto(EffPath,
"phoEtPreHLT");
176 dividePlots(dividend,numerator,denominator);
180 denominator = retrieveHisto(currentFolder_.str(),
"phoEta");
182 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtaLoose");
183 numerator = retrieveHisto(EffPath,
"phoEtaLoose");
184 dividePlots(dividend,numerator,denominator);
186 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtaTight");
187 numerator = retrieveHisto(EffPath,
"phoEtaTight");
188 dividePlots(dividend,numerator,denominator);
192 denominator = retrieveHisto(currentFolder_.str(),
"phoEtAllEcal");
194 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtLoose");
195 numerator = retrieveHisto(EffPath,
"phoEtLoose");
196 dividePlots(dividend,numerator,denominator);
198 dividend = retrieveHisto(EffPath,
"EfficiencyVsEtTight");
199 numerator = retrieveHisto(EffPath,
"phoEtTight");
200 dividePlots(dividend,numerator,denominator);
204 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtaLoose");
205 numerator = retrieveHisto(EffPath,
"convEtaLoose");
206 denominator = retrieveHisto(EffPath,
"phoEtaLoose");
207 dividePlots(dividend,numerator,denominator);
209 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtaTight");
210 numerator = retrieveHisto(EffPath,
"convEtaTight");
211 denominator = retrieveHisto(EffPath,
"phoEtaTight");
212 dividePlots(dividend,numerator,denominator);
216 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtLoose");
217 numerator = retrieveHisto(EffPath,
"convEtLoose");
218 denominator = retrieveHisto(EffPath,
"phoEtLoose");
219 dividePlots(dividend,numerator,denominator);
221 dividend = retrieveHisto(EffPath,
"ConvFractionVsEtTight");
222 numerator = retrieveHisto(EffPath,
"convEtTight");
223 denominator = retrieveHisto(EffPath,
"phoEtTight");
224 dividePlots(dividend,numerator,denominator);
228 dividend = retrieveHisto(EffPath,
"VertexReconstructionEfficiencyVsEta");
229 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvEta");
230 denominator = retrieveHisto(EffPath,
"phoEtaVertex");
231 dividePlots(dividend,numerator,denominator);
254 for (
int cut = 0;
cut !=numberOfSteps_; ++
cut) {
256 currentFolder_.str(
"");
257 currentFolder_ <<
"Egamma/PhotonAnalyzer/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV/";
262 dividend = retrieveHisto(currentFolder_.str(),
"badChannelsFractionVsEt");
263 numerator = retrieveHisto(currentFolder_.str(),
"phoEtBadChannels");
264 denominator = retrieveHisto(currentFolder_.str(),
"phoEtAllEcal");
265 dividePlots(dividend,numerator,denominator);
268 dividend = retrieveHisto(currentFolder_.str(),
"badChannelsFractionVsEta");
269 numerator = retrieveHisto(currentFolder_.str(),
"phoEtaBadChannels");
270 denominator = retrieveHisto(currentFolder_.str(),
"phoEta");
271 dividePlots(dividend,numerator,denominator);
274 dividend = retrieveHisto(currentFolder_.str(),
"badChannelsFractionVsPhi");
275 numerator = retrieveHisto(currentFolder_.str(),
"phoPhiBadChannels");
276 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiAllEcal");
277 dividePlots(dividend,numerator,denominator);
282 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsEt");
283 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvEtAllEcal");
284 denominator = retrieveHisto(currentFolder_.str(),
"phoEtAllEcal");
285 dividePlots(dividend,numerator,denominator);
288 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsEta");
289 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvEtaForEfficiency");
290 denominator = retrieveHisto(currentFolder_.str(),
"phoEta");
291 dividePlots(dividend,numerator,denominator);
294 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsPhiAllEcal");
295 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyAllEcal");
296 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiAllEcal");
297 dividePlots(dividend,numerator,denominator);
298 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsPhiBarrel");
299 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyBarrel");
300 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiBarrel");
301 dividePlots(dividend,numerator,denominator);
302 dividend = retrieveHisto(currentFolder_.str()+
"Conversions/",
"convFractionVsPhiEndcaps");
303 numerator = retrieveHisto(currentFolder_.str()+
"Conversions/",
"phoConvPhiForEfficiencyEndcaps");
304 denominator = retrieveHisto(currentFolder_.str(),
"phoPhiEndcaps");
305 dividePlots(dividend,numerator,denominator);
320 if(standAlone_)
dbe_->
save(outputFileName_);
321 else if(batch_)
dbe_->
save(inputFileName_);
356 err =
sqrt( value*(1-value) / denominator);
371 stringstream histo_number_stream;
375 if(
dbe_->
pwd().find(
"InvMass" ) != string::npos){
376 histo_index_invMass_++;
377 histo_index = histo_index_invMass_;
379 if(
dbe_->
pwd().find(
"Efficiencies" ) != string::npos){
380 histo_index_efficiency_++;
381 histo_index = histo_index_efficiency_;
383 histo_number_stream <<
"h_";
384 if(histo_index<10) histo_number_stream <<
"0";
385 histo_number_stream << histo_index;
392 int xbin,
double xmin,
double xmax,
393 int ybin,
double ymin,
double ymax)
397 vector<MonitorElement*> temp1DVector;
398 vector<vector<MonitorElement*> > temp2DVector;
401 bool conversionPlot =
false;
402 if(
dbe_->
pwd().find(
"Conversions" ) != string::npos) conversionPlot =
true;
406 histo_index_conversions_++;
407 histo_index = histo_index_conversions_;
410 histo_index_photons_++;
411 histo_index = histo_index_photons_;
415 stringstream histo_number_stream;
416 histo_number_stream <<
"h_";
417 if(histo_index<10) histo_number_stream <<
"0";
418 histo_number_stream << histo_index <<
"_";
421 for(
int cut = 0;
cut != numberOfSteps_; ++
cut){
425 currentFolder_.str(
"");
426 currentFolder_ <<
"Egamma/PhotonAnalyzer/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV";
427 if(conversionPlot) currentFolder_ <<
"/Conversions";
432 if(conversionPlot) kind =
" Conversions: ";
433 else kind =
" Photons: ";
435 if(histoType==
"1D") temp1DVector.push_back(
dbe_->
book1D(histo_number_stream.str()+histoName,types_[
type]+kind+
title,xbin,xmin,xmax));
436 else if(histoType==
"2D") temp1DVector.push_back(
dbe_->
book2D(histo_number_stream.str()+histoName,types_[
type]+kind+
title,xbin,xmin,xmax,ybin,ymin,ymax));
437 else if(histoType==
"Profile") temp1DVector.push_back(
dbe_->
bookProfile(histo_number_stream.str()+histoName,types_[
type]+kind+
title,xbin,xmin,xmax,ybin,ymin,ymax,
""));
441 temp2DVector.push_back(temp1DVector);
442 temp1DVector.clear();
452 int xbin,
double xmin,
double xmax,
453 int ybin,
double ymin,
double ymax)
457 vector<MonitorElement*> temp1DVector;
458 vector<vector<MonitorElement*> > temp2DVector;
459 vector<vector<vector<MonitorElement*> > > temp3DVector;
463 bool conversionPlot =
false;
464 if(
dbe_->
pwd().find(
"Conversions" ) != string::npos) conversionPlot =
true;
468 histo_index_conversions_++;
469 histo_index = histo_index_conversions_;
472 histo_index_photons_++;
473 histo_index = histo_index_photons_;
476 stringstream histo_number_stream;
477 histo_number_stream <<
"h_";
478 if(histo_index<10) histo_number_stream <<
"0";
479 histo_number_stream << histo_index <<
"_";
482 for(
int cut = 0;
cut != numberOfSteps_; ++
cut){
488 currentFolder_.str(
"");
489 currentFolder_ <<
"Egamma/PhotonAnalyzer/" << types_[
type] <<
"Photons/Et above " << (
cut+1)*cutStep_ <<
" GeV";
490 if(conversionPlot) currentFolder_ <<
"/Conversions";
495 if(conversionPlot) kind =
" Conversions: ";
496 else kind =
" Photons: ";
498 if(histoType==
"1D") temp1DVector.push_back(
dbe_->
book1D( histo_number_stream.str()+histoName+parts_[
part],types_[
type]+kind+parts_[
part]+
": "+
title,xbin,xmin,xmax));
499 else if(histoType==
"2D") temp1DVector.push_back(
dbe_->
book2D( histo_number_stream.str()+histoName+parts_[
part],types_[
type]+kind+parts_[
part]+
": "+
title,xbin,xmin,xmax,ybin,ymin,ymax));
500 else if(histoType==
"Profile") temp1DVector.push_back(
dbe_->
bookProfile( histo_number_stream.str()+histoName+parts_[
part],types_[
type]+kind+parts_[
part]+
": "+
title,xbin,xmin,xmax,ybin,ymin,ymax,
""));
506 temp2DVector.push_back(temp1DVector);
507 temp1DVector.clear();
510 temp3DVector.push_back(temp2DVector);
511 temp2DVector.clear();
521 vector<MonitorElement*> histoVector;
522 uint indexOfRelevantHistogram=0;
523 string fullMEName =
"";
526 string MEName = histoVector[
index]->getName();
527 if(MEName.find( name ) != string::npos){
528 indexOfRelevantHistogram =
index;
532 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 &)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
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 etMin(const PFCandidate &cand, double cut)
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)
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