Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-11 04:32:45

0001 #include <iostream>
0002 #include <iomanip>
0003 //
0004 
0005 #include "DQMOffline/EGamma/plugins/PhotonAnalyzer.h"
0006 
0007 /** \class PhotonAnalyzer
0008  **
0009  **
0010  **  $Id: PhotonAnalyzer
0011  **  authors:
0012  **   Nancy Marinelli, U. of Notre Dame, US
0013  **   Jamie Antonelli, U. of Notre Dame, US
0014  **
0015  ***/
0016 
0017 using namespace std;
0018 
0019 PhotonAnalyzer::PhotonAnalyzer(const edm::ParameterSet& pset) {
0020   fName_ = pset.getParameter<string>("analyzerName");
0021   prescaleFactor_ = pset.getUntrackedParameter<int>("prescaleFactor", 1);
0022 
0023   photon_token_ = consumes<vector<reco::Photon> >(pset.getParameter<edm::InputTag>("phoProducer"));
0024   barrelRecHit_token_ = consumes<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit> > >(
0025       pset.getParameter<edm::InputTag>("barrelRecHitProducer"));
0026   PhotonIDLoose_token_ = consumes<edm::ValueMap<bool> >(pset.getParameter<edm::InputTag>("photonIDLoose"));
0027   PhotonIDTight_token_ = consumes<edm::ValueMap<bool> >(pset.getParameter<edm::InputTag>("photonIDTight"));
0028   endcapRecHit_token_ = consumes<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit> > >(
0029       pset.getParameter<edm::InputTag>("endcapRecHitProducer"));
0030   triggerEvent_token_ = consumes<trigger::TriggerEvent>(pset.getParameter<edm::InputTag>("triggerEvent"));
0031   offline_pvToken_ = consumes<reco::VertexCollection>(
0032       pset.getUntrackedParameter<edm::InputTag>("offlinePV", edm::InputTag("offlinePrimaryVertices")));
0033 
0034   minPhoEtCut_ = pset.getParameter<double>("minPhoEtCut");
0035   photonMaxEta_ = pset.getParameter<double>("maxPhoEta");
0036   invMassEtCut_ = pset.getParameter<double>("invMassEtCut");
0037   cutStep_ = pset.getParameter<double>("cutStep");
0038   numberOfSteps_ = pset.getParameter<int>("numberOfSteps");
0039   useBinning_ = pset.getParameter<bool>("useBinning");
0040   useTriggerFiltering_ = pset.getParameter<bool>("useTriggerFiltering");
0041   minimalSetOfHistos_ = pset.getParameter<bool>("minimalSetOfHistos");
0042   excludeBkgHistos_ = pset.getParameter<bool>("excludeBkgHistos");
0043   standAlone_ = pset.getParameter<bool>("standAlone");
0044   isolationStrength_ = pset.getParameter<int>("isolationStrength");
0045   isHeavyIon_ = pset.getUntrackedParameter<bool>("isHeavyIon", false);
0046 
0047   histo_index_photons_ = 0;
0048   histo_index_conversions_ = 0;
0049   histo_index_efficiency_ = 0;
0050   histo_index_invMass_ = 0;
0051 
0052   nEvt_ = 0;
0053 
0054   // Determining parts...
0055   parts_.push_back("AllEcal");
0056   parts_.push_back("Barrel");
0057   parts_.push_back("Endcaps");
0058   // ...and types
0059   types_.push_back("All");
0060   types_.push_back("GoodCandidate");
0061   if (!excludeBkgHistos_) {
0062     types_.push_back("Background");
0063   }
0064 
0065   // Histogram parameters
0066   etaBin_ = pset.getParameter<int>("etaBin");
0067   etaMin_ = pset.getParameter<double>("etaMin");
0068   etaMax_ = pset.getParameter<double>("etaMax");
0069 
0070   etBin_ = pset.getParameter<int>("etBin");
0071   etMin_ = pset.getParameter<double>("etMin");
0072   etMax_ = pset.getParameter<double>("etMax");
0073 
0074   phiBin_ = pset.getParameter<int>("phiBin");
0075   phiMin_ = pset.getParameter<double>("phiMin");
0076   phiMax_ = pset.getParameter<double>("phiMax");
0077 
0078   eBin_ = pset.getParameter<int>("eBin");
0079   eMin_ = pset.getParameter<double>("eMin");
0080   eMax_ = pset.getParameter<double>("eMax");
0081 
0082   numberBin_ = pset.getParameter<int>("numberBin");
0083   numberMin_ = pset.getParameter<double>("numberMin");
0084   numberMax_ = pset.getParameter<double>("numberMax");
0085 
0086   r9Bin_ = pset.getParameter<int>("r9Bin");
0087   r9Min_ = pset.getParameter<double>("r9Min");
0088   r9Max_ = pset.getParameter<double>("r9Max");
0089 
0090   sigmaIetaBin_ = pset.getParameter<int>("sigmaIetaBin");
0091   sigmaIetaMin_ = pset.getParameter<double>("sigmaIetaMin");
0092   sigmaIetaMax_ = pset.getParameter<double>("sigmaIetaMax");
0093 
0094   sumBin_ = pset.getParameter<int>("sumBin");
0095   sumMin_ = pset.getParameter<double>("sumMin");
0096   sumMax_ = pset.getParameter<double>("sumMax");
0097 
0098   hOverEBin_ = pset.getParameter<int>("hOverEBin");
0099   hOverEMin_ = pset.getParameter<double>("hOverEMin");
0100   hOverEMax_ = pset.getParameter<double>("hOverEMax");
0101 
0102   eOverPBin_ = pset.getParameter<int>("eOverPBin");
0103   eOverPMin_ = pset.getParameter<double>("eOverPMin");
0104   eOverPMax_ = pset.getParameter<double>("eOverPMax");
0105 
0106   dPhiTracksBin_ = pset.getParameter<int>("dPhiTracksBin");
0107   dPhiTracksMin_ = pset.getParameter<double>("dPhiTracksMin");
0108   dPhiTracksMax_ = pset.getParameter<double>("dPhiTracksMax");
0109 
0110   dEtaTracksBin_ = pset.getParameter<int>("dEtaTracksBin");
0111   dEtaTracksMin_ = pset.getParameter<double>("dEtaTracksMin");
0112   dEtaTracksMax_ = pset.getParameter<double>("dEtaTracksMax");
0113 
0114   chi2Bin_ = pset.getParameter<int>("chi2Bin");
0115   chi2Min_ = pset.getParameter<double>("chi2Min");
0116   chi2Max_ = pset.getParameter<double>("chi2Max");
0117 
0118   zBin_ = pset.getParameter<int>("zBin");
0119   zMin_ = pset.getParameter<double>("zMin");
0120   zMax_ = pset.getParameter<double>("zMax");
0121 
0122   rBin_ = pset.getParameter<int>("rBin");
0123   rMin_ = pset.getParameter<double>("rMin");
0124   rMax_ = pset.getParameter<double>("rMax");
0125 
0126   xBin_ = pset.getParameter<int>("xBin");
0127   xMin_ = pset.getParameter<double>("xMin");
0128   xMax_ = pset.getParameter<double>("xMax");
0129 
0130   yBin_ = pset.getParameter<int>("yBin");
0131   yMin_ = pset.getParameter<double>("yMin");
0132   yMax_ = pset.getParameter<double>("yMax");
0133 
0134   reducedEtBin_ = etBin_ / 4;
0135   reducedEtaBin_ = etaBin_ / 4;
0136   reducedR9Bin_ = r9Bin_ / 4;
0137   reducedSumBin_ = sumBin_ / 4;
0138 }
0139 
0140 PhotonAnalyzer::~PhotonAnalyzer() {}
0141 
0142 void PhotonAnalyzer::bookHistograms(DQMStore::IBooker& iBooker,
0143                                     edm::Run const& /* iRun */,
0144                                     edm::EventSetup const& /* iSetup */) {
0145   bookHistogramsForHistogramCounts(iBooker);
0146 
0147   bookHistogramsEfficiency(iBooker);
0148   bookHistogramsInvMass(iBooker);
0149   bookHistogramsPhotons(iBooker);
0150   bookHistogramsConversions(iBooker);
0151 
0152   fillHistogramsForHistogramCounts(iBooker);
0153 }
0154 
0155 void PhotonAnalyzer::bookHistogramsForHistogramCounts(DQMStore::IBooker& iBooker) {
0156   iBooker.setCurrentFolder("Egamma/" + fName_ + "/");
0157   // Int values stored in MEs to keep track of how many histograms are in each folder
0158   totalNumberOfHistos_efficiencyFolder = iBooker.bookInt("numberOfHistogramsInEfficiencyFolder");
0159   totalNumberOfHistos_invMassFolder = iBooker.bookInt("numberOfHistogramsInInvMassFolder");
0160   totalNumberOfHistos_photonsFolder = iBooker.bookInt("numberOfHistogramsInPhotonsFolder");
0161   totalNumberOfHistos_conversionsFolder = iBooker.bookInt("numberOfHistogramsInConversionsFolder");
0162 }
0163 
0164 void PhotonAnalyzer::fillHistogramsForHistogramCounts(DQMStore::IBooker& iBooker) {
0165   iBooker.setCurrentFolder("Egamma/" + fName_ + "/");
0166   totalNumberOfHistos_efficiencyFolder->Fill(histo_index_efficiency_);
0167   totalNumberOfHistos_invMassFolder->Fill(histo_index_invMass_);
0168   totalNumberOfHistos_photonsFolder->Fill(histo_index_photons_);
0169   totalNumberOfHistos_conversionsFolder->Fill(histo_index_conversions_);
0170 }
0171 
0172 void PhotonAnalyzer::bookHistogramsEfficiency(DQMStore::IBooker& iBooker) {
0173   // Set folder
0174   iBooker.setCurrentFolder("Egamma/" + fName_ + "/Efficiencies");
0175 
0176   // Don't number these histograms with the "bookHisto" method, since they'll be erased in the offline client
0177   h_phoEta_Loose_ = iBooker.book1D("phoEtaLoose", "Loose Photon #eta", etaBin_, etaMin_, etaMax_);
0178   h_phoEta_Tight_ = iBooker.book1D("phoEtaTight", "Tight Photon #eta", etaBin_, etaMin_, etaMax_);
0179 
0180   h_phoEt_Loose_ = iBooker.book1D("phoEtLoose", "Loose Photon E_{T}", etBin_, etMin_, etMax_);
0181   h_phoEt_Tight_ = iBooker.book1D("phoEtTight", "Tight Photon E_{T}", etBin_, etMin_, etMax_);
0182 
0183   h_phoEta_preHLT_ = iBooker.book1D("phoEtaPreHLT", "Photon #eta: before HLT", etaBin_, etaMin_, etaMax_);
0184   h_phoEta_postHLT_ = iBooker.book1D("phoEtaPostHLT", "Photon #eta: after HLT", etaBin_, etaMin_, etaMax_);
0185   h_phoEt_preHLT_ = iBooker.book1D("phoEtPreHLT", "Photon E_{T}: before HLT", etBin_, etMin_, etMax_);
0186   h_phoEt_postHLT_ = iBooker.book1D("phoEtPostHLT", "Photon E_{T}: after HLT", etBin_, etMin_, etMax_);
0187 
0188   h_convEta_Loose_ = iBooker.book1D("convEtaLoose", "Converted Loose Photon #eta", etaBin_, etaMin_, etaMax_);
0189   h_convEta_Tight_ = iBooker.book1D("convEtaTight", "Converted Tight Photon #eta", etaBin_, etaMin_, etaMax_);
0190   h_convEt_Loose_ = iBooker.book1D("convEtLoose", "Converted Loose Photon E_{T}", etBin_, etMin_, etMax_);
0191   h_convEt_Tight_ = iBooker.book1D("convEtTight", "Converted Tight Photon E_{T}", etBin_, etMin_, etMax_);
0192 
0193   h_phoEta_Vertex_ =
0194       iBooker.book1D("phoEtaVertex", "Converted Photons before valid vertex cut: #eta", etaBin_, etaMin_, etaMax_);
0195 
0196   // Some temporary vectors
0197   vector<MonitorElement*> temp1DVectorEta;
0198   vector<MonitorElement*> temp1DVectorPhi;
0199   vector<vector<MonitorElement*> > temp2DVectorPhi;
0200 
0201   for (int cut = 0; cut != numberOfSteps_; ++cut) {       //looping over Et cut values
0202     for (uint type = 0; type != types_.size(); ++type) {  //looping over isolation type
0203       currentFolder_.str("");
0204       currentFolder_ << "Egamma/" + fName_ + "/" << types_[type] << "Photons/Et above " << (cut + 1) * cutStep_
0205                      << " GeV/Conversions";
0206       iBooker.setCurrentFolder(currentFolder_.str());
0207 
0208       temp1DVectorEta.push_back(
0209           iBooker.book1D("phoConvEtaForEfficiency", "Converted Photon #eta;#eta", etaBin_, etaMin_, etaMax_));
0210       for (uint part = 0; part != parts_.size(); ++part) {
0211         temp1DVectorPhi.push_back(iBooker.book1D(
0212             "phoConvPhiForEfficiency" + parts_[part], "Converted Photon #phi;#phi", phiBin_, phiMin_, phiMax_));
0213       }
0214       temp2DVectorPhi.push_back(temp1DVectorPhi);
0215       temp1DVectorPhi.clear();
0216     }
0217     h_phoConvEtaForEfficiency_.push_back(temp1DVectorEta);
0218     temp1DVectorEta.clear();
0219     h_phoConvPhiForEfficiency_.push_back(temp2DVectorPhi);
0220     temp2DVectorPhi.clear();
0221   }
0222 }
0223 
0224 void PhotonAnalyzer::bookHistogramsInvMass(DQMStore::IBooker& iBooker) {
0225   // Set folder
0226   iBooker.setCurrentFolder("Egamma/" + fName_ + "/InvMass");
0227 
0228   h_invMassAllPhotons_ = bookHisto(iBooker,
0229                                    "invMassAllIsolatedPhotons",
0230                                    "Two photon invariant mass: All isolated photons;M (GeV)",
0231                                    etBin_,
0232                                    etMin_,
0233                                    etMax_);
0234   h_invMassPhotonsEBarrel_ = bookHisto(iBooker,
0235                                        "invMassIsoPhotonsEBarrel",
0236                                        "Two photon invariant mass: isolated photons in barrel; M (GeV)",
0237                                        etBin_,
0238                                        etMin_,
0239                                        etMax_);
0240   h_invMassPhotonsEEndcap_ = bookHisto(iBooker,
0241                                        "invMassIsoPhotonsEEndcap",
0242                                        "Two photon invariant mass: isolated photons in endcap; M (GeV)",
0243                                        etBin_,
0244                                        etMin_,
0245                                        etMax_);
0246   h_invMassPhotonsEEndcapEBarrel_ = bookHisto(iBooker,
0247                                               "invMassIsoPhotonsEEndcapEBarrel",
0248                                               "Two photon invariant mass: isolated photons in endcap-barrel; M (GeV)",
0249                                               etBin_,
0250                                               etMin_,
0251                                               etMax_);
0252 
0253   h_invMassZeroWithTracks_ = bookHisto(
0254       iBooker, "invMassZeroWithTracks", "Two photon invariant mass: Neither has tracks;M (GeV)", etBin_, etMin_, etMax_);
0255   h_invMassOneWithTracks_ = bookHisto(
0256       iBooker, "invMassOneWithTracks", "Two photon invariant mass: Only one has tracks;M (GeV)", etBin_, etMin_, etMax_);
0257   h_invMassTwoWithTracks_ = bookHisto(
0258       iBooker, "invMassTwoWithTracks", "Two photon invariant mass: Both have tracks;M (GeV)", etBin_, etMin_, etMax_);
0259 
0260   h_nRecoVtx_ = bookHisto(iBooker, "nOfflineVtx", "# of Offline Vertices", 200, -0.5, 199.5);
0261 }
0262 
0263 void PhotonAnalyzer::bookHistogramsPhotons(DQMStore::IBooker& iBooker) {
0264   // Set folder
0265   // Folder is set by the book2DHistoVector and book3DHistoVector methods
0266 
0267   //ENERGY VARIABLES
0268   book3DHistoVector(iBooker, h_phoE_, "1D", "phoE", "Energy;E (GeV)", eBin_, eMin_, eMax_);
0269   book3DHistoVector(iBooker, h_phoSigmaEoverE_, "1D", "phoSigmaEoverE", "#sigma_{E}/E; #sigma_{E}/E", 100, 0., 0.08);
0270   book3DHistoVector(iBooker,
0271                     p_phoSigmaEoverEvsNVtx_,
0272                     "Profile",
0273                     "phoSigmaEoverEvsNVtx",
0274                     "#sigma_{E}/E vs NVtx; N_{vtx}; #sigma_{E}/E",
0275                     200,
0276                     -0.5,
0277                     199.5,
0278                     100,
0279                     0.,
0280                     0.08);
0281   book3DHistoVector(iBooker, h_phoEt_, "1D", "phoEt", "E_{T};E_{T} (GeV)", etBin_, etMin_, etMax_);
0282 
0283   //NUMBER OF PHOTONS
0284   book3DHistoVector(
0285       iBooker, h_nPho_, "1D", "nPho", "Number of Photons per Event;# #gamma", numberBin_, numberMin_, numberMax_);
0286 
0287   //GEOMETRICAL VARIABLES
0288   //photon eta/phi
0289   book2DHistoVector(iBooker, h_phoEta_, "1D", "phoEta", "#eta;#eta", etaBin_, etaMin_, etaMax_);
0290   book3DHistoVector(iBooker, h_phoPhi_, "1D", "phoPhi", "#phi;#phi", phiBin_, phiMin_, phiMax_);
0291 
0292   //supercluster eta/phi
0293   book2DHistoVector(iBooker, h_scEta_, "1D", "scEta", "SuperCluster #eta;#eta", etaBin_, etaMin_, etaMax_);
0294   book3DHistoVector(iBooker, h_scPhi_, "1D", "scPhi", "SuperCluster #phi;#phi", phiBin_, phiMin_, phiMax_);
0295 
0296   //SHOWER SHAPE VARIABLES
0297   //r9
0298   book3DHistoVector(iBooker, h_r9_, "1D", "r9", "R9;R9", r9Bin_, r9Min_, r9Max_);
0299   if (standAlone_) {
0300     book2DHistoVector(iBooker,
0301                       h_r9VsEt_,
0302                       "2D",
0303                       "r9VsEt2D",
0304                       "R9 vs E_{T};E_{T} (GeV);R9",
0305                       reducedEtBin_,
0306                       etMin_,
0307                       etMax_,
0308                       reducedR9Bin_,
0309                       r9Min_,
0310                       r9Max_);
0311   }
0312   book2DHistoVector(iBooker,
0313                     p_r9VsEt_,
0314                     "Profile",
0315                     "r9VsEt",
0316                     "Avg R9 vs E_{T};E_{T} (GeV);R9",
0317                     etBin_,
0318                     etMin_,
0319                     etMax_,
0320                     r9Bin_,
0321                     r9Min_,
0322                     r9Max_);
0323   if (standAlone_) {
0324     book2DHistoVector(iBooker,
0325                       h_r9VsEta_,
0326                       "2D",
0327                       "r9VsEta2D",
0328                       "R9 vs #eta;#eta;R9",
0329                       reducedEtaBin_,
0330                       etaMin_,
0331                       etaMax_,
0332                       reducedR9Bin_,
0333                       r9Min_,
0334                       r9Max_);
0335   }
0336   book2DHistoVector(iBooker,
0337                     p_r9VsEta_,
0338                     "Profile",
0339                     "r9VsEta",
0340                     "Avg R9 vs #eta;#eta;R9",
0341                     etaBin_,
0342                     etaMin_,
0343                     etaMax_,
0344                     r9Bin_,
0345                     r9Min_,
0346                     r9Max_);
0347 
0348   //sigma ieta ieta
0349   book3DHistoVector(iBooker,
0350                     h_phoSigmaIetaIeta_,
0351                     "1D",
0352                     "phoSigmaIetaIeta",
0353                     "#sigma_{i#etai#eta};#sigma_{i#etai#eta}",
0354                     sigmaIetaBin_,
0355                     sigmaIetaMin_,
0356                     sigmaIetaMax_);
0357   if (standAlone_) {
0358     book2DHistoVector(iBooker,
0359                       h_sigmaIetaIetaVsEta_,
0360                       "2D",
0361                       "sigmaIetaIetaVsEta2D",
0362                       "#sigma_{i#etai#eta} vs #eta;#eta;#sigma_{i#etai#eta}",
0363                       reducedEtaBin_,
0364                       etaMin_,
0365                       etaMax_,
0366                       sigmaIetaBin_,
0367                       sigmaIetaMin_,
0368                       sigmaIetaMax_);
0369   }
0370   book2DHistoVector(iBooker,
0371                     p_sigmaIetaIetaVsEta_,
0372                     "Profile",
0373                     "sigmaIetaIetaVsEta",
0374                     "Avg #sigma_{i#etai#eta} vs #eta;#eta;#sigma_{i#etai#eta}",
0375                     etaBin_,
0376                     etaMin_,
0377                     etaMax_,
0378                     sigmaIetaBin_,
0379                     sigmaIetaMin_,
0380                     sigmaIetaMax_);
0381 
0382   //e1x5
0383   if (standAlone_) {
0384     book2DHistoVector(iBooker,
0385                       h_e1x5VsEt_,
0386                       "2D",
0387                       "e1x5VsEt2D",
0388                       "E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",
0389                       reducedEtBin_,
0390                       etMin_,
0391                       etMax_,
0392                       reducedEtBin_,
0393                       etMin_,
0394                       etMax_);
0395   }
0396   book2DHistoVector(iBooker,
0397                     p_e1x5VsEt_,
0398                     "Profile",
0399                     "e1x5VsEt",
0400                     "Avg E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",
0401                     etBin_,
0402                     etMin_,
0403                     etMax_,
0404                     etBin_,
0405                     etMin_,
0406                     etMax_);
0407   if (standAlone_) {
0408     book2DHistoVector(iBooker,
0409                       h_e1x5VsEta_,
0410                       "2D",
0411                       "e1x5VsEta2D",
0412                       "E1x5 vs #eta;#eta;E1X5 (GeV)",
0413                       reducedEtaBin_,
0414                       etaMin_,
0415                       etaMax_,
0416                       reducedEtBin_,
0417                       etMin_,
0418                       etMax_);
0419   }
0420   book2DHistoVector(iBooker,
0421                     p_e1x5VsEta_,
0422                     "Profile",
0423                     "e1x5VsEta",
0424                     "Avg E1x5 vs #eta;#eta;E1X5 (GeV)",
0425                     etaBin_,
0426                     etaMin_,
0427                     etaMax_,
0428                     etBin_,
0429                     etMin_,
0430                     etMax_);
0431 
0432   //e2x5
0433   if (standAlone_) {
0434     book2DHistoVector(iBooker,
0435                       h_e2x5VsEt_,
0436                       "2D",
0437                       "e2x5VsEt2D",
0438                       "E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",
0439                       reducedEtBin_,
0440                       etMin_,
0441                       etMax_,
0442                       reducedEtBin_,
0443                       etMin_,
0444                       etMax_);
0445   }
0446   book2DHistoVector(iBooker,
0447                     p_e2x5VsEt_,
0448                     "Profile",
0449                     "e2x5VsEt",
0450                     "Avg E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",
0451                     etBin_,
0452                     etMin_,
0453                     etMax_,
0454                     etBin_,
0455                     etMin_,
0456                     etMax_);
0457   if (standAlone_) {
0458     book2DHistoVector(iBooker,
0459                       h_e2x5VsEta_,
0460                       "2D",
0461                       "e2x5VsEta2D",
0462                       "E2x5 vs #eta;#eta;E2X5 (GeV)",
0463                       reducedEtaBin_,
0464                       etaMin_,
0465                       etaMax_,
0466                       reducedEtBin_,
0467                       etMin_,
0468                       etMax_);
0469   }
0470   book2DHistoVector(iBooker,
0471                     p_e2x5VsEta_,
0472                     "Profile",
0473                     "e2x5VsEta",
0474                     "Avg E2x5 vs #eta;#eta;E2X5 (GeV)",
0475                     etaBin_,
0476                     etaMin_,
0477                     etaMax_,
0478                     etBin_,
0479                     etMin_,
0480                     etMax_);
0481 
0482   //r1x5
0483   if (standAlone_) {
0484     book2DHistoVector(iBooker,
0485                       h_r1x5VsEt_,
0486                       "2D",
0487                       "r1x5VsEt2D",
0488                       "R1x5 vs E_{T};E_{T} (GeV);R1X5",
0489                       reducedEtBin_,
0490                       etMin_,
0491                       etMax_,
0492                       reducedR9Bin_,
0493                       r9Min_,
0494                       r9Max_);
0495   }
0496   book2DHistoVector(iBooker,
0497                     p_r1x5VsEt_,
0498                     "Profile",
0499                     "r1x5VsEt",
0500                     "Avg R1x5 vs E_{T};E_{T} (GeV);R1X5",
0501                     etBin_,
0502                     etMin_,
0503                     etMax_,
0504                     r9Bin_,
0505                     r9Min_,
0506                     r9Max_);
0507   if (standAlone_) {
0508     book2DHistoVector(iBooker,
0509                       h_r1x5VsEta_,
0510                       "2D",
0511                       "r1x5VsEta2D",
0512                       "R1x5 vs #eta;#eta;R1X5",
0513                       reducedEtaBin_,
0514                       etaMin_,
0515                       etaMax_,
0516                       reducedR9Bin_,
0517                       r9Min_,
0518                       r9Max_);
0519   }
0520   book2DHistoVector(iBooker,
0521                     p_r1x5VsEta_,
0522                     "Profile",
0523                     "r1x5VsEta",
0524                     "Avg R1x5 vs #eta;#eta;R1X5",
0525                     etaBin_,
0526                     etaMin_,
0527                     etaMax_,
0528                     r9Bin_,
0529                     r9Min_,
0530                     r9Max_);
0531 
0532   //r2x5
0533   if (standAlone_) {
0534     book2DHistoVector(iBooker,
0535                       h_r2x5VsEt_,
0536                       "2D",
0537                       "r2x5VsEt2D",
0538                       "R2x5 vs E_{T};E_{T} (GeV);R2X5",
0539                       reducedEtBin_,
0540                       etMin_,
0541                       etMax_,
0542                       reducedR9Bin_,
0543                       r9Min_,
0544                       r9Max_);
0545   }
0546   book2DHistoVector(iBooker,
0547                     p_r2x5VsEt_,
0548                     "Profile",
0549                     "r2x5VsEt",
0550                     "Avg R2x5 vs E_{T};E_{T} (GeV);R2X5",
0551                     etBin_,
0552                     etMin_,
0553                     etMax_,
0554                     r9Bin_,
0555                     r9Min_,
0556                     r9Max_);
0557   if (standAlone_) {
0558     book2DHistoVector(iBooker,
0559                       h_r2x5VsEta_,
0560                       "2D",
0561                       "r2x5VsEta2D",
0562                       "R2x5 vs #eta;#eta;R2X5",
0563                       reducedEtaBin_,
0564                       etaMin_,
0565                       etaMax_,
0566                       reducedR9Bin_,
0567                       r9Min_,
0568                       r9Max_);
0569   }
0570   book2DHistoVector(iBooker,
0571                     p_r2x5VsEta_,
0572                     "Profile",
0573                     "r2x5VsEta",
0574                     "Avg R2x5 vs #eta;#eta;R2X5",
0575                     etaBin_,
0576                     etaMin_,
0577                     etaMax_,
0578                     r9Bin_,
0579                     r9Min_,
0580                     r9Max_);
0581 
0582   //maxEXtalOver3x3
0583   if (standAlone_) {
0584     book2DHistoVector(iBooker,
0585                       h_maxEXtalOver3x3VsEt_,
0586                       "2D",
0587                       "maxEXtalOver3x3VsEt2D",
0588                       "(Max Xtal E)/E3x3 vs E_{T};E_{T} (GeV);(Max Xtal E)/E3x3",
0589                       reducedEtBin_,
0590                       etMin_,
0591                       etMax_,
0592                       r9Bin_,
0593                       r9Min_,
0594                       r9Max_);
0595   }
0596   book2DHistoVector(iBooker,
0597                     p_maxEXtalOver3x3VsEt_,
0598                     "Profile",
0599                     "maxEXtalOver3x3VsEt",
0600                     "Avg (Max Xtal E)/E3x3 vs E_{T};E_{T} (GeV);(Max Xtal E)/E3x3",
0601                     etBin_,
0602                     etMin_,
0603                     etMax_,
0604                     r9Bin_,
0605                     r9Min_,
0606                     r9Max_);
0607   if (standAlone_) {
0608     book2DHistoVector(iBooker,
0609                       h_maxEXtalOver3x3VsEta_,
0610                       "2D",
0611                       "maxEXtalOver3x3VsEta2D",
0612                       "(Max Xtal E)/E3x3 vs #eta;#eta;(Max Xtal E)/E3x3",
0613                       reducedEtaBin_,
0614                       etaMin_,
0615                       etaMax_,
0616                       r9Bin_,
0617                       r9Min_,
0618                       r9Max_);
0619   }
0620   book2DHistoVector(iBooker,
0621                     p_maxEXtalOver3x3VsEta_,
0622                     "Profile",
0623                     "maxEXtalOver3x3VsEta",
0624                     "Avg (Max Xtal E)/E3x3 vs #eta;#eta;(Max Xtal E)/E3x3",
0625                     etaBin_,
0626                     etaMin_,
0627                     etaMax_,
0628                     r9Bin_,
0629                     r9Min_,
0630                     r9Max_);
0631 
0632   //TRACK ISOLATION VARIABLES
0633   //nTrackIsolSolid
0634   book2DHistoVector(iBooker,
0635                     h_nTrackIsolSolid_,
0636                     "1D",
0637                     "nIsoTracksSolid",
0638                     "Number Of Tracks in the Solid Iso Cone;# tracks",
0639                     numberBin_,
0640                     numberMin_,
0641                     numberMax_);
0642   if (standAlone_) {
0643     book2DHistoVector(iBooker,
0644                       h_nTrackIsolSolidVsEt_,
0645                       "2D",
0646                       "nIsoTracksSolidVsEt2D",
0647                       "Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",
0648                       reducedEtBin_,
0649                       etMin_,
0650                       etMax_,
0651                       numberBin_,
0652                       numberMin_,
0653                       numberMax_);
0654   }
0655   book2DHistoVector(iBooker,
0656                     p_nTrackIsolSolidVsEt_,
0657                     "Profile",
0658                     "nIsoTracksSolidVsEt",
0659                     "Avg Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",
0660                     etBin_,
0661                     etMin_,
0662                     etMax_,
0663                     numberBin_,
0664                     numberMin_,
0665                     numberMax_);
0666   if (standAlone_) {
0667     book2DHistoVector(iBooker,
0668                       h_nTrackIsolSolidVsEta_,
0669                       "2D",
0670                       "nIsoTracksSolidVsEta2D",
0671                       "Number Of Tracks in the Solid Iso Cone vs #eta;#eta;# tracks",
0672                       reducedEtaBin_,
0673                       etaMin_,
0674                       etaMax_,
0675                       numberBin_,
0676                       numberMin_,
0677                       numberMax_);
0678   }
0679   book2DHistoVector(iBooker,
0680                     p_nTrackIsolSolidVsEta_,
0681                     "Profile",
0682                     "nIsoTracksSolidVsEta",
0683                     "Avg Number Of Tracks in the Solid Iso Cone vs #eta;#eta;# tracks",
0684                     etaBin_,
0685                     etaMin_,
0686                     etaMax_,
0687                     numberBin_,
0688                     numberMin_,
0689                     numberMax_);
0690 
0691   //nTrackIsolHollow
0692   book2DHistoVector(iBooker,
0693                     h_nTrackIsolHollow_,
0694                     "1D",
0695                     "nIsoTracksHollow",
0696                     "Number Of Tracks in the Hollow Iso Cone;# tracks",
0697                     numberBin_,
0698                     numberMin_,
0699                     numberMax_);
0700   if (standAlone_) {
0701     book2DHistoVector(iBooker,
0702                       h_nTrackIsolHollowVsEt_,
0703                       "2D",
0704                       "nIsoTracksHollowVsEt2D",
0705                       "Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",
0706                       reducedEtBin_,
0707                       etMin_,
0708                       etMax_,
0709                       numberBin_,
0710                       numberMin_,
0711                       numberMax_);
0712   }
0713   book2DHistoVector(iBooker,
0714                     p_nTrackIsolHollowVsEt_,
0715                     "Profile",
0716                     "nIsoTracksHollowVsEt",
0717                     "Avg Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",
0718                     etBin_,
0719                     etMin_,
0720                     etMax_,
0721                     numberBin_,
0722                     numberMin_,
0723                     numberMax_);
0724   if (standAlone_) {
0725     book2DHistoVector(iBooker,
0726                       h_nTrackIsolHollowVsEta_,
0727                       "2D",
0728                       "nIsoTracksHollowVsEta2D",
0729                       "Number Of Tracks in the Hollow Iso Cone vs #eta;#eta;# tracks",
0730                       reducedEtaBin_,
0731                       etaMin_,
0732                       etaMax_,
0733                       numberBin_,
0734                       numberMin_,
0735                       numberMax_);
0736   }
0737   book2DHistoVector(iBooker,
0738                     p_nTrackIsolHollowVsEta_,
0739                     "Profile",
0740                     "nIsoTracksHollowVsEta",
0741                     "Avg Number Of Tracks in the Hollow Iso Cone vs #eta;#eta;# tracks",
0742                     etaBin_,
0743                     etaMin_,
0744                     etaMax_,
0745                     numberBin_,
0746                     numberMin_,
0747                     numberMax_);
0748 
0749   //trackPtSumSolid
0750   book2DHistoVector(iBooker,
0751                     h_trackPtSumSolid_,
0752                     "1D",
0753                     "isoPtSumSolid",
0754                     "Track P_{T} Sum in the Solid Iso Cone;P_{T} (GeV)",
0755                     sumBin_,
0756                     sumMin_,
0757                     sumMax_);
0758   if (standAlone_) {
0759     book2DHistoVector(iBooker,
0760                       h_trackPtSumSolidVsEt_,
0761                       "2D",
0762                       "isoPtSumSolidVsEt2D",
0763                       "Track P_{T} Sum in the Solid Iso Cone;E_{T} (GeV);P_{T} (GeV)",
0764                       reducedEtBin_,
0765                       etMin_,
0766                       etMax_,
0767                       reducedSumBin_,
0768                       sumMin_,
0769                       sumMax_);
0770   }
0771   book2DHistoVector(iBooker,
0772                     p_trackPtSumSolidVsEt_,
0773                     "Profile",
0774                     "isoPtSumSolidVsEt",
0775                     "Avg Track P_{T} Sum in the Solid Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",
0776                     etBin_,
0777                     etMin_,
0778                     etMax_,
0779                     sumBin_,
0780                     sumMin_,
0781                     sumMax_);
0782   if (standAlone_) {
0783     book2DHistoVector(iBooker,
0784                       h_trackPtSumSolidVsEta_,
0785                       "2D",
0786                       "isoPtSumSolidVsEta2D",
0787                       "Track P_{T} Sum in the Solid Iso Cone;#eta;P_{T} (GeV)",
0788                       reducedEtaBin_,
0789                       etaMin_,
0790                       etaMax_,
0791                       reducedSumBin_,
0792                       sumMin_,
0793                       sumMax_);
0794   }
0795   book2DHistoVector(iBooker,
0796                     p_trackPtSumSolidVsEta_,
0797                     "Profile",
0798                     "isoPtSumSolidVsEta",
0799                     "Avg Track P_{T} Sum in the Solid Iso Cone vs #eta;#eta;P_{T} (GeV)",
0800                     etaBin_,
0801                     etaMin_,
0802                     etaMax_,
0803                     sumBin_,
0804                     sumMin_,
0805                     sumMax_);
0806 
0807   //trackPtSumHollow
0808   book2DHistoVector(iBooker,
0809                     h_trackPtSumHollow_,
0810                     "1D",
0811                     "isoPtSumHollow",
0812                     "Track P_{T} Sum in the Hollow Iso Cone;P_{T} (GeV)",
0813                     sumBin_,
0814                     sumMin_,
0815                     sumMax_);
0816   if (standAlone_) {
0817     book2DHistoVector(iBooker,
0818                       h_trackPtSumHollowVsEt_,
0819                       "2D",
0820                       "isoPtSumHollowVsEt2D",
0821                       "Track P_{T} Sum in the Hollow Iso Cone;E_{T} (GeV);P_{T} (GeV)",
0822                       reducedEtBin_,
0823                       etMin_,
0824                       etMax_,
0825                       reducedSumBin_,
0826                       sumMin_,
0827                       sumMax_);
0828   }
0829   book2DHistoVector(iBooker,
0830                     p_trackPtSumHollowVsEt_,
0831                     "Profile",
0832                     "isoPtSumHollowVsEt",
0833                     "Avg Track P_{T} Sum in the Hollow Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",
0834                     etBin_,
0835                     etMin_,
0836                     etMax_,
0837                     sumBin_,
0838                     sumMin_,
0839                     sumMax_);
0840   if (standAlone_) {
0841     book2DHistoVector(iBooker,
0842                       h_trackPtSumHollowVsEta_,
0843                       "2D",
0844                       "isoPtSumHollowVsEta2D",
0845                       "Track P_{T} Sum in the Hollow Iso Cone;#eta;P_{T} (GeV)",
0846                       reducedEtaBin_,
0847                       etaMin_,
0848                       etaMax_,
0849                       reducedSumBin_,
0850                       sumMin_,
0851                       sumMax_);
0852   }
0853   book2DHistoVector(iBooker,
0854                     p_trackPtSumHollowVsEta_,
0855                     "Profile",
0856                     "isoPtSumHollowVsEta",
0857                     "Avg Track P_{T} Sum in the Hollow Iso Cone vs #eta;#eta;P_{T} (GeV)",
0858                     etaBin_,
0859                     etaMin_,
0860                     etaMax_,
0861                     sumBin_,
0862                     sumMin_,
0863                     sumMax_);
0864 
0865   //CALORIMETER ISOLATION VARIABLES
0866   //ecal sum
0867   book2DHistoVector(
0868       iBooker, h_ecalSum_, "1D", "ecalSum", "Ecal Sum in the Iso Cone;E (GeV)", sumBin_, sumMin_, sumMax_);
0869   book2DHistoVector(iBooker,
0870                     h_ecalSumEBarrel_,
0871                     "1D",
0872                     "ecalSumEBarrel",
0873                     "Ecal Sum in the IsoCone for Barrel;E (GeV)",
0874                     sumBin_,
0875                     sumMin_,
0876                     sumMax_);
0877   book2DHistoVector(iBooker,
0878                     h_ecalSumEEndcap_,
0879                     "1D",
0880                     "ecalSumEEndcap",
0881                     "Ecal Sum in the IsoCone for Endcap;E (GeV)",
0882                     sumBin_,
0883                     sumMin_,
0884                     sumMax_);
0885   if (standAlone_) {
0886     book2DHistoVector(iBooker,
0887                       h_ecalSumVsEt_,
0888                       "2D",
0889                       "ecalSumVsEt2D",
0890                       "Ecal Sum in the Iso Cone;E_{T} (GeV);E (GeV)",
0891                       reducedEtBin_,
0892                       etMin_,
0893                       etMax_,
0894                       reducedSumBin_,
0895                       sumMin_,
0896                       sumMax_);
0897   }
0898   book3DHistoVector(iBooker,
0899                     p_ecalSumVsEt_,
0900                     "Profile",
0901                     "ecalSumVsEt",
0902                     "Avg Ecal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",
0903                     etBin_,
0904                     etMin_,
0905                     etMax_,
0906                     sumBin_,
0907                     sumMin_,
0908                     sumMax_);
0909   if (standAlone_) {
0910     book2DHistoVector(iBooker,
0911                       h_ecalSumVsEta_,
0912                       "2D",
0913                       "ecalSumVsEta2D",
0914                       "Ecal Sum in the Iso Cone;#eta;E (GeV)",
0915                       reducedEtaBin_,
0916                       etaMin_,
0917                       etaMax_,
0918                       reducedSumBin_,
0919                       sumMin_,
0920                       sumMax_);
0921   }
0922   book2DHistoVector(iBooker,
0923                     p_ecalSumVsEta_,
0924                     "Profile",
0925                     "ecalSumVsEta",
0926                     "Avg Ecal Sum in the Iso Cone vs #eta;#eta;E (GeV)",
0927                     etaBin_,
0928                     etaMin_,
0929                     etaMax_,
0930                     sumBin_,
0931                     sumMin_,
0932                     sumMax_);
0933 
0934   //hcal sum
0935   book2DHistoVector(
0936       iBooker, h_hcalSum_, "1D", "hcalSum", "Hcal Sum in the Iso Cone;E (GeV)", sumBin_, sumMin_, sumMax_);
0937   book2DHistoVector(iBooker,
0938                     h_hcalSumEBarrel_,
0939                     "1D",
0940                     "hcalSumEBarrel",
0941                     "Hcal Sum in the IsoCone for Barrel;E (GeV)",
0942                     sumBin_,
0943                     sumMin_,
0944                     sumMax_);
0945   book2DHistoVector(iBooker,
0946                     h_hcalSumEEndcap_,
0947                     "1D",
0948                     "hcalSumEEndcap",
0949                     "Hcal Sum in the IsoCone for Endcap;E (GeV)",
0950                     sumBin_,
0951                     sumMin_,
0952                     sumMax_);
0953   if (standAlone_) {
0954     book2DHistoVector(iBooker,
0955                       h_hcalSumVsEt_,
0956                       "2D",
0957                       "hcalSumVsEt2D",
0958                       "Hcal Sum in the Iso Cone;E_{T} (GeV);E (GeV)",
0959                       reducedEtBin_,
0960                       etMin_,
0961                       etMax_,
0962                       reducedSumBin_,
0963                       sumMin_,
0964                       sumMax_);
0965   }
0966   book3DHistoVector(iBooker,
0967                     p_hcalSumVsEt_,
0968                     "Profile",
0969                     "hcalSumVsEt",
0970                     "Avg Hcal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",
0971                     etBin_,
0972                     etMin_,
0973                     etMax_,
0974                     sumBin_,
0975                     sumMin_,
0976                     sumMax_);
0977   if (standAlone_) {
0978     book2DHistoVector(iBooker,
0979                       h_hcalSumVsEta_,
0980                       "2D",
0981                       "hcalSumVsEta2D",
0982                       "Hcal Sum in the Iso Cone;#eta;E (GeV)",
0983                       reducedEtaBin_,
0984                       etaMin_,
0985                       etaMax_,
0986                       reducedSumBin_,
0987                       sumMin_,
0988                       sumMax_);
0989   }
0990   book2DHistoVector(iBooker,
0991                     p_hcalSumVsEta_,
0992                     "Profile",
0993                     "hcalSumVsEta",
0994                     "Avg Hcal Sum in the Iso Cone vs #eta;#eta;E (GeV)",
0995                     etaBin_,
0996                     etaMin_,
0997                     etaMax_,
0998                     sumBin_,
0999                     sumMin_,
1000                     sumMax_);
1001 
1002   //h over e
1003   book3DHistoVector(iBooker, h_hOverE_, "1D", "hOverE", "H/E;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
1004   book2DHistoVector(iBooker,
1005                     p_hOverEVsEt_,
1006                     "Profile",
1007                     "hOverEVsEt",
1008                     "Avg H/E vs Et;E_{T} (GeV);H/E",
1009                     etBin_,
1010                     etMin_,
1011                     etMax_,
1012                     hOverEBin_,
1013                     hOverEMin_,
1014                     hOverEMax_);
1015   book2DHistoVector(iBooker,
1016                     p_hOverEVsEta_,
1017                     "Profile",
1018                     "hOverEVsEta",
1019                     "Avg H/E vs #eta;#eta;H/E",
1020                     etaBin_,
1021                     etaMin_,
1022                     etaMax_,
1023                     hOverEBin_,
1024                     hOverEMin_,
1025                     hOverEMax_);
1026   book3DHistoVector(iBooker, h_h1OverE_, "1D", "h1OverE", "H/E for Depth 1;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
1027   book3DHistoVector(iBooker, h_h2OverE_, "1D", "h2OverE", "H/E for Depth 2;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
1028 
1029   // pf isolation
1030   book2DHistoVector(
1031       iBooker, h_phoIsoBarrel_, "1D", "phoIsoBarrel", "PF photon iso Barrel;E (GeV)", reducedEtBin_, etMin_, 25.);
1032   book2DHistoVector(
1033       iBooker, h_phoIsoEndcap_, "1D", "phoIsoEndcap", "PF photon iso Endcap;E (GeV)", reducedEtBin_, etMin_, 25.);
1034   book2DHistoVector(iBooker,
1035                     h_chHadIsoBarrel_,
1036                     "1D",
1037                     "chHadIsoBarrel",
1038                     "PF charged Had iso Barrel;E (GeV)",
1039                     reducedEtBin_,
1040                     etMin_,
1041                     25.);
1042   book2DHistoVector(iBooker,
1043                     h_chHadIsoEndcap_,
1044                     "1D",
1045                     "chHadIsoEndcap",
1046                     "PF charged Had iso Endcap;E (GeV)",
1047                     reducedEtBin_,
1048                     etMin_,
1049                     25.);
1050   book2DHistoVector(iBooker,
1051                     h_nHadIsoBarrel_,
1052                     "1D",
1053                     "neutralHadIsoBarrel",
1054                     "PF neutral Had iso Barrel;E (GeV)",
1055                     reducedEtBin_,
1056                     etMin_,
1057                     25.);
1058   book2DHistoVector(iBooker,
1059                     h_nHadIsoEndcap_,
1060                     "1D",
1061                     "neutralHadIsoEndcap",
1062                     "PF neutral Had iso Endcap;E (GeV)",
1063                     reducedEtBin_,
1064                     etMin_,
1065                     25.);
1066 
1067   //OTHER VARIABLES
1068   //bad channel histograms
1069   book2DHistoVector(iBooker,
1070                     h_phoEt_BadChannels_,
1071                     "1D",
1072                     "phoEtBadChannels",
1073                     "Fraction Containing Bad Channels: E_{T};E_{T} (GeV)",
1074                     etBin_,
1075                     etMin_,
1076                     etMax_);
1077   book2DHistoVector(iBooker,
1078                     h_phoEta_BadChannels_,
1079                     "1D",
1080                     "phoEtaBadChannels",
1081                     "Fraction Containing Bad Channels: #eta;#eta",
1082                     etaBin_,
1083                     etaMin_,
1084                     etaMax_);
1085   book2DHistoVector(iBooker,
1086                     h_phoPhi_BadChannels_,
1087                     "1D",
1088                     "phoPhiBadChannels",
1089                     "Fraction Containing Bad Channels: #phi;#phi",
1090                     phiBin_,
1091                     phiMin_,
1092                     phiMax_);
1093 }
1094 
1095 void PhotonAnalyzer::bookHistogramsConversions(DQMStore::IBooker& iBooker) {
1096   // Set folder
1097   iBooker.setCurrentFolder("Egamma/" + fName_ + "/AllPhotons/Et Above 0 GeV/Conversions");
1098 
1099   //ENERGY VARIABLES
1100   book3DHistoVector(iBooker, h_phoConvE_, "1D", "phoConvE", "E;E (GeV)", eBin_, eMin_, eMax_);
1101   book3DHistoVector(iBooker, h_phoConvEt_, "1D", "phoConvEt", "E_{T};E_{T} (GeV)", etBin_, etMin_, etMax_);
1102 
1103   //GEOMETRICAL VARIABLES
1104   book2DHistoVector(iBooker, h_phoConvEta_, "1D", "phoConvEta", "#eta;#eta", etaBin_, etaMin_, etaMax_);
1105   book3DHistoVector(iBooker, h_phoConvPhi_, "1D", "phoConvPhi", "#phi;#phi", phiBin_, phiMin_, phiMax_);
1106 
1107   //NUMBER OF PHOTONS
1108   book3DHistoVector(iBooker,
1109                     h_nConv_,
1110                     "1D",
1111                     "nConv",
1112                     "Number Of Conversions per Event ;# conversions",
1113                     numberBin_,
1114                     numberMin_,
1115                     numberMax_);
1116 
1117   //SHOWER SHAPE VARIABLES
1118   book3DHistoVector(iBooker, h_phoConvR9_, "1D", "phoConvR9", "R9;R9", r9Bin_, r9Min_, r9Max_);
1119 
1120   //TRACK RELATED VARIABLES
1121   book3DHistoVector(iBooker, h_eOverPTracks_, "1D", "eOverPTracks", "E/P;E/P", eOverPBin_, eOverPMin_, eOverPMax_);
1122   book3DHistoVector(iBooker, h_pOverETracks_, "1D", "pOverETracks", "P/E;P/E", eOverPBin_, eOverPMin_, eOverPMax_);
1123   book3DHistoVector(iBooker,
1124                     h_dPhiTracksAtVtx_,
1125                     "1D",
1126                     "dPhiTracksAtVtx",
1127                     "#Delta#phi of Tracks at Vertex;#Delta#phi",
1128                     dPhiTracksBin_,
1129                     dPhiTracksMin_,
1130                     dPhiTracksMax_);
1131   book3DHistoVector(iBooker,
1132                     h_dPhiTracksAtEcal_,
1133                     "1D",
1134                     "dPhiTracksAtEcal",
1135                     "Abs(#Delta#phi) of Tracks at Ecal;#Delta#phi",
1136                     dPhiTracksBin_,
1137                     0.,
1138                     dPhiTracksMax_);
1139   book3DHistoVector(iBooker,
1140                     h_dEtaTracksAtEcal_,
1141                     "1D",
1142                     "dEtaTracksAtEcal",
1143                     "#Delta#eta of Tracks at Ecal;#Delta#eta",
1144                     dEtaTracksBin_,
1145                     dEtaTracksMin_,
1146                     dEtaTracksMax_);
1147   book3DHistoVector(iBooker,
1148                     h_dCotTracks_,
1149                     "1D",
1150                     "dCotTracks",
1151                     "#Deltacot(#theta) of Tracks;#Deltacot(#theta)",
1152                     dEtaTracksBin_,
1153                     dEtaTracksMin_,
1154                     dEtaTracksMax_);
1155   book2DHistoVector(iBooker,
1156                     p_dCotTracksVsEta_,
1157                     "Profile",
1158                     "dCotTracksVsEta",
1159                     "Avg #Deltacot(#theta) of Tracks vs #eta;#eta;#Deltacot(#theta)",
1160                     etaBin_,
1161                     etaMin_,
1162                     etaMax_,
1163                     dEtaTracksBin_,
1164                     dEtaTracksMin_,
1165                     dEtaTracksMax_);
1166   book2DHistoVector(iBooker,
1167                     p_nHitsVsEta_,
1168                     "Profile",
1169                     "nHitsVsEta",
1170                     "Avg Number of Hits per Track vs #eta;#eta;# hits",
1171                     etaBin_,
1172                     etaMin_,
1173                     etaMax_,
1174                     etaBin_,
1175                     0,
1176                     16);
1177   book2DHistoVector(
1178       iBooker, h_tkChi2_, "1D", "tkChi2", "#chi^{2} of Track Fitting;#chi^{2}", chi2Bin_, chi2Min_, chi2Max_);
1179   book2DHistoVector(iBooker,
1180                     p_tkChi2VsEta_,
1181                     "Profile",
1182                     "tkChi2VsEta",
1183                     "Avg #chi^{2} of Track Fitting vs #eta;#eta;#chi^{2}",
1184                     etaBin_,
1185                     etaMin_,
1186                     etaMax_,
1187                     chi2Bin_,
1188                     chi2Min_,
1189                     chi2Max_);
1190 
1191   //VERTEX RELATED VARIABLES
1192   book2DHistoVector(iBooker,
1193                     h_convVtxRvsZ_,
1194                     "2D",
1195                     "convVtxRvsZ",
1196                     "Vertex Position;Z (cm);R (cm)",
1197                     500,
1198                     zMin_,
1199                     zMax_,
1200                     rBin_,
1201                     rMin_,
1202                     rMax_);
1203   book2DHistoVector(
1204       iBooker, h_convVtxZEndcap_, "1D", "convVtxZEndcap", "Vertex Position: #eta > 1.5;Z (cm)", zBin_, zMin_, zMax_);
1205   book2DHistoVector(iBooker, h_convVtxZ_, "1D", "convVtxZ", "Vertex Position;Z (cm)", zBin_, zMin_, zMax_);
1206   book2DHistoVector(iBooker, h_convVtxR_, "1D", "convVtxR", "Vertex Position: #eta < 1;R (cm)", rBin_, rMin_, rMax_);
1207   book2DHistoVector(iBooker,
1208                     h_convVtxYvsX_,
1209                     "2D",
1210                     "convVtxYvsX",
1211                     "Vertex Position: #eta < 1;X (cm);Y (cm)",
1212                     xBin_,
1213                     xMin_,
1214                     xMax_,
1215                     yBin_,
1216                     yMin_,
1217                     yMax_);
1218   book2DHistoVector(iBooker,
1219                     h_vertexChi2Prob_,
1220                     "1D",
1221                     "vertexChi2Prob",
1222                     "#chi^{2} Probability of Vertex Fitting;#chi^{2}",
1223                     100,
1224                     0.,
1225                     1.0);
1226 }
1227 
1228 // Booking helper methods:
1229 
1230 PhotonAnalyzer::MonitorElement* PhotonAnalyzer::bookHisto(
1231     DQMStore::IBooker& iBooker, string histoName, string title, int bin, double min, double max) {
1232   int histo_index = 0;
1233   stringstream histo_number_stream;
1234 
1235   //determining which folder we're in
1236   if (iBooker.pwd().find("InvMass") != string::npos) {
1237     histo_index_invMass_++;
1238     histo_index = histo_index_invMass_;
1239   }
1240   if (iBooker.pwd().find("Efficiencies") != string::npos) {
1241     histo_index_efficiency_++;
1242     histo_index = histo_index_efficiency_;
1243   }
1244 
1245   histo_number_stream << "h_";
1246   if (histo_index < 10)
1247     histo_number_stream << "0";
1248   histo_number_stream << histo_index;
1249 
1250   return iBooker.book1D(histo_number_stream.str() + "_" + histoName, title, bin, min, max);
1251 }
1252 
1253 void PhotonAnalyzer::book2DHistoVector(DQMStore::IBooker& iBooker,
1254                                        vector<vector<MonitorElement*> >& temp2DVector,
1255                                        string histoType,
1256                                        string histoName,
1257                                        string title,
1258                                        int xbin,
1259                                        double xmin,
1260                                        double xmax,
1261                                        int ybin,
1262                                        double ymin,
1263                                        double ymax) {
1264   int histo_index = 0;
1265 
1266   vector<MonitorElement*> temp1DVector;
1267 
1268   //determining which folder we're in
1269   bool conversionPlot = false;
1270   if (iBooker.pwd().find("Conversions") != string::npos)
1271     conversionPlot = true;
1272   bool TwoDPlot = false;
1273   if (histoName.find("2D") != string::npos)
1274     TwoDPlot = true;
1275 
1276   if (conversionPlot) {
1277     histo_index_conversions_++;
1278     histo_index = histo_index_conversions_;
1279   } else {
1280     histo_index_photons_++;
1281     histo_index = histo_index_photons_;
1282   }
1283 
1284   stringstream histo_number_stream;
1285   histo_number_stream << "h_";
1286   if (histo_index < 10)
1287     histo_number_stream << "0";
1288   histo_number_stream << histo_index << "_";
1289 
1290   for (int cut = 0; cut != numberOfSteps_; ++cut) {       //looping over Et cut values
1291     for (uint type = 0; type != types_.size(); ++type) {  //looping over isolation type
1292       currentFolder_.str("");
1293       currentFolder_ << "Egamma/" + fName_ + "/" << types_[type] << "Photons/Et above " << (cut + 1) * cutStep_
1294                      << " GeV";
1295       if (conversionPlot)
1296         currentFolder_ << "/Conversions";
1297 
1298       iBooker.setCurrentFolder(currentFolder_.str());
1299 
1300       string kind;
1301       if (conversionPlot)
1302         kind = " Conversions: ";
1303       else
1304         kind = " Photons: ";
1305 
1306       if (histoType == "1D")
1307         temp1DVector.push_back(
1308             iBooker.book1D(histo_number_stream.str() + histoName, types_[type] + kind + title, xbin, xmin, xmax));
1309       else if (histoType == "2D") {
1310         if ((TwoDPlot && type == 0) || !TwoDPlot) {  //only book the 2D plots in the "AllPhotons" folder
1311           temp1DVector.push_back(iBooker.book2D(
1312               histo_number_stream.str() + histoName, types_[type] + kind + title, xbin, xmin, xmax, ybin, ymin, ymax));
1313         }
1314       } else if (histoType == "Profile")
1315         temp1DVector.push_back(iBooker.bookProfile(
1316             histo_number_stream.str() + histoName, types_[type] + kind + title, xbin, xmin, xmax, ybin, ymin, ymax, ""));
1317       else
1318         cout << "bad histoType\n";
1319     }
1320 
1321     temp2DVector.push_back(temp1DVector);
1322     temp1DVector.clear();
1323   }
1324 }
1325 
1326 void PhotonAnalyzer::book3DHistoVector(DQMStore::IBooker& iBooker,
1327                                        vector<vector<vector<MonitorElement*> > >& temp3DVector,
1328                                        string histoType,
1329                                        string histoName,
1330                                        string title,
1331                                        int xbin,
1332                                        double xmin,
1333                                        double xmax,
1334                                        int ybin,
1335                                        double ymin,
1336                                        double ymax) {
1337   int histo_index = 0;
1338 
1339   vector<MonitorElement*> temp1DVector;
1340   vector<vector<MonitorElement*> > temp2DVector;
1341 
1342   //determining which folder we're in
1343   bool conversionPlot = false;
1344   if (iBooker.pwd().find("Conversions") != string::npos)
1345     conversionPlot = true;
1346 
1347   if (conversionPlot) {
1348     histo_index_conversions_++;
1349     histo_index = histo_index_conversions_;
1350   } else {
1351     histo_index_photons_++;
1352     histo_index = histo_index_photons_;
1353   }
1354 
1355   stringstream histo_number_stream;
1356   histo_number_stream << "h_";
1357   if (histo_index < 10)
1358     histo_number_stream << "0";
1359   histo_number_stream << histo_index << "_";
1360 
1361   for (int cut = 0; cut != numberOfSteps_; ++cut) {         //looping over Et cut values
1362     for (uint type = 0; type != types_.size(); ++type) {    //looping over isolation type
1363       for (uint part = 0; part != parts_.size(); ++part) {  //looping over different parts of the ecal
1364         currentFolder_.str("");
1365         currentFolder_ << "Egamma/" + fName_ + "/" << types_[type] << "Photons/Et above " << (cut + 1) * cutStep_
1366                        << " GeV";
1367         if (conversionPlot)
1368           currentFolder_ << "/Conversions";
1369         iBooker.setCurrentFolder(currentFolder_.str());
1370 
1371         string kind;
1372         if (conversionPlot)
1373           kind = " Conversions: ";
1374         else
1375           kind = " Photons: ";
1376 
1377         if (histoType == "1D")
1378           temp1DVector.push_back(iBooker.book1D(histo_number_stream.str() + histoName + parts_[part],
1379                                                 types_[type] + kind + parts_[part] + ": " + title,
1380                                                 xbin,
1381                                                 xmin,
1382                                                 xmax));
1383         else if (histoType == "2D")
1384           temp1DVector.push_back(iBooker.book2D(histo_number_stream.str() + histoName + parts_[part],
1385                                                 types_[type] + kind + parts_[part] + ": " + title,
1386                                                 xbin,
1387                                                 xmin,
1388                                                 xmax,
1389                                                 ybin,
1390                                                 ymin,
1391                                                 ymax));
1392         else if (histoType == "Profile")
1393           temp1DVector.push_back(iBooker.bookProfile(histo_number_stream.str() + histoName + parts_[part],
1394                                                      types_[type] + kind + parts_[part] + ": " + title,
1395                                                      xbin,
1396                                                      xmin,
1397                                                      xmax,
1398                                                      ybin,
1399                                                      ymin,
1400                                                      ymax,
1401                                                      ""));
1402         else
1403           cout << "bad histoType\n";
1404       }
1405       temp2DVector.push_back(temp1DVector);
1406       temp1DVector.clear();
1407     }
1408     temp3DVector.push_back(temp2DVector);
1409     temp2DVector.clear();
1410   }
1411 }
1412 
1413 // Analysis:
1414 
1415 void PhotonAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& esup) {
1416   using namespace edm;
1417 
1418   if (nEvt_ % prescaleFactor_)
1419     return;
1420   nEvt_++;
1421   LogInfo(fName_) << "PhotonAnalyzer Analyzing event number: " << e.id() << " Global Counter " << nEvt_ << "\n";
1422 
1423   // Get the trigger results
1424   bool validTriggerEvent = true;
1425   edm::Handle<trigger::TriggerEvent> triggerEventHandle;
1426   const trigger::TriggerEvent dummyTE;
1427   e.getByToken(triggerEvent_token_, triggerEventHandle);
1428   if (!triggerEventHandle.isValid()) {
1429     edm::LogInfo(fName_) << "Error! Can't get the product: triggerEvent_" << endl;
1430     validTriggerEvent = false;
1431   }
1432   const trigger::TriggerEvent& triggerEvent(validTriggerEvent ? *(triggerEventHandle.product()) : dummyTE);
1433 
1434   // Get the reconstructed photons
1435   //  bool validPhotons=true;
1436   Handle<reco::PhotonCollection> photonHandle;
1437   e.getByToken(photon_token_, photonHandle);
1438   if (!photonHandle.isValid()) {
1439     edm::LogInfo(fName_) << "Error! Can't get the product: photon_token_" << endl;
1440     // validPhotons=false;
1441   }
1442   const reco::PhotonCollection& photonCollection(*(photonHandle.product()));
1443 
1444   // Get the PhotonId objects
1445   //  bool validloosePhotonID=true;
1446   Handle<edm::ValueMap<bool> > loosePhotonFlag;
1447   e.getByToken(PhotonIDLoose_token_, loosePhotonFlag);
1448   if (!loosePhotonFlag.isValid()) {
1449     edm::LogInfo(fName_) << "Error! Can't get the product: PhotonIDLoose_token_" << endl;
1450     //    validloosePhotonID=false;
1451   }
1452   //  edm::ValueMap<bool> dummyLPID;
1453   //  const edm::ValueMap<bool>& loosePhotonID(validloosePhotonID? *(loosePhotonFlag.product()) : dummyLPID);
1454 
1455   //  bool validtightPhotonID=true;
1456   Handle<edm::ValueMap<bool> > tightPhotonFlag;
1457   e.getByToken(PhotonIDTight_token_, tightPhotonFlag);
1458   if (!tightPhotonFlag.isValid()) {
1459     edm::LogInfo(fName_) << "Error! Can't get the product: PhotonIDTight_token_" << endl;
1460     //    validtightPhotonID=false;
1461   }
1462   //  edm::ValueMap<bool> dummyTPI;
1463   //  const edm::ValueMap<bool>& tightPhotonID(validtightPhotonID ? *(tightPhotonFlag.product()) : dummyTPI);
1464 
1465   edm::Handle<reco::VertexCollection> vtxH;
1466   if (!isHeavyIon_) {
1467     e.getByToken(offline_pvToken_, vtxH);
1468     h_nRecoVtx_->Fill(float(vtxH->size()));
1469   }
1470 
1471   // Create array to hold #photons/event information
1472   int nPho[100][3][3];
1473 
1474   for (int cut = 0; cut != 100; ++cut) {
1475     for (unsigned int type = 0; type != types_.size(); ++type) {
1476       for (unsigned int part = 0; part != parts_.size(); ++part) {
1477         nPho[cut][type][part] = 0;
1478       }
1479     }
1480   }
1481   // Create array to hold #conversions/event information
1482   int nConv[100][3][3];
1483 
1484   for (int cut = 0; cut != 100; ++cut) {
1485     for (unsigned int type = 0; type != types_.size(); ++type) {
1486       for (unsigned int part = 0; part != parts_.size(); ++part) {
1487         nConv[cut][type][part] = 0;
1488       }
1489     }
1490   }
1491 
1492   //Prepare list of photon-related HLT filter names
1493   vector<int> Keys;
1494 
1495   for (uint filterIndex = 0; filterIndex < triggerEvent.sizeFilters();
1496        ++filterIndex) {  //loop over all trigger filters in event (i.e. filters passed)
1497     string label = triggerEvent.filterTag(filterIndex).label();
1498     if (label.find("Photon") != string::npos) {  //get photon-related filters
1499       for (uint filterKeyIndex = 0; filterKeyIndex < triggerEvent.filterKeys(filterIndex).size();
1500            ++filterKeyIndex) {  //loop over keys to objects passing this filter
1501         Keys.push_back(
1502             triggerEvent.filterKeys(filterIndex)[filterKeyIndex]);  //add keys to a vector for later reference
1503       }
1504     }
1505   }
1506 
1507   // sort Keys vector in ascending order
1508   // and erases duplicate entries from the vector
1509   sort(Keys.begin(), Keys.end());
1510   for (uint i = 0; i < Keys.size();) {
1511     if (i != (Keys.size() - 1)) {
1512       if (Keys[i] == Keys[i + 1])
1513         Keys.erase(Keys.begin() + i + 1);
1514       else
1515         ++i;
1516     } else
1517       ++i;
1518   }
1519 
1520   //We now have a vector of unique keys to TriggerObjects passing a photon-related filter
1521 
1522   // old int photonCounter = 0;
1523 
1524   /////////////////////////BEGIN LOOP OVER THE COLLECTION OF PHOTONS IN THE EVENT/////////////////////////
1525   for (unsigned int iPho = 0; iPho < photonHandle->size(); iPho++) {
1526     const reco::Photon* aPho = &photonCollection[iPho];
1527     //  for( reco::PhotonCollection::const_iterator  iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
1528 
1529     //for HLT efficiency plots
1530 
1531     h_phoEta_preHLT_->Fill(aPho->eta());
1532     h_phoEt_preHLT_->Fill(aPho->et());
1533 
1534     double deltaR = 1000.;
1535     double deltaRMin = 1000.;
1536     double deltaRMax = 0.05;  //sets deltaR threshold for matching photons to trigger objects
1537 
1538     for (vector<int>::const_iterator objectKey = Keys.begin(); objectKey != Keys.end();
1539          objectKey++) {  //loop over keys to objects that fired photon triggers
1540 
1541       deltaR = reco::deltaR(triggerEvent.getObjects()[(*objectKey)].eta(),
1542                             triggerEvent.getObjects()[(*objectKey)].phi(),
1543                             aPho->superCluster()->eta(),
1544                             aPho->superCluster()->phi());
1545       if (deltaR < deltaRMin)
1546         deltaRMin = deltaR;
1547     }
1548 
1549     if (deltaRMin > deltaRMax) {  //photon fails delta R cut
1550       if (useTriggerFiltering_)
1551         continue;  //throw away photons that haven't passed any photon filters
1552     }
1553 
1554     if (deltaRMin <= deltaRMax) {  //photon passes delta R cut
1555       h_phoEta_postHLT_->Fill(aPho->eta());
1556       h_phoEt_postHLT_->Fill(aPho->et());
1557     }
1558 
1559     //    if (aPho->et()  < minPhoEtCut_) continue;
1560     bool isLoosePhoton(false), isTightPhoton(false);
1561     if (photonSelection(aPho))
1562       isLoosePhoton = true;
1563 
1564     //find out which part of the Ecal contains the photon
1565     bool phoIsInBarrel = false;
1566     bool phoIsInEndcap = false;
1567     float etaPho = aPho->superCluster()->eta();
1568     if (fabs(etaPho) < 1.479)
1569       phoIsInBarrel = true;
1570     else {
1571       phoIsInEndcap = true;
1572     }
1573 
1574     int part = 0;
1575     if (phoIsInBarrel)
1576       part = 1;
1577     if (phoIsInEndcap)
1578       part = 2;
1579 
1580     /////  From 30X on, Photons are already pre-selected at reconstruction level with a looseEM isolation
1581     bool isIsolated = false;
1582     if (isolationStrength_ == 0)
1583       isIsolated = isLoosePhoton;
1584     if (isolationStrength_ == 1)
1585       isIsolated = isTightPhoton;
1586     if (isolationStrength_ == 2)
1587       isIsolated = photonSelectionSlimmed(aPho);
1588 
1589     int type = 0;
1590     if (isIsolated)
1591       type = 1;
1592     if (!excludeBkgHistos_ && !isIsolated)
1593       type = 2;
1594 
1595     //get rechit collection containing this photon
1596     bool validEcalRecHits = true;
1597     edm::Handle<EcalRecHitCollection> ecalRecHitHandle;
1598     EcalRecHitCollection ecalRecHitCollection;
1599     if (phoIsInBarrel) {
1600       // Get handle to barrel rec hits
1601       e.getByToken(barrelRecHit_token_, ecalRecHitHandle);
1602       if (!ecalRecHitHandle.isValid()) {
1603         edm::LogError(fName_) << "Error! Can't get the product: barrelRecHit_token_";
1604         validEcalRecHits = false;
1605       }
1606     } else if (phoIsInEndcap) {
1607       // Get handle to endcap rec hits
1608       e.getByToken(endcapRecHit_token_, ecalRecHitHandle);
1609       if (!ecalRecHitHandle.isValid()) {
1610         edm::LogError(fName_) << "Error! Can't get the product: endcapRecHit_token";
1611         validEcalRecHits = false;
1612       }
1613     }
1614     if (validEcalRecHits)
1615       ecalRecHitCollection = *(ecalRecHitHandle.product());
1616 
1617     //if (aPho->isEBEEGap()) continue;  //cut out gap photons
1618 
1619     //filling histograms to make isolation efficiencies
1620     if (isLoosePhoton) {
1621       h_phoEta_Loose_->Fill(aPho->eta());
1622       h_phoEt_Loose_->Fill(aPho->et());
1623     }
1624     if (isTightPhoton) {
1625       h_phoEta_Tight_->Fill(aPho->eta());
1626       h_phoEt_Tight_->Fill(aPho->et());
1627     }
1628 
1629     for (int cut = 0; cut != numberOfSteps_; ++cut) {  //loop over different transverse energy cuts
1630       double Et = aPho->et();
1631       bool passesCuts = false;
1632 
1633       //sorting the photon into the right Et-dependant folder
1634       if (useBinning_ && Et > (cut + 1) * cutStep_ && ((Et < (cut + 2) * cutStep_) | (cut == numberOfSteps_ - 1))) {
1635         passesCuts = true;
1636       } else if (!useBinning_ && Et > (cut + 1) * cutStep_) {
1637         passesCuts = true;
1638       }
1639 
1640       if (passesCuts) {
1641         //filling isolation variable histograms
1642 
1643         //tracker isolation variables
1644         fill2DHistoVector(h_nTrackIsolSolid_, aPho->nTrkSolidConeDR04(), cut, type);
1645         fill2DHistoVector(h_nTrackIsolHollow_, aPho->nTrkHollowConeDR04(), cut, type);
1646 
1647         if (standAlone_)
1648           fill2DHistoVector(h_nTrackIsolSolidVsEta_, aPho->eta(), aPho->nTrkSolidConeDR04(), cut, type);
1649         fill2DHistoVector(p_nTrackIsolSolidVsEta_, aPho->eta(), aPho->nTrkSolidConeDR04(), cut, type);
1650         if (standAlone_)
1651           fill2DHistoVector(h_nTrackIsolHollowVsEta_, aPho->eta(), aPho->nTrkHollowConeDR04(), cut, type);
1652         fill2DHistoVector(p_nTrackIsolHollowVsEta_, aPho->eta(), aPho->nTrkHollowConeDR04(), cut, type);
1653 
1654         if (standAlone_)
1655           fill2DHistoVector(h_nTrackIsolSolidVsEt_, aPho->et(), aPho->nTrkSolidConeDR04(), cut, type);
1656         fill2DHistoVector(p_nTrackIsolSolidVsEt_, aPho->et(), aPho->nTrkSolidConeDR04(), cut, type);
1657         if (standAlone_)
1658           fill2DHistoVector(h_nTrackIsolHollowVsEt_, aPho->et(), aPho->nTrkHollowConeDR04(), cut, type);
1659         fill2DHistoVector(p_nTrackIsolHollowVsEt_, aPho->et(), aPho->nTrkHollowConeDR04(), cut, type);
1660 
1661         ///////
1662         fill2DHistoVector(h_trackPtSumSolid_, aPho->trkSumPtSolidConeDR04(), cut, type);
1663         fill2DHistoVector(h_trackPtSumHollow_, aPho->trkSumPtSolidConeDR04(), cut, type);
1664 
1665         if (standAlone_)
1666           fill2DHistoVector(h_trackPtSumSolidVsEta_, aPho->eta(), aPho->trkSumPtSolidConeDR04(), cut, type);
1667         fill2DHistoVector(p_trackPtSumSolidVsEta_, aPho->eta(), aPho->trkSumPtSolidConeDR04(), cut, type);
1668         if (standAlone_)
1669           fill2DHistoVector(h_trackPtSumHollowVsEta_, aPho->eta(), aPho->trkSumPtHollowConeDR04(), cut, type);
1670         fill2DHistoVector(p_trackPtSumHollowVsEta_, aPho->eta(), aPho->trkSumPtHollowConeDR04(), cut, type);
1671 
1672         if (standAlone_)
1673           fill2DHistoVector(h_trackPtSumSolidVsEt_, aPho->et(), aPho->trkSumPtSolidConeDR04(), cut, type);
1674         fill2DHistoVector(p_trackPtSumSolidVsEt_, aPho->et(), aPho->trkSumPtSolidConeDR04(), cut, type);
1675         if (standAlone_)
1676           fill2DHistoVector(h_trackPtSumHollowVsEt_, aPho->et(), aPho->trkSumPtHollowConeDR04(), cut, type);
1677         fill2DHistoVector(p_trackPtSumHollowVsEt_, aPho->et(), aPho->trkSumPtHollowConeDR04(), cut, type);
1678         //calorimeter isolation variables
1679 
1680         fill2DHistoVector(h_ecalSum_, aPho->ecalRecHitSumEtConeDR04(), cut, type);
1681         if (aPho->isEB()) {
1682           fill2DHistoVector(h_ecalSumEBarrel_, aPho->ecalRecHitSumEtConeDR04(), cut, type);
1683         }
1684         if (aPho->isEE()) {
1685           fill2DHistoVector(h_ecalSumEEndcap_, aPho->ecalRecHitSumEtConeDR04(), cut, type);
1686         }
1687         if (standAlone_)
1688           fill2DHistoVector(h_ecalSumVsEta_, aPho->eta(), aPho->ecalRecHitSumEtConeDR04(), cut, type);
1689         fill2DHistoVector(p_ecalSumVsEta_, aPho->eta(), aPho->ecalRecHitSumEtConeDR04(), cut, type);
1690         if (standAlone_)
1691           fill2DHistoVector(h_ecalSumVsEt_, aPho->et(), aPho->ecalRecHitSumEtConeDR04(), cut, type);
1692         fill3DHistoVector(p_ecalSumVsEt_, aPho->et(), aPho->ecalRecHitSumEtConeDR04(), cut, type, part);
1693 
1694         ///////
1695 
1696         fill2DHistoVector(h_hcalSum_, aPho->hcalTowerSumEtConeDR04(), cut, type);
1697         if (aPho->isEB()) {
1698           fill2DHistoVector(h_hcalSumEBarrel_, aPho->hcalTowerSumEtConeDR04(), cut, type);
1699         }
1700         if (aPho->isEE()) {
1701           fill2DHistoVector(h_hcalSumEEndcap_, aPho->hcalTowerSumEtConeDR04(), cut, type);
1702         }
1703         if (standAlone_)
1704           fill2DHistoVector(h_hcalSumVsEta_, aPho->eta(), aPho->hcalTowerSumEtConeDR04(), cut, type);
1705         fill2DHistoVector(p_hcalSumVsEta_, aPho->eta(), aPho->hcalTowerSumEtConeDR04(), cut, type);
1706         if (standAlone_)
1707           fill2DHistoVector(h_hcalSumVsEt_, aPho->et(), aPho->hcalTowerSumEtConeDR04(), cut, type);
1708         fill3DHistoVector(p_hcalSumVsEt_, aPho->et(), aPho->hcalTowerSumEtConeDR04(), cut, type, part);
1709 
1710         fill3DHistoVector(h_hOverE_, aPho->hadronicOverEm(), cut, type, part);
1711         fill2DHistoVector(p_hOverEVsEta_, aPho->eta(), aPho->hadronicOverEm(), cut, type);
1712         fill2DHistoVector(p_hOverEVsEt_, aPho->et(), aPho->hadronicOverEm(), cut, type);
1713 
1714         fill3DHistoVector(h_h1OverE_, aPho->hadronicOverEm(1), cut, type, part);
1715         fill3DHistoVector(h_h2OverE_, aPho->hadronicOverEm(2), cut, type, part);
1716 
1717         // filling pf isolation variables
1718         if (aPho->isEB()) {
1719           fill2DHistoVector(h_phoIsoBarrel_, aPho->photonIso(), cut, type);
1720           fill2DHistoVector(h_chHadIsoBarrel_, aPho->chargedHadronIso(), cut, type);
1721           fill2DHistoVector(h_nHadIsoBarrel_, aPho->neutralHadronIso(), cut, type);
1722         }
1723         if (aPho->isEE()) {
1724           fill2DHistoVector(h_phoIsoEndcap_, aPho->photonIso(), cut, type);
1725           fill2DHistoVector(h_chHadIsoEndcap_, aPho->chargedHadronIso(), cut, type);
1726           fill2DHistoVector(h_nHadIsoEndcap_, aPho->neutralHadronIso(), cut, type);
1727         }
1728 
1729         //filling photon histograms
1730         nPho[cut][0][0]++;
1731         nPho[cut][0][part]++;
1732         if (type != 0) {
1733           nPho[cut][type][0]++;
1734           nPho[cut][type][part]++;
1735         }
1736 
1737         //energy variables
1738 
1739         fill3DHistoVector(h_phoE_, aPho->energy(), cut, type, part);
1740         fill3DHistoVector(h_phoSigmaEoverE_,
1741                           aPho->getCorrectedEnergyError(aPho->getCandidateP4type()) / aPho->energy(),
1742                           cut,
1743                           type,
1744                           part);
1745 
1746         if (!isHeavyIon_)
1747           fill3DHistoVector(p_phoSigmaEoverEvsNVtx_,
1748                             float(vtxH->size()),
1749                             aPho->getCorrectedEnergyError(aPho->getCandidateP4type()) / aPho->energy(),
1750                             cut,
1751                             type,
1752                             part);
1753 
1754         fill3DHistoVector(h_phoEt_, aPho->et(), cut, type, part);
1755 
1756         //geometrical variables
1757 
1758         fill2DHistoVector(h_phoEta_, aPho->eta(), cut, type);
1759         fill2DHistoVector(h_scEta_, aPho->superCluster()->eta(), cut, type);
1760 
1761         fill3DHistoVector(h_phoPhi_, aPho->phi(), cut, type, part);
1762         fill3DHistoVector(h_scPhi_, aPho->superCluster()->phi(), cut, type, part);
1763 
1764         //shower shape variables
1765 
1766         fill3DHistoVector(h_r9_, aPho->r9(), cut, type, part);
1767         if (standAlone_)
1768           fill2DHistoVector(h_r9VsEta_, aPho->eta(), aPho->r9(), cut, type);
1769         fill2DHistoVector(p_r9VsEta_, aPho->eta(), aPho->r9(), cut, type);
1770         if (standAlone_)
1771           fill2DHistoVector(h_r9VsEt_, aPho->et(), aPho->r9(), cut, type);
1772         fill2DHistoVector(p_r9VsEt_, aPho->et(), aPho->r9(), cut, type);
1773 
1774         if (standAlone_)
1775           fill2DHistoVector(h_e1x5VsEta_, aPho->eta(), aPho->e1x5(), cut, type);
1776         fill2DHistoVector(p_e1x5VsEta_, aPho->eta(), aPho->e1x5(), cut, type);
1777         if (standAlone_)
1778           fill2DHistoVector(h_e1x5VsEt_, aPho->et(), aPho->e1x5(), cut, type);
1779         fill2DHistoVector(p_e1x5VsEt_, aPho->et(), aPho->e1x5(), cut, type);
1780 
1781         if (standAlone_)
1782           fill2DHistoVector(h_e2x5VsEta_, aPho->eta(), aPho->e2x5(), cut, type);
1783         fill2DHistoVector(p_e2x5VsEta_, aPho->eta(), aPho->e2x5(), cut, type);
1784         if (standAlone_)
1785           fill2DHistoVector(h_e2x5VsEt_, aPho->et(), aPho->e2x5(), cut, type);
1786         fill2DHistoVector(p_e2x5VsEt_, aPho->et(), aPho->e2x5(), cut, type);
1787 
1788         if (standAlone_)
1789           fill2DHistoVector(h_maxEXtalOver3x3VsEta_, aPho->eta(), aPho->maxEnergyXtal() / aPho->e3x3(), cut, type);
1790         fill2DHistoVector(p_maxEXtalOver3x3VsEta_, aPho->eta(), aPho->maxEnergyXtal() / aPho->e3x3(), cut, type);
1791         if (standAlone_)
1792           fill2DHistoVector(h_maxEXtalOver3x3VsEt_, aPho->et(), aPho->maxEnergyXtal() / aPho->e3x3(), cut, type);
1793         fill2DHistoVector(p_maxEXtalOver3x3VsEt_, aPho->et(), aPho->maxEnergyXtal() / aPho->e3x3(), cut, type);
1794 
1795         if (standAlone_)
1796           fill2DHistoVector(h_r1x5VsEta_, aPho->eta(), aPho->r1x5(), cut, type);
1797         fill2DHistoVector(p_r1x5VsEta_, aPho->eta(), aPho->r1x5(), cut, type);
1798         if (standAlone_)
1799           fill2DHistoVector(h_r1x5VsEt_, aPho->et(), aPho->r1x5(), cut, type);
1800         fill2DHistoVector(p_r1x5VsEt_, aPho->et(), aPho->r1x5(), cut, type);
1801 
1802         if (standAlone_)
1803           fill2DHistoVector(h_r2x5VsEta_, aPho->eta(), aPho->r2x5(), cut, type);
1804         fill2DHistoVector(p_r2x5VsEta_, aPho->eta(), aPho->r2x5(), cut, type);
1805         if (standAlone_)
1806           fill2DHistoVector(h_r2x5VsEt_, aPho->et(), aPho->r2x5(), cut, type);
1807         fill2DHistoVector(p_r2x5VsEt_, aPho->et(), aPho->r2x5(), cut, type);
1808 
1809         fill3DHistoVector(h_phoSigmaIetaIeta_, aPho->sigmaIetaIeta(), cut, type, part);
1810         if (standAlone_)
1811           fill2DHistoVector(h_sigmaIetaIetaVsEta_, aPho->eta(), aPho->sigmaIetaIeta(), cut, type);
1812         fill2DHistoVector(p_sigmaIetaIetaVsEta_, aPho->eta(), aPho->sigmaIetaIeta(), cut, type);
1813 
1814         //filling histograms for photons containing a bad ECAL channel
1815         bool atLeastOneDeadChannel = false;
1816         for (reco::CaloCluster_iterator bcIt = aPho->superCluster()->clustersBegin();
1817              bcIt != aPho->superCluster()->clustersEnd();
1818              ++bcIt) {  //loop over basic clusters in SC
1819           for (vector<pair<DetId, float> >::const_iterator rhIt = (*bcIt)->hitsAndFractions().begin();
1820                rhIt != (*bcIt)->hitsAndFractions().end();
1821                ++rhIt) {  //loop over rec hits in basic cluster
1822 
1823             for (EcalRecHitCollection::const_iterator it = ecalRecHitCollection.begin();
1824                  it != ecalRecHitCollection.end();
1825                  ++it) {                        //loop over all rec hits to find the right ones
1826               if (rhIt->first == (*it).id()) {  //found the matching rechit
1827                 if ((*it).recoFlag() == 9) {    //has a bad channel
1828                   atLeastOneDeadChannel = true;
1829                   break;
1830                 }
1831               }
1832             }
1833           }
1834         }
1835         if (atLeastOneDeadChannel) {
1836           fill2DHistoVector(h_phoPhi_BadChannels_, aPho->phi(), cut, type);
1837           fill2DHistoVector(h_phoEta_BadChannels_, aPho->eta(), cut, type);
1838           fill2DHistoVector(h_phoEt_BadChannels_, aPho->et(), cut, type);
1839         }
1840 
1841         // filling conversion-related histograms
1842         if (aPho->hasConversionTracks()) {
1843           nConv[cut][0][0]++;
1844           nConv[cut][0][part]++;
1845           nConv[cut][type][0]++;
1846           nConv[cut][type][part]++;
1847         }
1848 
1849         //loop over conversions (don't forget, we're still inside the photon loop,
1850         // i.e. these are all the conversions for this ONE photon, not for all the photons in the event)
1851         reco::ConversionRefVector conversions = aPho->conversions();
1852         for (unsigned int iConv = 0; iConv < conversions.size(); iConv++) {
1853           reco::ConversionRef aConv = conversions[iConv];
1854 
1855           if (aConv->nTracks() < 2)
1856             continue;
1857 
1858           //fill histogram for denominator of vertex reconstruction efficiency plot
1859           if (cut == 0)
1860             h_phoEta_Vertex_->Fill(aConv->refittedPairMomentum().eta());
1861 
1862           if (!(aConv->conversionVertex().isValid()))
1863             continue;
1864 
1865           float chi2Prob = ChiSquaredProbability(aConv->conversionVertex().chi2(), aConv->conversionVertex().ndof());
1866 
1867           if (chi2Prob < 0.0005)
1868             continue;
1869 
1870           fill2DHistoVector(h_vertexChi2Prob_, chi2Prob, cut, type);
1871 
1872           fill3DHistoVector(h_phoConvE_, aPho->energy(), cut, type, part);
1873           fill3DHistoVector(h_phoConvEt_, aPho->et(), cut, type, part);
1874           fill3DHistoVector(h_phoConvR9_, aPho->r9(), cut, type, part);
1875 
1876           if (cut == 0 && isLoosePhoton) {
1877             h_convEta_Loose_->Fill(aPho->eta());
1878             h_convEt_Loose_->Fill(aPho->et());
1879           }
1880           if (cut == 0 && isTightPhoton) {
1881             h_convEta_Tight_->Fill(aPho->eta());
1882             h_convEt_Tight_->Fill(aPho->et());
1883           }
1884 
1885           fill2DHistoVector(h_phoConvEta_, aConv->refittedPairMomentum().eta(), cut, type);
1886           fill3DHistoVector(h_phoConvPhi_, aConv->refittedPairMomentum().phi(), cut, type, part);
1887 
1888           //we use the photon position because we'll be dividing it by a photon histogram (not a conversion histogram)
1889           fill2DHistoVector(h_phoConvEtaForEfficiency_, aPho->eta(), cut, type);
1890           fill3DHistoVector(h_phoConvPhiForEfficiency_, aPho->phi(), cut, type, part);
1891 
1892           //vertex histograms
1893           double convR = sqrt(aConv->conversionVertex().position().perp2());
1894           double scalar = aConv->conversionVertex().position().x() * aConv->refittedPairMomentum().x() +
1895                           aConv->conversionVertex().position().y() * aConv->refittedPairMomentum().y();
1896           if (scalar < 0)
1897             convR = -convR;
1898 
1899           fill2DHistoVector(h_convVtxRvsZ_,
1900                             aConv->conversionVertex().position().z(),
1901                             convR,
1902                             cut,
1903                             type);  //trying to "see" R-Z view of tracker
1904           fill2DHistoVector(h_convVtxZ_, aConv->conversionVertex().position().z(), cut, type);
1905 
1906           if (fabs(aPho->eta()) > 1.5) {  //trying to "see" tracker endcaps
1907             fill2DHistoVector(h_convVtxZEndcap_, aConv->conversionVertex().position().z(), cut, type);
1908           } else if (fabs(aPho->eta()) < 1) {  //trying to "see" tracker barrel
1909             fill2DHistoVector(h_convVtxR_, convR, cut, type);
1910             fill2DHistoVector(h_convVtxYvsX_,
1911                               aConv->conversionVertex().position().x(),
1912                               aConv->conversionVertex().position().y(),
1913                               cut,
1914                               type);
1915           }
1916 
1917           const std::vector<edm::RefToBase<reco::Track> > tracks = aConv->tracks();
1918 
1919           for (unsigned int i = 0; i < tracks.size(); i++) {
1920             fill2DHistoVector(h_tkChi2_, tracks[i]->normalizedChi2(), cut, type);
1921             fill2DHistoVector(p_tkChi2VsEta_, aPho->eta(), tracks[i]->normalizedChi2(), cut, type);
1922             fill2DHistoVector(p_dCotTracksVsEta_, aPho->eta(), aConv->pairCotThetaSeparation(), cut, type);
1923             fill2DHistoVector(p_nHitsVsEta_, aPho->eta(), float(tracks[i]->numberOfValidHits()), cut, type);
1924           }
1925 
1926           //calculating delta eta and delta phi of the two tracks
1927 
1928           float DPhiTracksAtVtx = -99;
1929           float dPhiTracksAtEcal = -99;
1930           float dEtaTracksAtEcal = -99;
1931 
1932           float phiTk1 = aConv->tracksPin()[0].phi();
1933           float phiTk2 = aConv->tracksPin()[1].phi();
1934           DPhiTracksAtVtx = phiTk1 - phiTk2;
1935           DPhiTracksAtVtx = phiNormalization(DPhiTracksAtVtx);
1936 
1937           if (!aConv->bcMatchingWithTracks().empty() && aConv->bcMatchingWithTracks()[0].isNonnull() &&
1938               aConv->bcMatchingWithTracks()[1].isNonnull()) {
1939             float recoPhi1 = aConv->ecalImpactPosition()[0].phi();
1940             float recoPhi2 = aConv->ecalImpactPosition()[1].phi();
1941             float recoEta1 = aConv->ecalImpactPosition()[0].eta();
1942             float recoEta2 = aConv->ecalImpactPosition()[1].eta();
1943 
1944             recoPhi1 = phiNormalization(recoPhi1);
1945             recoPhi2 = phiNormalization(recoPhi2);
1946 
1947             dPhiTracksAtEcal = recoPhi1 - recoPhi2;
1948             dPhiTracksAtEcal = phiNormalization(dPhiTracksAtEcal);
1949             dEtaTracksAtEcal = recoEta1 - recoEta2;
1950           }
1951 
1952           fill3DHistoVector(h_dPhiTracksAtVtx_, DPhiTracksAtVtx, cut, type, part);
1953           fill3DHistoVector(h_dPhiTracksAtEcal_, fabs(dPhiTracksAtEcal), cut, type, part);
1954           fill3DHistoVector(h_dEtaTracksAtEcal_, dEtaTracksAtEcal, cut, type, part);
1955           fill3DHistoVector(h_eOverPTracks_, aConv->EoverPrefittedTracks(), cut, type, part);
1956           fill3DHistoVector(h_pOverETracks_, 1. / aConv->EoverPrefittedTracks(), cut, type, part);
1957           fill3DHistoVector(h_dCotTracks_, aConv->pairCotThetaSeparation(), cut, type, part);
1958         }  //end loop over conversions
1959       }  //end loop over photons passing cuts
1960     }  //end loop over transverse energy cuts
1961 
1962     //make invariant mass plots
1963 
1964     if (isIsolated && aPho->et() >= invMassEtCut_) {
1965       for (unsigned int iPho2 = iPho + 1; iPho2 < photonHandle->size(); iPho2++) {
1966         const reco::Photon* aPho2 = &photonCollection[iPho2];
1967 
1968         //      for (reco::PhotonCollection::const_iterator iPho2=iPho+1; iPho2!=photonCollection.end(); iPho2++){
1969 
1970         //  edm::Ref<reco::PhotonCollection> photonref2(photonHandle, photonCounter); //note: it's correct to use photonCounter and not photonCounter+1
1971         //since it has already been incremented earlier
1972 
1973         bool isTightPhoton2(false), isLoosePhoton2(false);
1974         if (photonSelection(aPho2))
1975           isLoosePhoton2 = true;
1976 
1977         // Old if ( !isHeavyIon_ ) {
1978         //  isTightPhoton2 = (tightPhotonID)[aPho2];
1979         // isLoosePhoton2 = (loosePhotonID)[aPho2];
1980         //  }
1981 
1982         bool isIsolated2 = false;
1983         if (isolationStrength_ == 0)
1984           isIsolated2 = isLoosePhoton2;
1985         if (isolationStrength_ == 1)
1986           isIsolated2 = isTightPhoton2;
1987         if (isolationStrength_ == 2)
1988           isIsolated2 = photonSelectionSlimmed(aPho2);
1989 
1990         reco::ConversionRefVector conversions = aPho->conversions();
1991         reco::ConversionRefVector conversions2 = aPho2->conversions();
1992 
1993         if (isIsolated2 && aPho2->et() >= invMassEtCut_) {
1994           math::XYZTLorentzVector p12 = aPho->p4() + aPho2->p4();
1995           float gamgamMass2 = p12.Dot(p12);
1996 
1997           h_invMassAllPhotons_->Fill(sqrt(gamgamMass2));
1998           if (aPho->isEB() && aPho2->isEB()) {
1999             h_invMassPhotonsEBarrel_->Fill(sqrt(gamgamMass2));
2000           } else if (aPho->isEE() && aPho2->isEE()) {
2001             h_invMassPhotonsEEndcap_->Fill(sqrt(gamgamMass2));
2002           } else {
2003             h_invMassPhotonsEEndcapEBarrel_->Fill(sqrt(gamgamMass2));
2004           }
2005 
2006           if (!conversions.empty() && conversions[0]->nTracks() >= 2) {
2007             if (!conversions2.empty() && conversions2[0]->nTracks() >= 2)
2008               h_invMassTwoWithTracks_->Fill(sqrt(gamgamMass2));
2009             else
2010               h_invMassOneWithTracks_->Fill(sqrt(gamgamMass2));
2011           } else if (!conversions2.empty() && conversions2[0]->nTracks() >= 2)
2012             h_invMassOneWithTracks_->Fill(sqrt(gamgamMass2));
2013           else
2014             h_invMassZeroWithTracks_->Fill(sqrt(gamgamMass2));
2015         }
2016       }
2017     }
2018   }  /// End loop over Reco photons
2019 
2020   //filling number of photons/conversions per event histograms
2021   for (int cut = 0; cut != numberOfSteps_; ++cut) {
2022     for (uint type = 0; type != types_.size(); ++type) {
2023       for (uint part = 0; part != parts_.size(); ++part) {
2024         h_nPho_[cut][type][part]->Fill(float(nPho[cut][type][part]));
2025         h_nConv_[cut][type][part]->Fill(float(nConv[cut][type][part]));
2026       }
2027     }
2028   }
2029 }  //End of Analyze method
2030 
2031 ////////////BEGIN AUXILIARY FUNCTIONS//////////////
2032 
2033 float PhotonAnalyzer::phiNormalization(float& phi) {
2034   const float PI = 3.1415927;
2035   const float TWOPI = 2.0 * PI;
2036 
2037   if (phi > PI) {
2038     phi = phi - TWOPI;
2039   }
2040   if (phi < -PI) {
2041     phi = phi + TWOPI;
2042   }
2043 
2044   return phi;
2045 }
2046 
2047 void PhotonAnalyzer::fill2DHistoVector(
2048     vector<vector<MonitorElement*> >& histoVector, double x, double y, int cut, int type) {
2049   histoVector[cut][0]->Fill(x, y);
2050   if (histoVector[cut].size() > 1)
2051     histoVector[cut][type]->Fill(x, y);  //don't try to fill 2D histos that are only in the "AllPhotons" folder
2052 }
2053 
2054 void PhotonAnalyzer::fill2DHistoVector(vector<vector<MonitorElement*> >& histoVector, double x, int cut, int type) {
2055   histoVector[cut][0]->Fill(x);
2056   histoVector[cut][type]->Fill(x);
2057 }
2058 
2059 void PhotonAnalyzer::fill3DHistoVector(
2060     vector<vector<vector<MonitorElement*> > >& histoVector, double x, int cut, int type, int part) {
2061   histoVector[cut][0][0]->Fill(x);
2062   histoVector[cut][0][part]->Fill(x);
2063   histoVector[cut][type][0]->Fill(x);
2064   histoVector[cut][type][part]->Fill(x);
2065 }
2066 
2067 void PhotonAnalyzer::fill3DHistoVector(
2068     vector<vector<vector<MonitorElement*> > >& histoVector, double x, double y, int cut, int type, int part) {
2069   histoVector[cut][0][0]->Fill(x, y);
2070   histoVector[cut][0][part]->Fill(x, y);
2071   histoVector[cut][type][0]->Fill(x, y);
2072   histoVector[cut][type][part]->Fill(x, y);
2073 }
2074 
2075 bool PhotonAnalyzer::photonSelection(const reco::Photon* pho) {
2076   bool result = true;
2077   if (pho->pt() < minPhoEtCut_)
2078     result = false;
2079   if (fabs(pho->eta()) > photonMaxEta_)
2080     result = false;
2081   if (pho->isEBEEGap())
2082     result = false;
2083 
2084   double EtCorrHcalIso = pho->hcalTowerSumEtConeDR03() - 0.005 * pho->pt();
2085   double EtCorrTrkIso = pho->trkSumPtHollowConeDR03() - 0.002 * pho->pt();
2086 
2087   if (pho->r9() <= 0.9) {
2088     if (pho->isEB() && (pho->hadTowOverEm() > 0.075 || pho->sigmaIetaIeta() > 0.014))
2089       result = false;
2090     if (pho->isEE() && (pho->hadTowOverEm() > 0.075 || pho->sigmaIetaIeta() > 0.034))
2091       result = false;
2092     ///  remove after moriond    if (EtCorrEcalIso>4.0) result=false;
2093     if (EtCorrHcalIso > 4.0)
2094       result = false;
2095     if (EtCorrTrkIso > 4.0)
2096       result = false;
2097     if (pho->chargedHadronIso() > 4)
2098       result = false;
2099   } else {
2100     if (pho->isEB() && (pho->hadTowOverEm() > 0.082 || pho->sigmaIetaIeta() > 0.014))
2101       result = false;
2102     if (pho->isEE() && (pho->hadTowOverEm() > 0.075 || pho->sigmaIetaIeta() > 0.034))
2103       result = false;
2104     /// remove after moriond if (EtCorrEcalIso>50.0) result=false;
2105     if (EtCorrHcalIso > 50.0)
2106       result = false;
2107     if (EtCorrTrkIso > 50.0)
2108       result = false;
2109     if (pho->chargedHadronIso() > 4)
2110       result = false;
2111   }
2112   return result;
2113 }
2114 
2115 bool PhotonAnalyzer::photonSelectionSlimmed(const reco::Photon* pho) {
2116   bool result = true;
2117 
2118   if (pho->pt() < minPhoEtCut_)
2119     result = false;
2120   if (fabs(pho->eta()) > photonMaxEta_)
2121     result = false;
2122   if (pho->isEBEEGap())
2123     result = false;
2124 
2125   return result;
2126 }