Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:22

0001 #include <iostream>
0002 //
0003 
0004 #include "DQMOffline/EGamma/plugins/PhotonOfflineClient.h"
0005 
0006 //#define TWOPI 6.283185308
0007 //
0008 
0009 /** \class PhotonOfflineClient
0010  **
0011  **
0012  **  $Id: PhotonOfflineClient
0013  **  authors:
0014  **   Nancy Marinelli, U. of Notre Dame, US
0015  **   Jamie Antonelli, U. of Notre Dame, US
0016  **
0017  ***/
0018 
0019 using namespace std;
0020 using std::cout;
0021 
0022 PhotonOfflineClient::PhotonOfflineClient(const edm::ParameterSet& pset) {
0023   //dbe_ = 0;
0024   //dbe_ = edm::Service<DQMStore>().operator->();
0025   // dbe_->setVerbose(0);
0026   parameters_ = pset;
0027 
0028   analyzerName_ = pset.getParameter<string>("analyzerName");
0029   cutStep_ = pset.getParameter<double>("cutStep");
0030   numberOfSteps_ = pset.getParameter<int>("numberOfSteps");
0031 
0032   etMin = pset.getParameter<double>("etMin");
0033   etMax = pset.getParameter<double>("etMax");
0034   etBin = pset.getParameter<int>("etBin");
0035   etaMin = pset.getParameter<double>("etaMin");
0036   etaMax = pset.getParameter<double>("etaMax");
0037   etaBin = pset.getParameter<int>("etaBin");
0038   phiMin = pset.getParameter<double>("phiMin");
0039   phiMax = pset.getParameter<double>("phiMax");
0040   phiBin = pset.getParameter<int>("phiBin");
0041 
0042   standAlone_ = pset.getParameter<bool>("standAlone");
0043   batch_ = pset.getParameter<bool>("batch");
0044   excludeBkgHistos_ = pset.getParameter<bool>("excludeBkgHistos");
0045 
0046   outputFileName_ = pset.getParameter<string>("OutputFileName");
0047   inputFileName_ = pset.getUntrackedParameter<string>("InputFileName");
0048 
0049   histo_index_photons_ = 0;
0050   histo_index_conversions_ = 0;
0051   histo_index_efficiency_ = 0;
0052   histo_index_invMass_ = 0;
0053 
0054   types_.push_back("All");
0055   types_.push_back("GoodCandidate");
0056   if (!excludeBkgHistos_)
0057     types_.push_back("Background");
0058 
0059   parts_.push_back("AllEcal");
0060   parts_.push_back("Barrel");
0061   parts_.push_back("Endcaps");
0062 }
0063 
0064 PhotonOfflineClient::~PhotonOfflineClient() {}
0065 //void PhotonOfflineClient::beginJob(){}
0066 //void PhotonOfflineClient::analyze(const edm::Event& e, const edm::EventSetup& esup){}
0067 
0068 void PhotonOfflineClient::dqmEndJob(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) {
0069   if (!standAlone_)
0070     runClient(iBooker, iGetter);
0071 }
0072 //void PhotonOfflineClient::endRun(const edm::Run& run, const edm::EventSetup& setup){  if(!standAlone_) runClient();}
0073 
0074 void PhotonOfflineClient::runClient(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter) {
0075   //  if(!dbe_) return;
0076 
0077   //if(batch_)  dbe_->open(inputFileName_);
0078 
0079   //std::cout << " PostProcessing analyzer name " << analyzerName_ << std::endl;
0080   if (!iGetter.dirExists("Egamma/" + analyzerName_)) {
0081     std::cout << "Folder Egamma/" + analyzerName_ + " does not exist - Abort the efficiency calculation " << std::endl;
0082     return;
0083   }
0084 
0085   //find out how many histograms are in the various folders
0086   histo_index_photons_ = iGetter.get("Egamma/" + analyzerName_ + "/numberOfHistogramsInPhotonsFolder")->getIntValue();
0087   histo_index_conversions_ =
0088       iGetter.get("Egamma/" + analyzerName_ + "/numberOfHistogramsInConversionsFolder")->getIntValue();
0089   histo_index_efficiency_ =
0090       iGetter.get("Egamma/" + analyzerName_ + "/numberOfHistogramsInEfficiencyFolder")->getIntValue();
0091   histo_index_invMass_ = iGetter.get("Egamma/" + analyzerName_ + "/numberOfHistogramsInInvMassFolder")->getIntValue();
0092 
0093   iGetter.setCurrentFolder("Egamma/" + analyzerName_ + "/");
0094 
0095   string AllPath = "Egamma/" + analyzerName_ + "/AllPhotons/";
0096   string IsoPath = "Egamma/" + analyzerName_ + "/GoodCandidatePhotons/";
0097   string NonisoPath = "Egamma/" + analyzerName_ + "/BackgroundPhotons/";
0098   string EffPath = "Egamma/" + analyzerName_ + "/Efficiencies/";
0099 
0100   //booking efficiency histograms
0101   iGetter.setCurrentFolder(EffPath);
0102 
0103   p_efficiencyVsEtaLoose_ = bookHisto(iBooker,
0104                                       "EfficiencyVsEtaLoose",
0105                                       "Fraction of Photons passing Loose Isolation vs #eta;#eta",
0106                                       etaBin,
0107                                       etaMin,
0108                                       etaMax);
0109   p_efficiencyVsEtLoose_ = bookHisto(iBooker,
0110                                      "EfficiencyVsEtLoose",
0111                                      "Fraction of Photons passing Loose Isolation vs E_{T};E_{T} (GeV)",
0112                                      etBin,
0113                                      etMin,
0114                                      etMax);
0115   p_efficiencyVsEtaTight_ = bookHisto(iBooker,
0116                                       "EfficiencyVsEtaTight",
0117                                       "Fraction of Photons passing Tight Isolation vs #eta;#eta",
0118                                       etaBin,
0119                                       etaMin,
0120                                       etaMax);
0121   p_efficiencyVsEtTight_ = bookHisto(iBooker,
0122                                      "EfficiencyVsEtTight",
0123                                      "Fraction of Photons passing Tight Isolation vs E_{T};E_{T} (GeV)",
0124                                      etBin,
0125                                      etMin,
0126                                      etMax);
0127 
0128   p_efficiencyVsEtaHLT_ =
0129       bookHisto(iBooker, "EfficiencyVsEtaHLT", "Fraction of Photons firing HLT vs #eta;#eta", etaBin, etaMin, etaMax);
0130   p_efficiencyVsEtHLT_ = bookHisto(
0131       iBooker, "EfficiencyVsEtHLT", "Fraction of Photons firing HLT vs E_{T};E_{T} (GeV)", etBin, etMin, etMax);
0132 
0133   p_convFractionVsEtaLoose_ =
0134       bookHisto(iBooker,
0135                 "ConvFractionVsEtaLoose",
0136                 "Fraction of Loosely Isolated Photons which are matched to two tracks vs #eta;#eta",
0137                 etaBin,
0138                 etaMin,
0139                 etaMax);
0140   p_convFractionVsEtLoose_ =
0141       bookHisto(iBooker,
0142                 "ConvFractionVsEtLoose",
0143                 "Fraction of Loosely Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",
0144                 etBin,
0145                 etMin,
0146                 etMax);
0147   p_convFractionVsEtaTight_ =
0148       bookHisto(iBooker,
0149                 "ConvFractionVsEtaTight",
0150                 "Fraction of Tightly Isolated Photons which are matched to two tracks vs #eta;#eta",
0151                 etaBin,
0152                 etaMin,
0153                 etaMax);
0154   p_convFractionVsEtTight_ =
0155       bookHisto(iBooker,
0156                 "ConvFractionVsEtTight",
0157                 "Fraction of Tightly Isolated Photons which are matched to two tracks vs E_{T};E_{T} (GeV)",
0158                 etBin,
0159                 etMin,
0160                 etMax);
0161 
0162   p_vertexReconstructionEfficiencyVsEta_ =
0163       bookHisto(iBooker,
0164                 "VertexReconstructionEfficiencyVsEta",
0165                 "Fraction of Converted Photons which have a valid vertex vs #eta;#eta",
0166                 etaBin,
0167                 etaMin,
0168                 etaMax);
0169 
0170   //booking conversion fraction histograms
0171   iGetter.setCurrentFolder(AllPath + "Et above 20 GeV/Conversions");
0172   book2DHistoVector(iBooker,
0173                     p_convFractionVsEt_,
0174                     "1D",
0175                     "convFractionVsEt",
0176                     "Fraction of Converted Photons vs E_{T};E_{T} (GeV)",
0177                     etBin,
0178                     etMin,
0179                     etMax);
0180   book3DHistoVector(iBooker,
0181                     p_convFractionVsPhi_,
0182                     "1D",
0183                     "convFractionVsPhi",
0184                     "Fraction of Converted Photons vs #phi;#phi",
0185                     phiBin,
0186                     phiMin,
0187                     phiMax);
0188   book2DHistoVector(iBooker,
0189                     p_convFractionVsEta_,
0190                     "1D",
0191                     "convFractionVsEta",
0192                     "Fraction of Converted Photons vs #eta;#eta",
0193                     etaBin,
0194                     etaMin,
0195                     etaMax);
0196 
0197   //booking bad channel fraction histograms
0198   iGetter.setCurrentFolder(AllPath + "Et above 20 GeV/");
0199   book2DHistoVector(iBooker,
0200                     p_badChannelsFractionVsPhi_,
0201                     "1D",
0202                     "badChannelsFractionVsPhi",
0203                     "Fraction of Photons which have at least one bad channel vs #phi;#phi",
0204                     phiBin,
0205                     phiMin,
0206                     phiMax);
0207   book2DHistoVector(iBooker,
0208                     p_badChannelsFractionVsEta_,
0209                     "1D",
0210                     "badChannelsFractionVsEta",
0211                     "Fraction of Photons which have at least one bad channel vs #eta;#eta",
0212                     etaBin,
0213                     etaMin,
0214                     etaMax);
0215   book2DHistoVector(iBooker,
0216                     p_badChannelsFractionVsEt_,
0217                     "1D",
0218                     "badChannelsFractionVsEt",
0219                     "Fraction of Photons which have at least one bad channel vs E_{T};E_{T} (GeV)",
0220                     etBin,
0221                     etMin,
0222                     etMax);
0223 
0224   //making efficiency plots
0225   MonitorElement* dividend;
0226   MonitorElement* numerator;
0227   MonitorElement* denominator;
0228 
0229   currentFolder_.str("");
0230   currentFolder_ << AllPath << "Et above 20 GeV/";
0231 
0232   //HLT efficiency plots
0233   dividend = retrieveHisto(iGetter, EffPath, "EfficiencyVsEtaHLT");
0234   numerator = retrieveHisto(iGetter, EffPath, "phoEtaPostHLT");
0235   denominator = retrieveHisto(iGetter, EffPath, "phoEtaPreHLT");
0236   dividePlots(dividend, numerator, denominator);
0237 
0238   dividend = retrieveHisto(iGetter, EffPath, "EfficiencyVsEtHLT");
0239   numerator = retrieveHisto(iGetter, EffPath, "phoEtPostHLT");
0240   denominator = retrieveHisto(iGetter, EffPath, "phoEtPreHLT");
0241   dividePlots(dividend, numerator, denominator);
0242 
0243   //efficiencies vs Eta
0244   denominator = retrieveHisto(iGetter, currentFolder_.str(), "phoEta");
0245 
0246   dividend = retrieveHisto(iGetter, EffPath, "EfficiencyVsEtaLoose");
0247   numerator = retrieveHisto(iGetter, EffPath, "phoEtaLoose");
0248   dividePlots(dividend, numerator, denominator);
0249 
0250   dividend = retrieveHisto(iGetter, EffPath, "EfficiencyVsEtaTight");
0251   numerator = retrieveHisto(iGetter, EffPath, "phoEtaTight");
0252   dividePlots(dividend, numerator, denominator);
0253 
0254   //efficiencies vs Et
0255   denominator = retrieveHisto(iGetter, currentFolder_.str(), "phoEtAllEcal");
0256 
0257   dividend = retrieveHisto(iGetter, EffPath, "EfficiencyVsEtLoose");
0258   numerator = retrieveHisto(iGetter, EffPath, "phoEtLoose");
0259   dividePlots(dividend, numerator, denominator);
0260 
0261   dividend = retrieveHisto(iGetter, EffPath, "EfficiencyVsEtTight");
0262   numerator = retrieveHisto(iGetter, EffPath, "phoEtTight");
0263   dividePlots(dividend, numerator, denominator);
0264 
0265   //conversion fractions vs Eta
0266   dividend = retrieveHisto(iGetter, EffPath, "ConvFractionVsEtaLoose");
0267   numerator = retrieveHisto(iGetter, EffPath, "convEtaLoose");
0268   denominator = retrieveHisto(iGetter, EffPath, "phoEtaLoose");
0269   dividePlots(dividend, numerator, denominator);
0270 
0271   dividend = retrieveHisto(iGetter, EffPath, "ConvFractionVsEtaTight");
0272   numerator = retrieveHisto(iGetter, EffPath, "convEtaTight");
0273   denominator = retrieveHisto(iGetter, EffPath, "phoEtaTight");
0274   dividePlots(dividend, numerator, denominator);
0275 
0276   //conversion fractions vs Et
0277   dividend = retrieveHisto(iGetter, EffPath, "ConvFractionVsEtLoose");
0278   numerator = retrieveHisto(iGetter, EffPath, "convEtLoose");
0279   denominator = retrieveHisto(iGetter, EffPath, "phoEtLoose");
0280   dividePlots(dividend, numerator, denominator);
0281 
0282   dividend = retrieveHisto(iGetter, EffPath, "ConvFractionVsEtTight");
0283   numerator = retrieveHisto(iGetter, EffPath, "convEtTight");
0284   denominator = retrieveHisto(iGetter, EffPath, "phoEtTight");
0285   dividePlots(dividend, numerator, denominator);
0286 
0287   //conversion vertex recontruction efficiency
0288   dividend = retrieveHisto(iGetter, EffPath, "VertexReconstructionEfficiencyVsEta");
0289   numerator = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "phoConvEta");
0290   denominator = retrieveHisto(iGetter, EffPath, "phoEtaVertex");
0291   dividePlots(dividend, numerator, denominator);
0292 
0293   iGetter.setCurrentFolder(EffPath);
0294 
0295   for (uint type = 0; type != types_.size(); ++type) {
0296     for (int cut = 0; cut != numberOfSteps_; ++cut) {
0297       currentFolder_.str("");
0298       currentFolder_ << "Egamma/" + analyzerName_ + "/" << types_[type] << "Photons/Et above " << (cut + 1) * cutStep_
0299                      << " GeV/";
0300 
0301       //making bad channel histograms
0302 
0303       //vs Et
0304       dividend = retrieveHisto(iGetter, currentFolder_.str(), "badChannelsFractionVsEt");
0305       numerator = retrieveHisto(iGetter, currentFolder_.str(), "phoEtBadChannels");
0306       denominator = retrieveHisto(iGetter, currentFolder_.str(), "phoEtAllEcal");
0307       dividePlots(dividend, numerator, denominator);
0308 
0309       //vs eta
0310       dividend = retrieveHisto(iGetter, currentFolder_.str(), "badChannelsFractionVsEta");
0311       numerator = retrieveHisto(iGetter, currentFolder_.str(), "phoEtaBadChannels");
0312       denominator = retrieveHisto(iGetter, currentFolder_.str(), "phoEta");
0313       dividePlots(dividend, numerator, denominator);
0314 
0315       //vs phi
0316       dividend = retrieveHisto(iGetter, currentFolder_.str(), "badChannelsFractionVsPhi");
0317       numerator = retrieveHisto(iGetter, currentFolder_.str(), "phoPhiBadChannels");
0318       denominator = retrieveHisto(iGetter, currentFolder_.str(), "phoPhiAllEcal");
0319       dividePlots(dividend, numerator, denominator);
0320 
0321       //making conversion fraction histograms
0322 
0323       //vs Et
0324       dividend = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "convFractionVsEt");
0325       numerator = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "phoConvEtAllEcal");
0326       denominator = retrieveHisto(iGetter, currentFolder_.str(), "phoEtAllEcal");
0327       dividePlots(dividend, numerator, denominator);
0328 
0329       //vs eta
0330       dividend = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "convFractionVsEta");
0331       numerator = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "phoConvEtaForEfficiency");
0332       denominator = retrieveHisto(iGetter, currentFolder_.str(), "phoEta");
0333       dividePlots(dividend, numerator, denominator);
0334 
0335       //vs phi
0336       dividend = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "convFractionVsPhiAllEcal");
0337       numerator = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "phoConvPhiForEfficiencyAllEcal");
0338       denominator = retrieveHisto(iGetter, currentFolder_.str(), "phoPhiAllEcal");
0339       dividePlots(dividend, numerator, denominator);
0340       dividend = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "convFractionVsPhiBarrel");
0341       numerator = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "phoConvPhiForEfficiencyBarrel");
0342       denominator = retrieveHisto(iGetter, currentFolder_.str(), "phoPhiBarrel");
0343       dividePlots(dividend, numerator, denominator);
0344       dividend = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "convFractionVsPhiEndcaps");
0345       numerator = retrieveHisto(iGetter, currentFolder_.str() + "Conversions/", "phoConvPhiForEfficiencyEndcaps");
0346       denominator = retrieveHisto(iGetter, currentFolder_.str(), "phoPhiEndcaps");
0347       dividePlots(dividend, numerator, denominator);
0348 
0349       iGetter.setCurrentFolder(currentFolder_.str() + "Conversions/");
0350     }
0351   }
0352 
0353   // if(standAlone_) dbe_->save(outputFileName_);
0354   //else if(batch_) dbe_->save(inputFileName_);
0355 }
0356 
0357 void PhotonOfflineClient::dividePlots(MonitorElement* dividend,
0358                                       MonitorElement* numerator,
0359                                       MonitorElement* denominator) {
0360   double value, err;
0361 
0362   dividend->setEfficiencyFlag();
0363   if (denominator->getEntries() == 0)
0364     return;
0365 
0366   for (int j = 1; j <= numerator->getNbinsX(); j++) {
0367     if (denominator->getBinContent(j) != 0) {
0368       value = ((double)numerator->getBinContent(j)) / ((double)denominator->getBinContent(j));
0369       err = sqrt(value * (1 - value) / ((double)denominator->getBinContent(j)));
0370       dividend->setBinContent(j, value);
0371       dividend->setBinError(j, err);
0372     } else {
0373       dividend->setBinContent(j, 0);
0374       dividend->setBinError(j, 0);
0375     }
0376     dividend->setEntries(numerator->getEntries());
0377   }
0378 }
0379 
0380 void PhotonOfflineClient::dividePlots(MonitorElement* dividend, MonitorElement* numerator, double denominator) {
0381   double value, err;
0382 
0383   dividend->setEfficiencyFlag();
0384   for (int j = 1; j <= numerator->getNbinsX(); j++) {
0385     if (denominator != 0) {
0386       value = ((double)numerator->getBinContent(j)) / denominator;
0387       err = sqrt(value * (1 - value) / denominator);
0388       dividend->setBinContent(j, value);
0389       dividend->setBinError(j, err);
0390     } else {
0391       dividend->setBinContent(j, 0);
0392     }
0393   }
0394 }
0395 
0396 PhotonOfflineClient::MonitorElement* PhotonOfflineClient::bookHisto(
0397     DQMStore::IBooker& iBooker, string histoName, string title, int bin, double min, double max) {
0398   int histo_index = 0;
0399   stringstream histo_number_stream;
0400 
0401   //determining which folder we're in
0402   if (iBooker.pwd().find("InvMass") != string::npos) {
0403     histo_index_invMass_++;
0404     histo_index = histo_index_invMass_;
0405   }
0406   if (iBooker.pwd().find("Efficiencies") != string::npos) {
0407     histo_index_efficiency_++;
0408     histo_index = histo_index_efficiency_;
0409   }
0410   histo_number_stream << "h_";
0411   if (histo_index < 10)
0412     histo_number_stream << "0";
0413   histo_number_stream << histo_index;
0414 
0415   return iBooker.book1D(histo_number_stream.str() + "_" + histoName, title, bin, min, max);
0416 }
0417 
0418 void PhotonOfflineClient::book2DHistoVector(DQMStore::IBooker& iBooker,
0419                                             std::vector<vector<MonitorElement*> >& temp2DVector,
0420                                             std::string histoType,
0421                                             std::string histoName,
0422                                             std::string title,
0423                                             int xbin,
0424                                             double xmin,
0425                                             double xmax,
0426                                             int ybin,
0427                                             double ymin,
0428                                             double ymax) {
0429   int histo_index = 0;
0430 
0431   vector<MonitorElement*> temp1DVector;
0432 
0433   //determining which folder we're in
0434   bool conversionPlot = false;
0435   if (iBooker.pwd().find("Conversions") != string::npos)
0436     conversionPlot = true;
0437 
0438   if (conversionPlot) {
0439     histo_index_conversions_++;
0440     histo_index = histo_index_conversions_;
0441   } else {
0442     histo_index_photons_++;
0443     histo_index = histo_index_photons_;
0444   }
0445 
0446   stringstream histo_number_stream;
0447   histo_number_stream << "h_";
0448   if (histo_index < 10)
0449     histo_number_stream << "0";
0450   histo_number_stream << histo_index << "_";
0451 
0452   for (int cut = 0; cut != numberOfSteps_; ++cut) {  //looping over Et cut values
0453 
0454     for (uint type = 0; type != types_.size(); ++type) {  //looping over isolation type
0455 
0456       currentFolder_.str("");
0457       currentFolder_ << "Egamma/" + analyzerName_ + "/" << types_[type] << "Photons/Et above " << (cut + 1) * cutStep_
0458                      << " GeV";
0459       if (conversionPlot)
0460         currentFolder_ << "/Conversions";
0461 
0462       iBooker.setCurrentFolder(currentFolder_.str());
0463 
0464       string kind;
0465       if (conversionPlot)
0466         kind = " Conversions: ";
0467       else
0468         kind = " Photons: ";
0469 
0470       if (histoType == "1D")
0471         temp1DVector.push_back(
0472             iBooker.book1D(histo_number_stream.str() + histoName, types_[type] + kind + title, xbin, xmin, xmax));
0473       else if (histoType == "2D")
0474         temp1DVector.push_back(iBooker.book2D(
0475             histo_number_stream.str() + histoName, types_[type] + kind + title, xbin, xmin, xmax, ybin, ymin, ymax));
0476       else if (histoType == "Profile")
0477         temp1DVector.push_back(iBooker.bookProfile(
0478             histo_number_stream.str() + histoName, types_[type] + kind + title, xbin, xmin, xmax, ybin, ymin, ymax, ""));
0479       //else cout << "bad histoType\n";
0480     }
0481 
0482     temp2DVector.push_back(temp1DVector);
0483     temp1DVector.clear();
0484   }
0485 }
0486 
0487 void PhotonOfflineClient::book3DHistoVector(DQMStore::IBooker& iBooker,
0488                                             std::vector<vector<vector<MonitorElement*> > >& temp3DVector,
0489                                             std::string histoType,
0490                                             std::string histoName,
0491                                             std::string title,
0492                                             int xbin,
0493                                             double xmin,
0494                                             double xmax,
0495                                             int ybin,
0496                                             double ymin,
0497                                             double ymax) {
0498   int histo_index = 0;
0499 
0500   vector<MonitorElement*> temp1DVector;
0501   vector<vector<MonitorElement*> > temp2DVector;
0502 
0503   //determining which folder we're in
0504   bool conversionPlot = false;
0505   if (iBooker.pwd().find("Conversions") != string::npos)
0506     conversionPlot = true;
0507 
0508   if (conversionPlot) {
0509     histo_index_conversions_++;
0510     histo_index = histo_index_conversions_;
0511   } else {
0512     histo_index_photons_++;
0513     histo_index = histo_index_photons_;
0514   }
0515 
0516   stringstream histo_number_stream;
0517   histo_number_stream << "h_";
0518   if (histo_index < 10)
0519     histo_number_stream << "0";
0520   histo_number_stream << histo_index << "_";
0521 
0522   for (int cut = 0; cut != numberOfSteps_; ++cut) {  //looping over Et cut values
0523 
0524     for (uint type = 0; type != types_.size(); ++type) {  //looping over isolation type
0525 
0526       for (uint part = 0; part != parts_.size(); ++part) {  //looping over different parts of the ecal
0527 
0528         currentFolder_.str("");
0529         currentFolder_ << "Egamma/" + analyzerName_ + "/" << types_[type] << "Photons/Et above " << (cut + 1) * cutStep_
0530                        << " GeV";
0531         if (conversionPlot)
0532           currentFolder_ << "/Conversions";
0533 
0534         iBooker.setCurrentFolder(currentFolder_.str());
0535 
0536         string kind;
0537         if (conversionPlot)
0538           kind = " Conversions: ";
0539         else
0540           kind = " Photons: ";
0541 
0542         if (histoType == "1D")
0543           temp1DVector.push_back(iBooker.book1D(histo_number_stream.str() + histoName + parts_[part],
0544                                                 types_[type] + kind + parts_[part] + ": " + title,
0545                                                 xbin,
0546                                                 xmin,
0547                                                 xmax));
0548         else if (histoType == "2D")
0549           temp1DVector.push_back(iBooker.book2D(histo_number_stream.str() + histoName + parts_[part],
0550                                                 types_[type] + kind + parts_[part] + ": " + title,
0551                                                 xbin,
0552                                                 xmin,
0553                                                 xmax,
0554                                                 ybin,
0555                                                 ymin,
0556                                                 ymax));
0557         else if (histoType == "Profile")
0558           temp1DVector.push_back(iBooker.bookProfile(histo_number_stream.str() + histoName + parts_[part],
0559                                                      types_[type] + kind + parts_[part] + ": " + title,
0560                                                      xbin,
0561                                                      xmin,
0562                                                      xmax,
0563                                                      ybin,
0564                                                      ymin,
0565                                                      ymax,
0566                                                      ""));
0567         //else cout << "bad histoType\n";
0568       }
0569 
0570       temp2DVector.push_back(temp1DVector);
0571       temp1DVector.clear();
0572     }
0573 
0574     temp3DVector.push_back(temp2DVector);
0575     temp2DVector.clear();
0576   }
0577 }
0578 
0579 PhotonOfflineClient::MonitorElement* PhotonOfflineClient::retrieveHisto(DQMStore::IGetter& iGetter,
0580                                                                         string dir,
0581                                                                         string name) {
0582   //cout << "dir = " << dir << endl;
0583   //cout << "name = " << name << endl;
0584   vector<MonitorElement*> histoVector;
0585   uint indexOfRelevantHistogram = 0;
0586   string fullMEName = "";
0587   histoVector = iGetter.getContents(dir);
0588   for (uint index = 0; index != histoVector.size(); index++) {
0589     string MEName = histoVector[index]->getName();
0590     if (MEName.find(name) != string::npos) {
0591       indexOfRelevantHistogram = index;
0592       break;
0593     }
0594   }
0595   return histoVector[indexOfRelevantHistogram];
0596 }