Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 
0002 /** \class ZToMuMuGammaAnalyzer
0003  **  
0004  **
0005  **  $Id: ZToMuMuGammaAnalyzer
0006  **  authors: 
0007  **   Nancy Marinelli, U. of Notre Dame, US  
0008  **   Jamie Antonelli, U. of Notre Dame, US
0009  **   Nathan Kellams,  U. of Notre Dame, US
0010  **     
0011  ***/
0012 
0013 #include "FWCore/ServiceRegistry/interface/Service.h"
0014 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0015 
0016 #include "FWCore/Framework/interface/Event.h"
0017 #include "FWCore/Framework/interface/EventSetup.h"
0018 #include "FWCore/Framework/interface/Frameworkfwd.h"
0019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 #include "FWCore/Utilities/interface/Exception.h"
0022 
0023 // DataFormats
0024 #include "DataFormats/Math/interface/deltaR.h"
0025 #include "DataFormats/Common/interface/Handle.h"
0026 #include "DataFormats/TrackReco/interface/Track.h"
0027 #include "DataFormats/TrackReco/interface/TrackExtra.h"
0028 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0029 #include "DataFormats/Common/interface/ValueMap.h"
0030 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
0031 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
0032 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0033 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
0034 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0035 #include "DataFormats/MuonReco/interface/MuonSelectors.h"
0036 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0037 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0038 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0039 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0040 #include "DataFormats/DetId/interface/DetId.h"
0041 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0042 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0043 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
0044 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h"
0045 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
0046 
0047 /// EgammaCoreTools
0048 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
0049 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
0050 
0051 #include "CommonTools/Statistics/interface/ChiSquaredProbability.h"
0052 
0053 // Geometry
0054 #include "Geometry/Records/interface/CaloTopologyRecord.h"
0055 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0056 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0057 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0058 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0059 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0060 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0061 #include "Geometry/CaloTopology/interface/EcalEndcapTopology.h"
0062 #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h"
0063 
0064 #include "TFile.h"
0065 #include "TH1.h"
0066 #include "TH2.h"
0067 #include "TTree.h"
0068 #include "TVector3.h"
0069 #include "TProfile.h"
0070 
0071 //DQM services
0072 #include <DQMServices/Core/interface/DQMStore.h>
0073 #include <DQMServices/Core/interface/DQMEDAnalyzer.h>
0074 
0075 #include <vector>
0076 #include <string>
0077 #include <iostream>
0078 #include <iomanip>
0079 
0080 class ZToMuMuGammaAnalyzer : public DQMEDAnalyzer {
0081 public:
0082   explicit ZToMuMuGammaAnalyzer(const edm::ParameterSet&);
0083   ~ZToMuMuGammaAnalyzer() override;
0084   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0085   void analyze(const edm::Event&, const edm::EventSetup&) override;
0086 
0087 private:
0088   edm::EDGetTokenT<std::vector<reco::Photon> > photon_token_;
0089   edm::EDGetTokenT<std::vector<reco::Muon> > muon_token_;
0090   edm::EDGetTokenT<edm::ValueMap<bool> > PhotonIDLoose_token_;
0091   edm::EDGetTokenT<edm::ValueMap<bool> > PhotonIDTight_token_;
0092   edm::EDGetTokenT<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit> > > barrelRecHit_token_;
0093   edm::EDGetTokenT<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit> > > endcapRecHit_token_;
0094   edm::EDGetTokenT<trigger::TriggerEvent> triggerEvent_token_;
0095   edm::EDGetTokenT<reco::BeamSpot> beamSpot_token_;
0096   edm::EDGetTokenT<reco::PFCandidateCollection> pfCandidates_;
0097   edm::EDGetTokenT<reco::VertexCollection> offline_pvToken_;
0098   edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef> > > photonIsoValmap_token_;
0099 
0100   std::string fName_;
0101   bool use2DHistos_;
0102   bool makeProfiles_;
0103   unsigned int prescaleFactor_;
0104   std::stringstream currentFolder_;
0105   int nEvt_;
0106 
0107   // muon selection
0108   float muonMinPt_;
0109   int minPixStripHits_;
0110   float muonMaxChi2_;
0111   float muonMaxDxy_;
0112   int muonMatches_;
0113   int validPixHits_;
0114   int validMuonHits_;
0115   float muonTrackIso_;
0116   float muonTightEta_;
0117   // dimuon selection
0118   float minMumuInvMass_;
0119   float maxMumuInvMass_;
0120   // photon selection
0121   float photonMinEt_;
0122   float photonMaxEta_;
0123   float photonTrackIso_;
0124 
0125   // mu mu gamma selection
0126   float nearMuonDr2_;
0127   float nearMuonHcalIso_;
0128   float farMuonEcalIso_;
0129   float farMuonTrackIso_;
0130   float farMuonMinPt_;
0131   float minMumuGammaInvMass_;
0132   float maxMumuGammaInvMass_;
0133 
0134   // Histogram parameters
0135   double eMin_;
0136   double eMax_;
0137   int eBin_;
0138 
0139   double etMin_;
0140   double etMax_;
0141   int etBin_;
0142 
0143   double sumMin_;
0144   double sumMax_;
0145   int sumBin_;
0146 
0147   double etaMin_;
0148   double etaMax_;
0149   int etaBin_;
0150 
0151   double phiMin_;
0152   double phiMax_;
0153   int phiBin_;
0154 
0155   double r9Min_;
0156   double r9Max_;
0157   int r9Bin_;
0158 
0159   double hOverEMin_;
0160   double hOverEMax_;
0161   int hOverEBin_;
0162 
0163   double numberMin_;
0164   double numberMax_;
0165   int numberBin_;
0166 
0167   double sigmaIetaMin_;
0168   double sigmaIetaMax_;
0169   int sigmaIetaBin_;
0170 
0171   int reducedEtBin_;
0172   int reducedEtaBin_;
0173   int reducedSumBin_;
0174   int reducedR9Bin_;
0175 
0176   float mumuInvMass(const reco::Muon& m1, const reco::Muon& m2);
0177   float mumuGammaInvMass(const reco::Muon& mu1, const reco::Muon& mu2, const reco::PhotonRef& pho);
0178   bool basicMuonSelection(const reco::Muon& m);
0179   bool muonSelection(const reco::Muon& m, const reco::BeamSpot& bs);
0180   bool photonSelection(const reco::PhotonRef& p);
0181 
0182   MonitorElement* h_nRecoVtx_;
0183   ///photon histos
0184   MonitorElement* h1_mumuInvMass_[3];
0185   MonitorElement* h1_mumuGammaInvMass_[3];
0186 
0187   MonitorElement* h_phoE_[3];
0188   MonitorElement* h_phoSigmaEoverE_[3];
0189   MonitorElement* p_phoSigmaEoverEVsNVtx_[3];
0190   MonitorElement* h_phoEt_[3];
0191 
0192   MonitorElement* h_nPho_[3];
0193 
0194   MonitorElement* h_phoEta_[3];
0195   MonitorElement* h_phoPhi_[3];
0196   MonitorElement* h_scEta_[3];
0197   MonitorElement* h_scPhi_[3];
0198 
0199   MonitorElement* h_r9_[3];
0200   MonitorElement* h2_r9VsEt_[3];
0201   MonitorElement* p_r9VsEt_[3];
0202   MonitorElement* h2_r9VsEta_[3];
0203   MonitorElement* p_r9VsEta_[3];
0204 
0205   MonitorElement* h_e1x5_[3];
0206   MonitorElement* h2_e1x5VsEta_[3];
0207   MonitorElement* p_e1x5VsEta_[3];
0208   MonitorElement* h2_e1x5VsEt_[3];
0209   MonitorElement* p_e1x5VsEt_[3];
0210 
0211   MonitorElement* h_e2x5_[3];
0212   MonitorElement* h2_e2x5VsEta_[3];
0213   MonitorElement* p_e2x5VsEta_[3];
0214   MonitorElement* h2_e2x5VsEt_[3];
0215   MonitorElement* p_e2x5VsEt_[3];
0216 
0217   MonitorElement* h_r1x5_[3];
0218   MonitorElement* h2_r1x5VsEta_[3];
0219   MonitorElement* p_r1x5VsEta_[3];
0220   MonitorElement* h2_r1x5VsEt_[3];
0221   MonitorElement* p_r1x5VsEt_[3];
0222 
0223   MonitorElement* h_r2x5_[3];
0224   MonitorElement* h2_r2x5VsEta_[3];
0225   MonitorElement* p_r2x5VsEta_[3];
0226   MonitorElement* h2_r2x5VsEt_[3];
0227   MonitorElement* p_r2x5VsEt_[3];
0228 
0229   MonitorElement* h_phoSigmaIetaIeta_[3];
0230   MonitorElement* h2_sigmaIetaIetaVsEta_[3];
0231   MonitorElement* p_sigmaIetaIetaVsEta_[3];
0232 
0233   MonitorElement* h_nTrackIsolSolid_[3];
0234   MonitorElement* h2_nTrackIsolSolidVsEt_[3];
0235   MonitorElement* p_nTrackIsolSolidVsEt_[3];
0236   MonitorElement* h2_nTrackIsolSolidVsEta_[3];
0237   MonitorElement* p_nTrackIsolSolidVsEta_[3];
0238 
0239   MonitorElement* h_nTrackIsolHollow_[3];
0240   MonitorElement* h2_nTrackIsolHollowVsEt_[3];
0241   MonitorElement* p_nTrackIsolHollowVsEt_[3];
0242   MonitorElement* h2_nTrackIsolHollowVsEta_[3];
0243   MonitorElement* p_nTrackIsolHollowVsEta_[3];
0244 
0245   MonitorElement* h_trackPtSumSolid_[3];
0246   MonitorElement* h2_trackPtSumSolidVsEt_[3];
0247   MonitorElement* p_trackPtSumSolidVsEt_[3];
0248   MonitorElement* h2_trackPtSumSolidVsEta_[3];
0249   MonitorElement* p_trackPtSumSolidVsEta_[3];
0250 
0251   MonitorElement* h_trackPtSumHollow_[3];
0252   MonitorElement* h2_trackPtSumHollowVsEt_[3];
0253   MonitorElement* p_trackPtSumHollowVsEt_[3];
0254   MonitorElement* h2_trackPtSumHollowVsEta_[3];
0255   MonitorElement* p_trackPtSumHollowVsEta_[3];
0256 
0257   MonitorElement* h_ecalSum_[3];
0258   MonitorElement* h2_ecalSumVsEt_[3];
0259   MonitorElement* p_ecalSumVsEt_[3];
0260   MonitorElement* h2_ecalSumVsEta_[3];
0261   MonitorElement* p_ecalSumVsEta_[3];
0262 
0263   MonitorElement* h_hcalSum_[3];
0264   MonitorElement* h2_hcalSumVsEt_[3];
0265   MonitorElement* p_hcalSumVsEt_[3];
0266   MonitorElement* h2_hcalSumVsEta_[3];
0267   MonitorElement* p_hcalSumVsEta_[3];
0268 
0269   MonitorElement* h_hOverE_[3];
0270   MonitorElement* p_hOverEVsEt_[3];
0271   MonitorElement* p_hOverEVsEta_[3];
0272   MonitorElement* h_h1OverE_[3];
0273   MonitorElement* h_h2OverE_[3];
0274 
0275   MonitorElement* h_newhOverE_[3];
0276   MonitorElement* p_newhOverEVsEta_[3];
0277   MonitorElement* p_newhOverEVsEt_[3];
0278   // Information from Particle Flow
0279   // Isolation
0280   MonitorElement* h_chHadIso_[3];
0281   MonitorElement* h_nHadIso_[3];
0282   MonitorElement* h_phoIso_[3];
0283   // Identification
0284   MonitorElement* h_nCluOutsideMustache_[3];
0285   MonitorElement* h_etOutsideMustache_[3];
0286   MonitorElement* h_pfMva_[3];
0287   //// particle based isolation from ValueMap
0288   MonitorElement* h_dRPhoPFcand_ChHad_Cleaned_[3];
0289   MonitorElement* h_dRPhoPFcand_NeuHad_Cleaned_[3];
0290   MonitorElement* h_dRPhoPFcand_Pho_Cleaned_[3];
0291   MonitorElement* h_dRPhoPFcand_ChHad_unCleaned_[3];
0292   MonitorElement* h_dRPhoPFcand_NeuHad_unCleaned_[3];
0293   MonitorElement* h_dRPhoPFcand_Pho_unCleaned_[3];
0294   MonitorElement* h_SumPtOverPhoPt_ChHad_Cleaned_[3];
0295   MonitorElement* h_SumPtOverPhoPt_NeuHad_Cleaned_[3];
0296   MonitorElement* h_SumPtOverPhoPt_Pho_Cleaned_[3];
0297   MonitorElement* h_SumPtOverPhoPt_ChHad_unCleaned_[3];
0298   MonitorElement* h_SumPtOverPhoPt_NeuHad_unCleaned_[3];
0299   MonitorElement* h_SumPtOverPhoPt_Pho_unCleaned_[3];
0300 };
0301 
0302 using namespace std;
0303 
0304 ZToMuMuGammaAnalyzer::ZToMuMuGammaAnalyzer(const edm::ParameterSet& pset) {
0305   fName_ = pset.getParameter<std::string>("analyzerName");
0306   prescaleFactor_ = pset.getUntrackedParameter<int>("prescaleFactor", 1);
0307   use2DHistos_ = pset.getParameter<bool>("use2DHistos");
0308   makeProfiles_ = pset.getParameter<bool>("makeProfiles");
0309 
0310   triggerEvent_token_ = consumes<trigger::TriggerEvent>(pset.getParameter<edm::InputTag>("triggerEvent"));
0311   offline_pvToken_ = consumes<reco::VertexCollection>(
0312       pset.getUntrackedParameter<edm::InputTag>("offlinePV", edm::InputTag("offlinePrimaryVertices")));
0313   photon_token_ = consumes<vector<reco::Photon> >(pset.getParameter<edm::InputTag>("phoProducer"));
0314   muon_token_ = consumes<vector<reco::Muon> >(pset.getParameter<edm::InputTag>("muonProducer"));
0315   pfCandidates_ = consumes<reco::PFCandidateCollection>(pset.getParameter<edm::InputTag>("pfCandidates"));
0316   photonIsoValmap_token_ = consumes<edm::ValueMap<std::vector<reco::PFCandidateRef> > >(
0317       pset.getParameter<edm::InputTag>("particleBasedIso"));
0318   barrelRecHit_token_ = consumes<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit> > >(
0319       pset.getParameter<edm::InputTag>("barrelRecHitProducer"));
0320   endcapRecHit_token_ = consumes<edm::SortedCollection<EcalRecHit, edm::StrictWeakOrdering<EcalRecHit> > >(
0321       pset.getParameter<edm::InputTag>("endcapRecHitProducer"));
0322   beamSpot_token_ = consumes<reco::BeamSpot>(pset.getParameter<edm::InputTag>("beamSpot"));
0323 
0324   nEvt_ = 0;
0325 
0326   // Muon selection
0327   muonMinPt_ = pset.getParameter<double>("muonMinPt");
0328   minPixStripHits_ = pset.getParameter<int>("minPixStripHits");
0329   muonMaxChi2_ = pset.getParameter<double>("muonMaxChi2");
0330   muonMaxDxy_ = pset.getParameter<double>("muonMaxDxy");
0331   muonMatches_ = pset.getParameter<int>("muonMatches");
0332   validPixHits_ = pset.getParameter<int>("validPixHits");
0333   validMuonHits_ = pset.getParameter<int>("validMuonHits");
0334   muonTrackIso_ = pset.getParameter<double>("muonTrackIso");
0335   muonTightEta_ = pset.getParameter<double>("muonTightEta");
0336   // Dimuon selection
0337   minMumuInvMass_ = pset.getParameter<double>("minMumuInvMass");
0338   maxMumuInvMass_ = pset.getParameter<double>("maxMumuInvMass");
0339   // Photon selection
0340   photonMinEt_ = pset.getParameter<double>("photonMinEt");
0341   photonMaxEta_ = pset.getParameter<double>("photonMaxEta");
0342   photonTrackIso_ = pset.getParameter<double>("photonTrackIso");
0343   // mumuGamma selection
0344   nearMuonDr2_ = pset.getParameter<double>("nearMuonDr");
0345   nearMuonDr2_ *= nearMuonDr2_;
0346   nearMuonHcalIso_ = pset.getParameter<double>("nearMuonHcalIso");
0347   farMuonEcalIso_ = pset.getParameter<double>("farMuonEcalIso");
0348   farMuonTrackIso_ = pset.getParameter<double>("farMuonTrackIso");
0349   farMuonMinPt_ = pset.getParameter<double>("farMuonMinPt");
0350   minMumuGammaInvMass_ = pset.getParameter<double>("minMumuGammaInvMass");
0351   maxMumuGammaInvMass_ = pset.getParameter<double>("maxMumuGammaInvMass");
0352 
0353   // Histogram parameters
0354   eMin_ = pset.getParameter<double>("eMin");
0355   eMax_ = pset.getParameter<double>("eMax");
0356   eBin_ = pset.getParameter<int>("eBin");
0357 
0358   etMin_ = pset.getParameter<double>("etMin");
0359   etMax_ = pset.getParameter<double>("etMax");
0360   etBin_ = pset.getParameter<int>("etBin");
0361 
0362   sumMin_ = pset.getParameter<double>("sumMin");
0363   sumMax_ = pset.getParameter<double>("sumMax");
0364   sumBin_ = pset.getParameter<int>("sumBin");
0365 
0366   etaMin_ = pset.getParameter<double>("etaMin");
0367   etaMax_ = pset.getParameter<double>("etaMax");
0368   etaBin_ = pset.getParameter<int>("etaBin");
0369 
0370   phiMin_ = pset.getParameter<double>("phiMin");
0371   phiMax_ = pset.getParameter<double>("phiMax");
0372   phiBin_ = pset.getParameter<int>("phiBin");
0373 
0374   r9Min_ = pset.getParameter<double>("r9Min");
0375   r9Max_ = pset.getParameter<double>("r9Max");
0376   r9Bin_ = pset.getParameter<int>("r9Bin");
0377 
0378   hOverEMin_ = pset.getParameter<double>("hOverEMin");
0379   hOverEMax_ = pset.getParameter<double>("hOverEMax");
0380   hOverEBin_ = pset.getParameter<int>("hOverEBin");
0381 
0382   numberMin_ = pset.getParameter<double>("numberMin");
0383   numberMax_ = pset.getParameter<double>("numberMax");
0384   numberBin_ = pset.getParameter<int>("numberBin");
0385 
0386   sigmaIetaMin_ = pset.getParameter<double>("sigmaIetaMin");
0387   sigmaIetaMax_ = pset.getParameter<double>("sigmaIetaMax");
0388   sigmaIetaBin_ = pset.getParameter<int>("sigmaIetaBin");
0389 
0390   reducedEtBin_ = etBin_ / 4;
0391   reducedEtaBin_ = etaBin_ / 4;
0392   reducedSumBin_ = sumBin_ / 4;
0393   reducedR9Bin_ = r9Bin_ / 4;
0394 }
0395 
0396 ZToMuMuGammaAnalyzer::~ZToMuMuGammaAnalyzer() {}
0397 
0398 void ZToMuMuGammaAnalyzer::bookHistograms(DQMStore::IBooker& iBooker,
0399                                           edm::Run const& /* iRun */,
0400                                           edm::EventSetup const& /* iSetup */) {
0401   ////////////////START OF BOOKING FOR ALL HISTOGRAMS////////////////
0402   iBooker.setCurrentFolder("Egamma/" + fName_ + "/ZToMuMuGamma");
0403 
0404   h1_mumuInvMass_[0] = iBooker.book1D("mumuInvMass", "Two muon invariant mass: M (GeV)", etBin_, etMin_, etMax_);
0405   h1_mumuGammaInvMass_[0] =
0406       iBooker.book1D("mumuGammaInvMass", "Two-muon plus gamma invariant mass: M (GeV)", etBin_, etMin_, etMax_);
0407   h1_mumuGammaInvMass_[1] =
0408       iBooker.book1D("mumuGammaInvMassBarrel", "Two-muon plus gamma invariant mass: M (GeV)", etBin_, etMin_, etMax_);
0409   h1_mumuGammaInvMass_[2] =
0410       iBooker.book1D("mumuGammaInvMassEndcap", "Two-muon plus gamma invariant mass: M (GeV)", etBin_, etMin_, etMax_);
0411 
0412   ////////////////START OF BOOKING FOR PHOTON-RELATED HISTOGRAMS////////////////
0413   //// 1D Histograms ////
0414   h_nRecoVtx_ = iBooker.book1D("nOfflineVtx", "# of Offline Vertices", 200, -0.5, 199.5);
0415 
0416   //ENERGY
0417   h_phoE_[0] = iBooker.book1D("phoE", "Energy;E (GeV)", eBin_, eMin_, eMax_);
0418   h_phoSigmaEoverE_[0] = iBooker.book1D("phoSigmaEoverE", "All Ecal: #sigma_{E}/E;#sigma_{E}/E", eBin_, eMin_, eMax_);
0419   h_phoEt_[0] = iBooker.book1D("phoEt", "E_{T};E_{T} (GeV)", etBin_, etMin_, etMax_);
0420 
0421   //NUMBER OF PHOTONS
0422   h_nPho_[0] = iBooker.book1D("nPho", "Number of Photons per Event;# #gamma", numberBin_, numberMin_, numberMax_);
0423 
0424   //GEOMETRICAL
0425   h_phoEta_[0] = iBooker.book1D("phoEta", "#eta;#eta", etaBin_, etaMin_, etaMax_);
0426   h_phoPhi_[0] = iBooker.book1D("phoPhi", "#phi;#phi", phiBin_, phiMin_, phiMax_);
0427 
0428   h_scEta_[0] = iBooker.book1D("scEta", "SuperCluster #eta;#eta", etaBin_, etaMin_, etaMax_);
0429   h_scPhi_[0] = iBooker.book1D("scPhi", "SuperCluster #phi;#phi", phiBin_, phiMin_, phiMax_);
0430 
0431   //SHOWER SHAPE
0432   h_r9_[0] = iBooker.book1D("r9", "R9;R9", r9Bin_, r9Min_, r9Max_);
0433   h_e1x5_[0] = iBooker.book1D("e1x5", "E1x5;E1X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0434   h_e2x5_[0] = iBooker.book1D("e2x5", "E2x5;E2X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0435   h_r1x5_[0] = iBooker.book1D("r1x5", "r1x5;r1X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0436   h_r2x5_[0] = iBooker.book1D("r2x5", "r2x5;r2X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0437   h_phoSigmaIetaIeta_[0] = iBooker.book1D(
0438       "phoSigmaIetaIeta", "#sigma_{i#etai#eta};#sigma_{i#etai#eta}", sigmaIetaBin_, sigmaIetaMin_, sigmaIetaMax_);
0439   //TRACK ISOLATION
0440   h_nTrackIsolSolid_[0] = iBooker.book1D(
0441       "nIsoTracksSolid", "Number Of Tracks in the Solid Iso Cone;# tracks", numberBin_, numberMin_, numberMax_);
0442   h_nTrackIsolHollow_[0] = iBooker.book1D(
0443       "nIsoTracksHollow", "Number Of Tracks in the Hollow Iso Cone;# tracks", numberBin_, numberMin_, numberMax_);
0444   h_trackPtSumSolid_[0] =
0445       iBooker.book1D("isoPtSumSolid", "Track P_{T} Sum in the Solid Iso Cone;P_{T} (GeV)", sumBin_, sumMin_, sumMax_);
0446   h_trackPtSumHollow_[0] =
0447       iBooker.book1D("isoPtSumHollow", "Track P_{T} Sum in the Hollow Iso Cone;P_{T} (GeV)", sumBin_, sumMin_, sumMax_);
0448   //CALORIMETER ISOLATION VARIABLES
0449   h_ecalSum_[0] = iBooker.book1D("ecalSum", "Ecal Sum in the Iso Cone;E (GeV)", sumBin_, sumMin_, sumMax_);
0450   h_hcalSum_[0] = iBooker.book1D("hcalSum", "Hcal Sum in the Iso Cone;E (GeV)", sumBin_, sumMin_, sumMax_);
0451   h_hOverE_[0] = iBooker.book1D("hOverE", "H/E;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
0452   h_h1OverE_[0] = iBooker.book1D("h1OverE", "H/E for Depth 1;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
0453   h_h2OverE_[0] = iBooker.book1D("h2OverE", "H/E for Depth 2;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
0454   string histname = "newhOverE";
0455   h_newhOverE_[0] = iBooker.book1D(histname + "All", "new H/E: All Ecal", 100, 0., 0.1);
0456   //  Information from Particle Flow
0457   histname = "chargedHadIso";
0458   h_chHadIso_[0] = iBooker.book1D(histname + "All", "PF chargedHadIso:  All Ecal", etBin_, etMin_, 20.);
0459   histname = "neutralHadIso";
0460   h_nHadIso_[0] = iBooker.book1D(histname + "All", "PF neutralHadIso:  All Ecal", etBin_, etMin_, 20.);
0461   histname = "photonIso";
0462   h_phoIso_[0] = iBooker.book1D(histname + "All", "PF photonIso:  All Ecal", etBin_, etMin_, 20.);
0463   histname = "nCluOutMustache";
0464   h_nCluOutsideMustache_[0] =
0465       iBooker.book1D(histname + "All", "PF number of clusters outside Mustache:  All Ecal", 50, 0., 50.);
0466   histname = "etOutMustache";
0467   h_etOutsideMustache_[0] = iBooker.book1D(histname + "All", "PF et outside Mustache:  All Ecal", etBin_, etMin_, 20.);
0468   histname = "pfMVA";
0469   h_pfMva_[0] = iBooker.book1D(histname + "All", "PF MVA output:  All Ecal", 50, -1., 2.);
0470   ////////// particle based isolation from value map
0471   histname = "SumPtOverPhoPt_ChHad_Cleaned";
0472   h_SumPtOverPhoPt_ChHad_Cleaned_[0] =
0473       iBooker.book1D(histname + "All", "Pf Cand Sum Pt Over photon pt Charged Hadrons:  All Ecal", etBin_, etMin_, 2.);
0474   histname = "SumPtOverPhoPt_NeuHad_Cleaned";
0475   h_SumPtOverPhoPt_NeuHad_Cleaned_[0] =
0476       iBooker.book1D(histname + "All", "Pf Cand Sum Pt Over photon pt Neutral Hadrons:  All Ecal", etBin_, etMin_, 2.);
0477   histname = "SumPtOverPhoPt_Pho_Cleaned";
0478   h_SumPtOverPhoPt_Pho_Cleaned_[0] =
0479       iBooker.book1D(histname + "All", "Pf Cand Sum Pt Over photon pt Photons Hadrons:  All Ecal", etBin_, etMin_, 2.);
0480   histname = "dRPhoPFcand_ChHad_Cleaned";
0481   h_dRPhoPFcand_ChHad_Cleaned_[0] =
0482       iBooker.book1D(histname + "All", "dR(pho,cand) Charged Hadrons : All Ecal", etBin_, etMin_, 0.7);
0483   histname = "dRPhoPFcand_NeuHad_Cleaned";
0484   h_dRPhoPFcand_NeuHad_Cleaned_[0] =
0485       iBooker.book1D(histname + "All", "dR(pho,cand) Neutral Hadrons : All Ecal", etBin_, etMin_, 0.7);
0486   histname = "dRPhoPFcand_Pho_Cleaned";
0487   h_dRPhoPFcand_Pho_Cleaned_[0] =
0488       iBooker.book1D(histname + "All", "dR(pho,cand) Photons : All Ecal", etBin_, etMin_, 0.7);
0489   //
0490   histname = "SumPtOverPhoPt_ChHad_unCleaned";
0491   h_SumPtOverPhoPt_ChHad_unCleaned_[0] =
0492       iBooker.book1D(histname + "All", "Pf Cand Sum Pt Over photon pt Charged Hadrons :  All Ecal", etBin_, etMin_, 2.);
0493   histname = "SumPtOverPhoPt_NeuHad_unCleaned";
0494   h_SumPtOverPhoPt_NeuHad_unCleaned_[0] =
0495       iBooker.book1D(histname + "All", "Pf Cand Sum Pt Over photon pt Neutral Hadrons :  All Ecal", etBin_, etMin_, 2.);
0496   histname = "SumPtOverPhoPt_Pho_unCleaned";
0497   h_SumPtOverPhoPt_Pho_unCleaned_[0] =
0498       iBooker.book1D(histname + "All", "Pf Cand Sum Pt Over photon pt Photons:  All Ecal", etBin_, etMin_, 2.);
0499   histname = "dRPhoPFcand_ChHad_unCleaned";
0500   h_dRPhoPFcand_ChHad_unCleaned_[0] =
0501       iBooker.book1D(histname + "All", "dR(pho,cand) Charged Hadrons :  All Ecal", etBin_, etMin_, 0.7);
0502   histname = "dRPhoPFcand_NeuHad_unCleaned";
0503   h_dRPhoPFcand_NeuHad_unCleaned_[0] =
0504       iBooker.book1D(histname + "All", "dR(pho,cand) Neutral Hadrons :  All Ecal", etBin_, etMin_, 0.7);
0505   histname = "dRPhoPFcand_Pho_unCleaned";
0506   h_dRPhoPFcand_Pho_unCleaned_[0] =
0507       iBooker.book1D(histname + "All", "dR(pho,cand) Photons:  All Ecal", etBin_, etMin_, 0.7);
0508 
0509   // NUMBER OF PHOTONS
0510   h_nPho_[1] = iBooker.book1D("nPhoBarrel", "Number of Photons per Event;# #gamma", numberBin_, numberMin_, numberMax_);
0511   h_nPho_[2] = iBooker.book1D("nPhoEndcap", "Number of Photons per Event;# #gamma", numberBin_, numberMin_, numberMax_);
0512   //EB ENERGY
0513   h_phoE_[1] = iBooker.book1D("phoEBarrel", "Energy for Barrel;E (GeV)", eBin_, eMin_, eMax_);
0514   h_phoSigmaEoverE_[1] = iBooker.book1D("phoSigmaEoverEBarrel", "Barrel: #sigma_E/E;#sigma_{E}/E", eBin_, eMin_, eMax_);
0515   h_phoEt_[1] = iBooker.book1D("phoEtBarrel", "E_{T};E_{T} (GeV)", etBin_, etMin_, etMax_);
0516   //EE ENERGY
0517   h_phoEt_[2] = iBooker.book1D("phoEtEndcap", "E_{T};E_{T} (GeV)", etBin_, etMin_, etMax_);
0518   h_phoE_[2] = iBooker.book1D("phoEEndcap", "Energy for Endcap;E (GeV)", eBin_, eMin_, eMax_);
0519   h_phoSigmaEoverE_[2] =
0520       iBooker.book1D("phoSigmaEoverEEndcap", "Endcap: #sigma_{E}/E;#sigma_{E}/E", eBin_, eMin_, eMax_);
0521   //EB GEOMETRICAL
0522   h_phoEta_[1] = iBooker.book1D("phoEtaBarrel", "#eta;#eta", etaBin_, etaMin_, etaMax_);
0523   h_phoPhi_[1] = iBooker.book1D("phoPhiBarrel", "#phi;#phi", phiBin_, phiMin_, phiMax_);
0524   h_scEta_[1] = iBooker.book1D("scEtaBarrel", "SuperCluster #eta;#eta", etaBin_, etaMin_, etaMax_);
0525   h_scPhi_[1] = iBooker.book1D("scPhiBarrel", "SuperCluster #phi;#phi", phiBin_, phiMin_, phiMax_);
0526   //EE GEOMETRICAL
0527   h_phoEta_[2] = iBooker.book1D("phoEtaEndcap", "#eta;#eta", etaBin_, etaMin_, etaMax_);
0528   h_phoPhi_[2] = iBooker.book1D("phoPhiEndcap", "#phi;#phi", phiBin_, phiMin_, phiMax_);
0529   h_scEta_[2] = iBooker.book1D("scEtaEndcap", "SuperCluster #eta;#eta", etaBin_, etaMin_, etaMax_);
0530   h_scPhi_[2] = iBooker.book1D("scPhiEndcap", "SuperCluster #phi;#phi", phiBin_, phiMin_, phiMax_);
0531   //SHOWER SHAPES
0532   h_r9_[1] = iBooker.book1D("r9Barrel", "R9;R9", r9Bin_, r9Min_, r9Max_);
0533   h_r9_[2] = iBooker.book1D("r9Endcap", "R9;R9", r9Bin_, r9Min_, r9Max_);
0534   h_e1x5_[1] = iBooker.book1D("e1x5Barrel", "E1x5;E1X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0535   h_e1x5_[2] = iBooker.book1D("e1x5Endcap", "E1x5;E1X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0536   h_e2x5_[1] = iBooker.book1D("e2x5Barrel", "E2x5;E2X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0537   h_e2x5_[2] = iBooker.book1D("e2x5Endcap", "E2x5;E2X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0538   h_r1x5_[1] = iBooker.book1D("r1x5Barrel", "r1x5;r1X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0539   h_r1x5_[2] = iBooker.book1D("r1x5Endcap", "r1x5;r1X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0540   h_r2x5_[1] = iBooker.book1D("r2x5Barrel", "r2x5;r2X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0541   h_r2x5_[2] = iBooker.book1D("r2x5Endcap", "r2x5;r2X5 (GeV)", reducedEtBin_, etMin_, etMax_);
0542   h_phoSigmaIetaIeta_[1] = iBooker.book1D(
0543       "phoSigmaIetaIetaBarrel", "#sigma_{i#etai#eta};#sigma_{i#etai#eta}", sigmaIetaBin_, sigmaIetaMin_, sigmaIetaMax_);
0544   h_phoSigmaIetaIeta_[2] = iBooker.book1D(
0545       "phoSigmaIetaIetaEndcap", "#sigma_{i#etai#eta};#sigma_{i#etai#eta}", sigmaIetaBin_, sigmaIetaMin_, sigmaIetaMax_);
0546   // TRACK ISOLATION
0547   h_nTrackIsolSolid_[1] = iBooker.book1D(
0548       "nIsoTracksSolidBarrel", "Number Of Tracks in the Solid Iso Cone;# tracks", numberBin_, numberMin_, numberMax_);
0549   h_nTrackIsolSolid_[2] = iBooker.book1D(
0550       "nIsoTracksSolidEndcap", "Number Of Tracks in the Solid Iso Cone;# tracks", numberBin_, numberMin_, numberMax_);
0551   h_nTrackIsolHollow_[1] = iBooker.book1D(
0552       "nIsoTracksHollowBarrel", "Number Of Tracks in the Hollow Iso Cone;# tracks", numberBin_, numberMin_, numberMax_);
0553   h_nTrackIsolHollow_[2] = iBooker.book1D(
0554       "nIsoTracksHollowEndcap", "Number Of Tracks in the Hollow Iso Cone;# tracks", numberBin_, numberMin_, numberMax_);
0555   h_trackPtSumSolid_[1] = iBooker.book1D(
0556       "isoPtSumSolidBarrel", "Track P_{T} Sum in the Solid Iso Cone;P_{T} (GeV)", sumBin_, sumMin_, sumMax_);
0557   h_trackPtSumSolid_[2] = iBooker.book1D(
0558       "isoPtSumSolidEndcap", "Track P_{T} Sum in the Solid Iso Cone;P_{T} (GeV)", sumBin_, sumMin_, sumMax_);
0559   h_trackPtSumHollow_[1] = iBooker.book1D(
0560       "isoPtSumHollowBarrel", "Track P_{T} Sum in the Hollow Iso Cone;P_{T} (GeV)", sumBin_, sumMin_, sumMax_);
0561   h_trackPtSumHollow_[2] = iBooker.book1D(
0562       "isoPtSumHollowEndcap", "Track P_{T} Sum in the Hollow Iso Cone;P_{T} (GeV)", sumBin_, sumMin_, sumMax_);
0563   // CALORIMETER ISOLATION VARIABLES
0564   h_ecalSum_[1] = iBooker.book1D("ecalSumBarrel", "Ecal Sum in the Iso Cone;E (GeV)", sumBin_, sumMin_, sumMax_);
0565   h_ecalSum_[2] = iBooker.book1D("ecalSumEndcap", "Ecal Sum in the Iso Cone;E (GeV)", sumBin_, sumMin_, sumMax_);
0566   h_hcalSum_[1] = iBooker.book1D("hcalSumBarrel", "Hcal Sum in the Iso Cone;E (GeV)", sumBin_, sumMin_, sumMax_);
0567   h_hcalSum_[2] = iBooker.book1D("hcalSumEndcap", "Hcal Sum in the Iso Cone;E (GeV)", sumBin_, sumMin_, sumMax_);
0568   //H/E
0569   // EB
0570   h_hOverE_[1] = iBooker.book1D("hOverEBarrel", "H/E;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
0571   h_h1OverE_[1] = iBooker.book1D("h1OverEBarrel", "H/E for Depth 1;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
0572   h_h2OverE_[1] = iBooker.book1D("h2OverEBarrel", "H/E for Depth 2;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
0573   histname = "newhOverE";
0574   h_newhOverE_[1] = iBooker.book1D(histname + "Barrel", "new H/E: Barrel", 100, 0., 0.1);
0575   //EE
0576   h_hOverE_[2] = iBooker.book1D("hOverEEndcap", "H/E;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
0577   h_h1OverE_[2] = iBooker.book1D("h1OverEEndcap", "H/E for Depth 1;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
0578   h_h2OverE_[2] = iBooker.book1D("h2OverEEndcap", "H/E for Depth 2;H/E", hOverEBin_, hOverEMin_, hOverEMax_);
0579   histname = "newhOverE";
0580   h_newhOverE_[2] = iBooker.book1D(histname + "Endcap", "new H/E: Endcap", 100, 0., 0.1);
0581   // Information from Particle Flow
0582   histname = "chargedHadIso";
0583   h_chHadIso_[1] = iBooker.book1D(histname + "Barrel", "PF chargedHadIso:  Barrel", etBin_, etMin_, 20.);
0584   h_chHadIso_[2] = iBooker.book1D(histname + "Endcap", "PF chargedHadIso:  Endcap", etBin_, etMin_, 20.);
0585   histname = "neutralHadIso";
0586   h_nHadIso_[1] = iBooker.book1D(histname + "Barrel", "PF neutralHadIso:  Barrel", etBin_, etMin_, 20.);
0587   h_nHadIso_[2] = iBooker.book1D(histname + "Endcap", "PF neutralHadIso:  Endcap", etBin_, etMin_, 20.);
0588   histname = "photonIso";
0589   h_phoIso_[1] = iBooker.book1D(histname + "Barrel", "PF photonIso:  Barrel", etBin_, etMin_, 20.);
0590   h_phoIso_[2] = iBooker.book1D(histname + "Endcap", "PF photonIso:  Endcap", etBin_, etMin_, 20.);
0591   histname = "nCluOutMustache";
0592   h_nCluOutsideMustache_[1] =
0593       iBooker.book1D(histname + "Barrel", "PF number of clusters outside Mustache:  Barrel", 50, 0., 50.);
0594   h_nCluOutsideMustache_[2] =
0595       iBooker.book1D(histname + "Endcap", "PF number of clusters outside Mustache:  Endcap", 50, 0., 50.);
0596   histname = "etOutMustache";
0597   h_etOutsideMustache_[1] = iBooker.book1D(histname + "Barrel", "PF et outside Mustache:  Barrel", etBin_, etMin_, 20.);
0598   h_etOutsideMustache_[2] = iBooker.book1D(histname + "Endcap", "PF et outside Mustache:  Endcap", etBin_, etMin_, 20.);
0599   histname = "pfMVA";
0600   h_pfMva_[1] = iBooker.book1D(histname + "Barrel", "PF MVA output:  Barrel", 50, -1., 2.);
0601   h_pfMva_[2] = iBooker.book1D(histname + "Endcap", "PF MVA output:  Endcap", 50, -1, 2.);
0602   ////////// particle based isolation from value map
0603   histname = "SumPtOverPhoPt_ChHad_Cleaned";
0604   h_SumPtOverPhoPt_ChHad_Cleaned_[1] =
0605       iBooker.book1D(histname + "Barrel", "PF Cand Sum Pt Over photon pt Charged Hadrons:  Barrel", etBin_, etMin_, 2.);
0606   h_SumPtOverPhoPt_ChHad_Cleaned_[2] =
0607       iBooker.book1D(histname + "Endcap", "PF Cand Sum Pt Over photon pt Charged Hadrons:  Endcap", etBin_, etMin_, 2.);
0608   histname = "SumPtOverPhoPt_NeuHad_Cleaned";
0609   h_SumPtOverPhoPt_NeuHad_Cleaned_[1] =
0610       iBooker.book1D(histname + "Barrel", "PF Cand Sum Pt Over photon pt Neutral Hadrons:  Barrel", etBin_, etMin_, 2.);
0611   h_SumPtOverPhoPt_NeuHad_Cleaned_[2] =
0612       iBooker.book1D(histname + "Endcap", "PF Cand Sum Pt Over photon pt Neutral Hadrons:  Endcap", etBin_, etMin_, 2.);
0613   histname = "SumPtOverPhoPt_Pho_Cleaned";
0614   h_SumPtOverPhoPt_Pho_Cleaned_[1] =
0615       iBooker.book1D(histname + "Barrel", "PF Cand Sum Pt Over photon pt Photons Hadrons:  Barrel", etBin_, etMin_, 2.);
0616   h_SumPtOverPhoPt_Pho_Cleaned_[2] =
0617       iBooker.book1D(histname + "Endcap", "PF Cand Sum Pt Over photon pt Photons Hadrons:  Endcap", etBin_, etMin_, 2.);
0618   histname = "dRPhoPFcand_ChHad_Cleaned";
0619   h_dRPhoPFcand_ChHad_Cleaned_[1] =
0620       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Charged Hadrons :  Barrel", etBin_, etMin_, 0.7);
0621   h_dRPhoPFcand_ChHad_Cleaned_[2] =
0622       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Charged Hadrons :  Endcap", etBin_, etMin_, 0.7);
0623   histname = "dRPhoPFcand_NeuHad_Cleaned";
0624   h_dRPhoPFcand_NeuHad_Cleaned_[1] =
0625       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Neutral Hadrons :  Barrel", etBin_, etMin_, 0.7);
0626   h_dRPhoPFcand_NeuHad_Cleaned_[2] =
0627       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Neutral Hadrons :  Endcap", etBin_, etMin_, 0.7);
0628   histname = "dRPhoPFcand_Pho_Cleaned";
0629   h_dRPhoPFcand_Pho_Cleaned_[1] =
0630       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Photons :  Barrel", etBin_, etMin_, 0.7);
0631   h_dRPhoPFcand_Pho_Cleaned_[2] =
0632       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Photons :  Endcap", etBin_, etMin_, 0.7);
0633   //
0634   histname = "SumPtOverPhoPt_ChHad_unCleaned";
0635   h_SumPtOverPhoPt_ChHad_unCleaned_[1] =
0636       iBooker.book1D(histname + "Barrel", "PF Cand Sum Pt Over photon pt Charged Hadrons:  Barrel", etBin_, etMin_, 2.);
0637   h_SumPtOverPhoPt_ChHad_unCleaned_[2] =
0638       iBooker.book1D(histname + "Endcap", "PF Cand Sum Pt Over photon pt Charged Hadrons:  Endcap", etBin_, etMin_, 2.);
0639   histname = "SumPtOverPhoPt_NeuHad_unCleaned";
0640   h_SumPtOverPhoPt_NeuHad_unCleaned_[1] =
0641       iBooker.book1D(histname + "Barrel", "PF Cand Sum Pt Over photon pt Neutral Hadrons:  Barrel", etBin_, etMin_, 2.);
0642   h_SumPtOverPhoPt_NeuHad_unCleaned_[2] =
0643       iBooker.book1D(histname + "Endcap", "PF Cand Sum Pt Over photon pt Neutral Hadrons:  Endcap", etBin_, etMin_, 2.);
0644   histname = "SumPtOverPhoPt_Pho_unCleaned";
0645   h_SumPtOverPhoPt_Pho_unCleaned_[1] =
0646       iBooker.book1D(histname + "Barrel", "PF Cand Sum Pt Over photon pt Photons:  Barrel", etBin_, etMin_, 2.);
0647   h_SumPtOverPhoPt_Pho_unCleaned_[2] =
0648       iBooker.book1D(histname + "Endcap", "PF Cand Sum Pt Over photon pt Photons:  Endcap", etBin_, etMin_, 2.);
0649   histname = "dRPhoPFcand_ChHad_unCleaned";
0650   h_dRPhoPFcand_ChHad_unCleaned_[1] =
0651       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Charged Hadrons :  Barrel", etBin_, etMin_, 0.7);
0652   h_dRPhoPFcand_ChHad_unCleaned_[2] =
0653       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Charged Hadrons :  Endcap", etBin_, etMin_, 0.7);
0654   histname = "dRPhoPFcand_NeuHad_unCleaned";
0655   h_dRPhoPFcand_NeuHad_unCleaned_[1] =
0656       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Neutral Hadrons :  Barrel", etBin_, etMin_, 0.7);
0657   h_dRPhoPFcand_NeuHad_unCleaned_[2] =
0658       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Neutral Hadrons :  Endcap", etBin_, etMin_, 0.7);
0659   histname = "dRPhoPFcand_Pho_unCleaned";
0660   h_dRPhoPFcand_Pho_unCleaned_[1] =
0661       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Photons:  Barrel", etBin_, etMin_, 0.7);
0662   h_dRPhoPFcand_Pho_unCleaned_[2] =
0663       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Photons:  Endcap", etBin_, etMin_, 0.7);
0664 
0665   //// make profiles vs Eta and vs Et
0666   if (makeProfiles_) {
0667     //     p_r9VsEt_[0]  = iBooker.bookProfile("r9VsEt","Avg R9 vs E_{T};E_{T} (GeV);R9",etBin_,etMin_,etMax_,r9Bin_,r9Min_,r9Max_);
0668     p_r9VsEt_[1] = iBooker.bookProfile(
0669         "r9VsEtBarrel", "Avg R9 vs E_{T};E_{T} (GeV);R9", etBin_, etMin_, etMax_, r9Bin_, r9Min_, r9Max_);
0670     p_r9VsEt_[2] = iBooker.bookProfile(
0671         "r9VsEtEndcap", "Avg R9 vs E_{T};E_{T} (GeV);R9", etBin_, etMin_, etMax_, r9Bin_, r9Min_, r9Max_);
0672     p_r9VsEta_[0] =
0673         iBooker.bookProfile("r9VsEta", "Avg R9 vs #eta;#eta;R9", etaBin_, etaMin_, etaMax_, r9Bin_, r9Min_, r9Max_);
0674     //
0675     p_sigmaIetaIetaVsEta_[0] = iBooker.bookProfile("sigmaIetaIetaVsEta",
0676                                                    "Avg #sigma_{i#etai#eta} vs #eta;#eta;#sigma_{i#etai#eta}",
0677                                                    etaBin_,
0678                                                    etaMin_,
0679                                                    etaMax_,
0680                                                    sigmaIetaBin_,
0681                                                    sigmaIetaMin_,
0682                                                    sigmaIetaMax_);
0683     p_e1x5VsEt_[1] = iBooker.bookProfile(
0684         "e1x5VsEtBarrel", "Avg E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)", etBin_, etMin_, etMax_, etBin_, etMin_, etMax_);
0685     p_e1x5VsEt_[2] = iBooker.bookProfile(
0686         "e1x5VsEtEndcap", "Avg E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)", etBin_, etMin_, etMax_, etBin_, etMin_, etMax_);
0687     p_e1x5VsEta_[0] = iBooker.bookProfile(
0688         "e1x5VsEta", "Avg E1x5 vs #eta;#eta;E1X5 (GeV)", etaBin_, etaMin_, etaMax_, etBin_, etMin_, etMax_);
0689     p_e2x5VsEt_[1] = iBooker.bookProfile(
0690         "e2x5VsEtBarrel", "Avg E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)", etBin_, etMin_, etMax_, etBin_, etMin_, etMax_);
0691     p_e2x5VsEt_[2] = iBooker.bookProfile(
0692         "e2x5VsEtEndcap", "Avg E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)", etBin_, etMin_, etMax_, etBin_, etMin_, etMax_);
0693     p_e2x5VsEta_[0] = iBooker.bookProfile(
0694         "e2x5VsEta", "Avg E2x5 vs #eta;#eta;E2X5 (GeV)", etaBin_, etaMin_, etaMax_, etBin_, etMin_, etMax_);
0695     p_r1x5VsEt_[1] = iBooker.bookProfile(
0696         "r1x5VsEtBarrel", "Avg R1x5 vs E_{T};E_{T} (GeV);R1X5", etBin_, etMin_, etMax_, r9Bin_, r9Min_, r9Max_);
0697     p_r1x5VsEt_[2] = iBooker.bookProfile(
0698         "r1x5VsEtEndcap", "Avg R1x5 vs E_{T};E_{T} (GeV);R1X5", etBin_, etMin_, etMax_, r9Bin_, r9Min_, r9Max_);
0699     p_r1x5VsEta_[0] = iBooker.bookProfile(
0700         "r1x5VsEta", "Avg R1x5 vs #eta;#eta;R1X5", etaBin_, etaMin_, etaMax_, r9Bin_, r9Min_, r9Max_);
0701     p_r2x5VsEt_[1] = iBooker.bookProfile(
0702         "r2x5VsEtBarrel", "Avg R2x5 vs E_{T};E_{T} (GeV);R2X5", etBin_, etMin_, etMax_, r9Bin_, r9Min_, r9Max_);
0703     p_r2x5VsEt_[2] = iBooker.bookProfile(
0704         "r2x5VsEtEndcap", "Avg R2x5 vs E_{T};E_{T} (GeV);R2X5", etBin_, etMin_, etMax_, r9Bin_, r9Min_, r9Max_);
0705     p_r2x5VsEta_[0] = iBooker.bookProfile(
0706         "r2x5VsEta", "Avg R2x5 vs #eta;#eta;R2X5", etaBin_, etaMin_, etaMax_, r9Bin_, r9Min_, r9Max_);
0707     p_nTrackIsolSolidVsEt_[1] =
0708         iBooker.bookProfile("nIsoTracksSolidVsEtBarrel",
0709                             "Avg Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",
0710                             etBin_,
0711                             etMin_,
0712                             etMax_,
0713                             numberBin_,
0714                             numberMin_,
0715                             numberMax_);
0716     p_nTrackIsolSolidVsEt_[2] =
0717         iBooker.bookProfile("nIsoTracksSolidVsEtEndcap",
0718                             "Avg Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",
0719                             etBin_,
0720                             etMin_,
0721                             etMax_,
0722                             numberBin_,
0723                             numberMin_,
0724                             numberMax_);
0725     p_nTrackIsolSolidVsEta_[0] = iBooker.bookProfile("nIsoTracksSolidVsEta",
0726                                                      "Avg Number Of Tracks in the Solid Iso Cone vs #eta;#eta;# tracks",
0727                                                      etaBin_,
0728                                                      etaMin_,
0729                                                      etaMax_,
0730                                                      numberBin_,
0731                                                      numberMin_,
0732                                                      numberMax_);
0733     p_nTrackIsolHollowVsEt_[1] =
0734         iBooker.bookProfile("nIsoTracksHollowVsEtBarrel",
0735                             "Avg Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",
0736                             etBin_,
0737                             etMin_,
0738                             etMax_,
0739                             numberBin_,
0740                             numberMin_,
0741                             numberMax_);
0742     p_nTrackIsolHollowVsEt_[2] =
0743         iBooker.bookProfile("nIsoTracksHollowVsEtEndcap",
0744                             "Avg Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",
0745                             etBin_,
0746                             etMin_,
0747                             etMax_,
0748                             numberBin_,
0749                             numberMin_,
0750                             numberMax_);
0751     p_nTrackIsolHollowVsEta_[0] =
0752         iBooker.bookProfile("nIsoTracksHollowVsEta",
0753                             "Avg Number Of Tracks in the Hollow Iso Cone vs #eta;#eta;# tracks",
0754                             etaBin_,
0755                             etaMin_,
0756                             etaMax_,
0757                             numberBin_,
0758                             numberMin_,
0759                             numberMax_);
0760     p_trackPtSumSolidVsEt_[1] =
0761         iBooker.bookProfile("isoPtSumSolidVsEtBarrel",
0762                             "Avg Track P_{T} Sum in the Solid Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",
0763                             etBin_,
0764                             etMin_,
0765                             etMax_,
0766                             sumBin_,
0767                             sumMin_,
0768                             sumMax_);
0769     p_trackPtSumSolidVsEt_[2] =
0770         iBooker.bookProfile("isoPtSumSolidVsEtEndcap",
0771                             "Avg Track P_{T} Sum in the Solid Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",
0772                             etBin_,
0773                             etMin_,
0774                             etMax_,
0775                             sumBin_,
0776                             sumMin_,
0777                             sumMax_);
0778     p_trackPtSumSolidVsEta_[0] =
0779         iBooker.bookProfile("isoPtSumSolidVsEta",
0780                             "Avg Track P_{T} Sum in the Solid Iso Cone vs #eta;#eta;P_{T} (GeV)",
0781                             etaBin_,
0782                             etaMin_,
0783                             etaMax_,
0784                             sumBin_,
0785                             sumMin_,
0786                             sumMax_);
0787     p_trackPtSumHollowVsEt_[1] =
0788         iBooker.bookProfile("isoPtSumHollowVsEtBarrel",
0789                             "Avg Track P_{T} Sum in the Hollow Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",
0790                             etBin_,
0791                             etMin_,
0792                             etMax_,
0793                             sumBin_,
0794                             sumMin_,
0795                             sumMax_);
0796     p_trackPtSumHollowVsEt_[2] =
0797         iBooker.bookProfile("isoPtSumHollowVsEtEndcap",
0798                             "Avg Track P_{T} Sum in the Hollow Iso Cone vs E_{T};E_{T} (GeV);P_{T} (GeV)",
0799                             etBin_,
0800                             etMin_,
0801                             etMax_,
0802                             sumBin_,
0803                             sumMin_,
0804                             sumMax_);
0805     p_trackPtSumHollowVsEta_[0] =
0806         iBooker.bookProfile("isoPtSumHollowVsEta",
0807                             "Avg Track P_{T} Sum in the Hollow Iso Cone vs #eta;#eta;P_{T} (GeV)",
0808                             etaBin_,
0809                             etaMin_,
0810                             etaMax_,
0811                             sumBin_,
0812                             sumMin_,
0813                             sumMax_);
0814     p_ecalSumVsEt_[1] = iBooker.bookProfile("ecalSumVsEtBarrel",
0815                                             "Avg Ecal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",
0816                                             etBin_,
0817                                             etMin_,
0818                                             etMax_,
0819                                             sumBin_,
0820                                             sumMin_,
0821                                             sumMax_);
0822     p_ecalSumVsEt_[2] = iBooker.bookProfile("ecalSumVsEtEndcap",
0823                                             "Avg Ecal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",
0824                                             etBin_,
0825                                             etMin_,
0826                                             etMax_,
0827                                             sumBin_,
0828                                             sumMin_,
0829                                             sumMax_);
0830     p_ecalSumVsEta_[0] = iBooker.bookProfile("ecalSumVsEta",
0831                                              "Avg Ecal Sum in the Iso Cone vs #eta;#eta;E (GeV)",
0832                                              etaBin_,
0833                                              etaMin_,
0834                                              etaMax_,
0835                                              sumBin_,
0836                                              sumMin_,
0837                                              sumMax_);
0838     p_hcalSumVsEt_[1] = iBooker.bookProfile("hcalSumVsEtBarrel",
0839                                             "Avg Hcal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",
0840                                             etBin_,
0841                                             etMin_,
0842                                             etMax_,
0843                                             sumBin_,
0844                                             sumMin_,
0845                                             sumMax_);
0846     p_hcalSumVsEt_[2] = iBooker.bookProfile("hcalSumVsEtEndcap",
0847                                             "Avg Hcal Sum in the Iso Cone vs E_{T};E_{T} (GeV);E (GeV)",
0848                                             etBin_,
0849                                             etMin_,
0850                                             etMax_,
0851                                             sumBin_,
0852                                             sumMin_,
0853                                             sumMax_);
0854     p_hcalSumVsEta_[0] = iBooker.bookProfile("hcalSumVsEta",
0855                                              "Avg Hcal Sum in the Iso Cone vs #eta;#eta;E (GeV)",
0856                                              etaBin_,
0857                                              etaMin_,
0858                                              etaMax_,
0859                                              sumBin_,
0860                                              sumMin_,
0861                                              sumMax_);
0862     p_hOverEVsEt_[1] = iBooker.bookProfile("p_hOverEVsEtBarrel",
0863                                            "Avg H/E vs Et;E_{T} (GeV);H/E",
0864                                            etBin_,
0865                                            etMin_,
0866                                            etMax_,
0867                                            hOverEBin_,
0868                                            hOverEMin_,
0869                                            hOverEMax_);
0870     p_hOverEVsEt_[2] = iBooker.bookProfile("p_hOverEVsEtEndcap",
0871                                            "Avg H/E vs Et;E_{T} (GeV);H/E",
0872                                            etBin_,
0873                                            etMin_,
0874                                            etMax_,
0875                                            hOverEBin_,
0876                                            hOverEMin_,
0877                                            hOverEMax_);
0878     p_hOverEVsEta_[0] = iBooker.bookProfile(
0879         "p_hOverEVsEta", "Avg H/E vs #eta;#eta;H/E", etaBin_, etaMin_, etaMax_, hOverEBin_, hOverEMin_, hOverEMax_);
0880 
0881     // sigmaE/E
0882     histname = "sigmaEoverEVsNVtx";
0883     p_phoSigmaEoverEVsNVtx_[1] = iBooker.bookProfile(histname + "Barrel",
0884                                                      "Photons #sigma_{E}/E vs N_{vtx}: Barrel; N_{vtx}; #sigma_{E}/E ",
0885                                                      200,
0886                                                      -0.5,
0887                                                      199.5,
0888                                                      100,
0889                                                      0.,
0890                                                      0.08,
0891                                                      "");
0892     p_phoSigmaEoverEVsNVtx_[2] = iBooker.bookProfile(histname + "Endcap",
0893                                                      "Photons #sigma_{E}/E vs N_{vtx}: Endcap;  N_{vtx}; #sigma_{E}/E",
0894                                                      200,
0895                                                      -0.5,
0896                                                      199.5,
0897                                                      100,
0898                                                      0.,
0899                                                      0.08,
0900                                                      "");
0901   }
0902 
0903   ///// 2D histograms /////
0904   if (use2DHistos_) {
0905     //SHOWER SHAPE
0906     //r9
0907     h2_r9VsEt_[0] = iBooker.book2D(
0908         "r9VsEt2D", "R9 vs E_{T};E_{T} (GeV);R9", reducedEtBin_, etMin_, etMax_, reducedR9Bin_, r9Min_, r9Max_);
0909     h2_r9VsEt_[1] = iBooker.book2D(
0910         "r9VsEt2DBarrel", "R9 vs E_{T};E_{T} (GeV);R9", reducedEtBin_, etMin_, etMax_, reducedR9Bin_, r9Min_, r9Max_);
0911     h2_r9VsEt_[2] = iBooker.book2D(
0912         "r9VsEt2DEndcap", "R9 vs E_{T};E_{T} (GeV);R9", reducedEtBin_, etMin_, etMax_, reducedR9Bin_, r9Min_, r9Max_);
0913     h2_r9VsEta_[0] = iBooker.book2D(
0914         "r9VsEta2D", "R9 vs #eta;#eta;R9", reducedEtaBin_, etaMin_, etaMax_, reducedR9Bin_, r9Min_, r9Max_);
0915     //sigmaIetaIeta
0916     h2_sigmaIetaIetaVsEta_[0] = iBooker.book2D("sigmaIetaIetaVsEta2D",
0917                                                "#sigma_{i#etai#eta} vs #eta;#eta;#sigma_{i#etai#eta}",
0918                                                reducedEtaBin_,
0919                                                etaMin_,
0920                                                etaMax_,
0921                                                sigmaIetaBin_,
0922                                                sigmaIetaMin_,
0923                                                sigmaIetaMax_);
0924     //e1x5
0925     h2_e1x5VsEt_[0] = iBooker.book2D("e1x5VsEt2D",
0926                                      "E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",
0927                                      reducedEtBin_,
0928                                      etMin_,
0929                                      etMax_,
0930                                      reducedEtBin_,
0931                                      etMin_,
0932                                      etMax_);
0933     h2_e1x5VsEt_[1] = iBooker.book2D("e1x5VsEt2DBarrel",
0934                                      "E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",
0935                                      reducedEtBin_,
0936                                      etMin_,
0937                                      etMax_,
0938                                      reducedEtBin_,
0939                                      etMin_,
0940                                      etMax_);
0941     h2_e1x5VsEt_[2] = iBooker.book2D("e1x5VsEt2DEndcap",
0942                                      "E1x5 vs E_{T};E_{T} (GeV);E1X5 (GeV)",
0943                                      reducedEtBin_,
0944                                      etMin_,
0945                                      etMax_,
0946                                      reducedEtBin_,
0947                                      etMin_,
0948                                      etMax_);
0949     h2_e1x5VsEta_[0] = iBooker.book2D(
0950         "e1x5VsEta2D", "E1x5 vs #eta;#eta;E1X5 (GeV)", reducedEtaBin_, etaMin_, etaMax_, reducedEtBin_, etMin_, etMax_);
0951     //e2x5
0952     h2_e2x5VsEt_[0] = iBooker.book2D("e2x5VsEt2D",
0953                                      "E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",
0954                                      reducedEtBin_,
0955                                      etMin_,
0956                                      etMax_,
0957                                      reducedEtBin_,
0958                                      etMin_,
0959                                      etMax_);
0960     h2_e2x5VsEt_[1] = iBooker.book2D("e2x5VsEt2DBarrel",
0961                                      "E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",
0962                                      reducedEtBin_,
0963                                      etMin_,
0964                                      etMax_,
0965                                      reducedEtBin_,
0966                                      etMin_,
0967                                      etMax_);
0968     h2_e2x5VsEt_[2] = iBooker.book2D("e2x5VsEt2DEndcap",
0969                                      "E2x5 vs E_{T};E_{T} (GeV);E2X5 (GeV)",
0970                                      reducedEtBin_,
0971                                      etMin_,
0972                                      etMax_,
0973                                      reducedEtBin_,
0974                                      etMin_,
0975                                      etMax_);
0976     h2_e2x5VsEta_[0] = iBooker.book2D(
0977         "e2x5VsEta2D", "E2x5 vs #eta;#eta;E2X5 (GeV)", reducedEtaBin_, etaMin_, etaMax_, reducedEtBin_, etMin_, etMax_);
0978     //r1x5
0979     h2_r1x5VsEt_[0] = iBooker.book2D(
0980         "r1x5VsEt2D", "R1x5 vs E_{T};E_{T} (GeV);R1X5", reducedEtBin_, etMin_, etMax_, reducedR9Bin_, r9Min_, r9Max_);
0981     h2_r1x5VsEt_[1] = iBooker.book2D("r1x5VsEt2DBarrel",
0982                                      "R1x5 vs E_{T};E_{T} (GeV);R1X5",
0983                                      reducedEtBin_,
0984                                      etMin_,
0985                                      etMax_,
0986                                      reducedR9Bin_,
0987                                      r9Min_,
0988                                      r9Max_);
0989     h2_r1x5VsEt_[2] = iBooker.book2D("r1x5VsEt2DEndcap",
0990                                      "R1x5 vs E_{T};E_{T} (GeV);R1X5",
0991                                      reducedEtBin_,
0992                                      etMin_,
0993                                      etMax_,
0994                                      reducedR9Bin_,
0995                                      r9Min_,
0996                                      r9Max_);
0997     h2_r1x5VsEta_[0] = iBooker.book2D(
0998         "r1x5VsEta2D", "R1x5 vs #eta;#eta;R1X5", reducedEtaBin_, etaMin_, etaMax_, reducedR9Bin_, r9Min_, r9Max_);
0999     //r2x5
1000     h2_r2x5VsEt_[0] = iBooker.book2D(
1001         "r2x5VsEt2D", "R2x5 vs E_{T};E_{T} (GeV);R2X5", reducedEtBin_, etMin_, etMax_, reducedR9Bin_, r9Min_, r9Max_);
1002     h2_r2x5VsEt_[1] = iBooker.book2D("r2x5VsEt2DBarrel",
1003                                      "R2x5 vs E_{T};E_{T} (GeV);R2X5",
1004                                      reducedEtBin_,
1005                                      etMin_,
1006                                      etMax_,
1007                                      reducedR9Bin_,
1008                                      r9Min_,
1009                                      r9Max_);
1010     h2_r2x5VsEt_[2] = iBooker.book2D("r2x5VsEt2DEndcap",
1011                                      "R2x5 vs E_{T};E_{T} (GeV);R2X5",
1012                                      reducedEtBin_,
1013                                      etMin_,
1014                                      etMax_,
1015                                      reducedR9Bin_,
1016                                      r9Min_,
1017                                      r9Max_);
1018     h2_r2x5VsEta_[0] = iBooker.book2D(
1019         "r2x5VsEta2D", "R2x5 vs #eta;#eta;R2X5", reducedEtaBin_, etaMin_, etaMax_, reducedR9Bin_, r9Min_, r9Max_);
1020     //TRACK ISOLATION
1021     //nTrackIsolSolid
1022     h2_nTrackIsolSolidVsEt_[0] = iBooker.book2D("nIsoTracksSolidVsEt2D",
1023                                                 "Number Of Tracks in the Solid Iso Cone vs E_{T};E_{T};# tracks",
1024                                                 reducedEtBin_,
1025                                                 etMin_,
1026                                                 etMax_,
1027                                                 numberBin_,
1028                                                 numberMin_,
1029                                                 numberMax_);
1030     h2_nTrackIsolSolidVsEta_[0] = iBooker.book2D("nIsoTracksSolidVsEta2D",
1031                                                  "Number Of Tracks in the Solid Iso Cone vs #eta;#eta;# tracks",
1032                                                  reducedEtaBin_,
1033                                                  etaMin_,
1034                                                  etaMax_,
1035                                                  numberBin_,
1036                                                  numberMin_,
1037                                                  numberMax_);
1038     //nTrackIsolHollow
1039     h2_nTrackIsolHollowVsEt_[0] = iBooker.book2D("nIsoTracksHollowVsEt2D",
1040                                                  "Number Of Tracks in the Hollow Iso Cone vs E_{T};E_{T};# tracks",
1041                                                  reducedEtBin_,
1042                                                  etMin_,
1043                                                  etMax_,
1044                                                  numberBin_,
1045                                                  numberMin_,
1046                                                  numberMax_);
1047     h2_nTrackIsolHollowVsEta_[0] = iBooker.book2D("nIsoTracksHollowVsEta2D",
1048                                                   "Number Of Tracks in the Hollow Iso Cone vs #eta;#eta;# tracks",
1049                                                   reducedEtaBin_,
1050                                                   etaMin_,
1051                                                   etaMax_,
1052                                                   numberBin_,
1053                                                   numberMin_,
1054                                                   numberMax_);
1055     //trackPtSumSolid
1056     h2_trackPtSumSolidVsEt_[0] = iBooker.book2D("isoPtSumSolidVsEt2D",
1057                                                 "Track P_{T} Sum in the Solid Iso Cone;E_{T} (GeV);P_{T} (GeV)",
1058                                                 reducedEtBin_,
1059                                                 etMin_,
1060                                                 etMax_,
1061                                                 reducedSumBin_,
1062                                                 sumMin_,
1063                                                 sumMax_);
1064     h2_trackPtSumSolidVsEta_[0] = iBooker.book2D("isoPtSumSolidVsEta2D",
1065                                                  "Track P_{T} Sum in the Solid Iso Cone;#eta;P_{T} (GeV)",
1066                                                  reducedEtaBin_,
1067                                                  etaMin_,
1068                                                  etaMax_,
1069                                                  reducedSumBin_,
1070                                                  sumMin_,
1071                                                  sumMax_);
1072     //trackPtSumHollow
1073     h2_trackPtSumHollowVsEt_[0] = iBooker.book2D("isoPtSumHollowVsEt2D",
1074                                                  "Track P_{T} Sum in the Hollow Iso Cone;E_{T} (GeV);P_{T} (GeV)",
1075                                                  reducedEtBin_,
1076                                                  etMin_,
1077                                                  etMax_,
1078                                                  reducedSumBin_,
1079                                                  sumMin_,
1080                                                  sumMax_);
1081     h2_trackPtSumHollowVsEta_[0] = iBooker.book2D("isoPtSumHollowVsEta2D",
1082                                                   "Track P_{T} Sum in the Hollow Iso Cone;#eta;P_{T} (GeV)",
1083                                                   reducedEtaBin_,
1084                                                   etaMin_,
1085                                                   etaMax_,
1086                                                   reducedSumBin_,
1087                                                   sumMin_,
1088                                                   sumMax_);
1089     //CALORIMETER ISOLATION VARIABLES
1090     //ecal sum
1091     h2_ecalSumVsEt_[0] = iBooker.book2D("ecalSumVsEt2D",
1092                                         "Ecal Sum in the Iso Cone;E_{T} (GeV);E (GeV)",
1093                                         reducedEtBin_,
1094                                         etMin_,
1095                                         etMax_,
1096                                         reducedSumBin_,
1097                                         sumMin_,
1098                                         sumMax_);
1099     h2_ecalSumVsEta_[0] = iBooker.book2D("ecalSumVsEta2D",
1100                                          "Ecal Sum in the Iso Cone;#eta;E (GeV)",
1101                                          reducedEtaBin_,
1102                                          etaMin_,
1103                                          etaMax_,
1104                                          reducedSumBin_,
1105                                          sumMin_,
1106                                          sumMax_);
1107     //hcal sum
1108     h2_hcalSumVsEt_[0] = iBooker.book2D("hcalSumVsEt2D",
1109                                         "Hcal Sum in the Iso Cone;E_{T} (GeV);E (GeV)",
1110                                         reducedEtBin_,
1111                                         etMin_,
1112                                         etMax_,
1113                                         reducedSumBin_,
1114                                         sumMin_,
1115                                         sumMax_);
1116     h2_hcalSumVsEta_[0] = iBooker.book2D("hcalSumVsEta2D",
1117                                          "Hcal Sum in the Iso Cone;#eta;E (GeV)",
1118                                          reducedEtaBin_,
1119                                          etaMin_,
1120                                          etaMax_,
1121                                          reducedSumBin_,
1122                                          sumMin_,
1123                                          sumMax_);
1124   }
1125 }
1126 
1127 void ZToMuMuGammaAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& esup) {
1128   using namespace edm;
1129 
1130   if (nEvt_ % prescaleFactor_)
1131     return;
1132   nEvt_++;
1133   LogInfo("ZToMuMuGammaAnalyzer") << "ZToMuMuGammaAnalyzer Analyzing event number: " << e.id() << " Global Counter "
1134                                   << nEvt_ << "\n";
1135 
1136   // Get the trigger results
1137   bool validTriggerEvent = true;
1138   edm::Handle<trigger::TriggerEvent> triggerEventHandle;
1139   trigger::TriggerEvent triggerEvent;
1140   e.getByToken(triggerEvent_token_, triggerEventHandle);
1141   if (!triggerEventHandle.isValid()) {
1142     edm::LogInfo("PhotonAnalyzer") << "Error! Can't get the product: triggerEvent_token_" << endl;
1143     validTriggerEvent = false;
1144   }
1145   if (validTriggerEvent)
1146     triggerEvent = *(triggerEventHandle.product());
1147 
1148   // Get the reconstructed photons
1149   //  bool validPhotons=true;
1150   Handle<reco::PhotonCollection> photonHandle;
1151   reco::PhotonCollection photonCollection;
1152   e.getByToken(photon_token_, photonHandle);
1153   if (!photonHandle.isValid()) {
1154     edm::LogInfo("ZToMuMuGammaAnalyzer") << "Error! Can't get the product: photon_token_" << endl;
1155     //validPhotons=false;
1156   }
1157   //  if(validPhotons) photonCollection = *(photonHandle.product());
1158 
1159   // Get the  PF refined cluster  collection
1160   Handle<reco::PFCandidateCollection> pfCandidateHandle;
1161   e.getByToken(pfCandidates_, pfCandidateHandle);
1162   if (!pfCandidateHandle.isValid()) {
1163     edm::LogError("PhotonValidator") << "Error! Can't get the product pfCandidates " << std::endl;
1164   }
1165 
1166   edm::Handle<edm::ValueMap<std::vector<reco::PFCandidateRef> > > phoToParticleBasedIsoMapHandle;
1167   edm::ValueMap<std::vector<reco::PFCandidateRef> > phoToParticleBasedIsoMap;
1168   if (fName_ == "zmumugammaGedValidation") {
1169     e.getByToken(photonIsoValmap_token_, phoToParticleBasedIsoMapHandle);
1170     //   e.getByLabel("particleBasedIsolation",valueMapPhoPFCandIso_,phoToParticleBasedIsoMapHandle);
1171     if (!phoToParticleBasedIsoMapHandle.isValid()) {
1172       edm::LogInfo("PhotonValidator") << "Error! Can't get the product: valueMap photons to particle based iso "
1173                                       << std::endl;
1174     }
1175     phoToParticleBasedIsoMap = *(phoToParticleBasedIsoMapHandle.product());
1176   }
1177 
1178   // Get the reconstructed muons
1179   bool validMuons = true;
1180   Handle<reco::MuonCollection> muonHandle;
1181   reco::MuonCollection muonCollection;
1182   e.getByToken(muon_token_, muonHandle);
1183   if (!muonHandle.isValid()) {
1184     edm::LogInfo("ZToMuMuGammaAnalyzer") << "Error! Can't get the product: muon_token_" << endl;
1185     validMuons = false;
1186   }
1187   if (validMuons)
1188     muonCollection = *(muonHandle.product());
1189 
1190   // Get the beam spot
1191   edm::Handle<reco::BeamSpot> bsHandle;
1192   e.getByToken(beamSpot_token_, bsHandle);
1193   if (!bsHandle.isValid()) {
1194     edm::LogError("TrackerOnlyConversionProducer") << "Error! Can't get the product primary Vertex Collection "
1195                                                    << "\n";
1196     return;
1197   }
1198   const reco::BeamSpot& thebs = *bsHandle.product();
1199 
1200   //Prepare list of photon-related HLT filter names
1201   vector<int> Keys;
1202   for (uint filterIndex = 0; filterIndex < triggerEvent.sizeFilters();
1203        ++filterIndex) {  //loop over all trigger filters in event (i.e. filters passed)
1204     string label = triggerEvent.filterTag(filterIndex).label();
1205     if (label.find("Photon") != string::npos) {  //get photon-related filters
1206       for (uint filterKeyIndex = 0; filterKeyIndex < triggerEvent.filterKeys(filterIndex).size();
1207            ++filterKeyIndex) {  //loop over keys to objects passing this filter
1208         Keys.push_back(
1209             triggerEvent.filterKeys(filterIndex)[filterKeyIndex]);  //add keys to a vector for later reference
1210       }
1211     }
1212   }
1213 
1214   // sort Keys vector in ascending order
1215   // and erases duplicate entries from the vector
1216   sort(Keys.begin(), Keys.end());
1217   for (uint i = 0; i < Keys.size();) {
1218     if (i != (Keys.size() - 1)) {
1219       if (Keys[i] == Keys[i + 1]) {
1220         Keys.erase(Keys.begin() + i + 1);
1221       } else {
1222         ++i;
1223       }
1224     } else {
1225       ++i;
1226     }
1227   }
1228 
1229   edm::Handle<reco::VertexCollection> vtxH;
1230   e.getByToken(offline_pvToken_, vtxH);
1231   h_nRecoVtx_->Fill(float(vtxH->size()));
1232 
1233   //photon counters
1234   int nPho = 0;
1235   int nPhoBarrel = 0;
1236   int nPhoEndcap = 0;
1237 
1238   ////////////// event selection
1239   if (muonCollection.size() < 2)
1240     return;
1241 
1242   for (reco::MuonCollection::const_iterator iMu = muonCollection.begin(); iMu != muonCollection.end(); iMu++) {
1243     if (!basicMuonSelection(*iMu))
1244       continue;
1245 
1246     for (reco::MuonCollection::const_iterator iMu2 = iMu + 1; iMu2 != muonCollection.end(); iMu2++) {
1247       if (!basicMuonSelection(*iMu2))
1248         continue;
1249       if (iMu->charge() * iMu2->charge() > 0)
1250         continue;
1251 
1252       if (!muonSelection(*iMu, thebs) && !muonSelection(*iMu2, thebs))
1253         continue;
1254 
1255       float mumuMass = mumuInvMass(*iMu, *iMu2);
1256       if (mumuMass < minMumuInvMass_ || mumuMass > maxMumuInvMass_)
1257         continue;
1258 
1259       h1_mumuInvMass_[0]->Fill(mumuMass);
1260 
1261       if (photonHandle->empty())
1262         continue;
1263 
1264       reco::Muon nearMuon;
1265       reco::Muon farMuon;
1266       for (unsigned int iPho = 0; iPho < photonHandle->size(); iPho++) {
1267         reco::PhotonRef aPho(reco::PhotonRef(photonHandle, iPho));
1268         //
1269         double dr1 = deltaR2((*iMu).eta(), aPho->eta(), (*iMu).phi(), aPho->phi());
1270         double dr2 = deltaR2((*iMu2).eta(), aPho->eta(), (*iMu2).phi(), aPho->phi());
1271         double drNear;
1272         if (dr1 < dr2) {
1273           nearMuon = *iMu;
1274           farMuon = *iMu2;
1275           drNear = dr1;
1276         } else {
1277           nearMuon = *iMu2;
1278           farMuon = *iMu;
1279           drNear = dr2;
1280         }
1281         //
1282         if (nearMuon.isolationR03().hadEt > nearMuonHcalIso_)
1283           continue;
1284         if (farMuon.isolationR03().sumPt > farMuonTrackIso_)
1285           continue;
1286         if (farMuon.isolationR03().emEt > farMuonEcalIso_)
1287           continue;
1288         if (farMuon.pt() < farMuonMinPt_)
1289           continue;
1290         if (drNear > nearMuonDr2_)
1291           continue;
1292         //
1293         if (!photonSelection(aPho))
1294           continue;
1295         float mumuGammaMass = mumuGammaInvMass(*iMu, *iMu2, aPho);
1296         if (mumuGammaMass < minMumuGammaInvMass_ || mumuGammaMass > maxMumuGammaInvMass_)
1297           continue;
1298         //
1299         //counter: number of photons
1300         int iDet = 0;
1301         if (aPho->isEB() || aPho->isEE()) {
1302           nPho++;
1303         }
1304         if (aPho->isEB()) {
1305           iDet = 1;
1306           nPhoBarrel++;
1307         }
1308         if (aPho->isEE()) {
1309           iDet = 2;
1310           nPhoEndcap++;
1311         }
1312 
1313         //PHOTON RELATED HISTOGRAMS
1314         h1_mumuGammaInvMass_[0]->Fill(mumuGammaMass);
1315         h1_mumuGammaInvMass_[iDet]->Fill(mumuGammaMass);
1316         //ENERGY
1317         h_phoE_[0]->Fill(aPho->energy());
1318         h_phoSigmaEoverE_[0]->Fill(aPho->getCorrectedEnergyError(aPho->getCandidateP4type()) / aPho->energy());
1319         h_phoEt_[0]->Fill(aPho->et());
1320         h_phoE_[iDet]->Fill(aPho->energy());
1321         h_phoSigmaEoverE_[iDet]->Fill(aPho->getCorrectedEnergyError(aPho->getCandidateP4type()) / aPho->energy());
1322         p_phoSigmaEoverEVsNVtx_[iDet]->Fill(float(vtxH->size()),
1323                                             aPho->getCorrectedEnergyError(aPho->getCandidateP4type()) / aPho->energy());
1324         h_phoEt_[iDet]->Fill(aPho->et());
1325         //GEOMETRICAL
1326         h_phoEta_[0]->Fill(aPho->eta());
1327         h_phoPhi_[0]->Fill(aPho->phi());
1328         h_scEta_[0]->Fill(aPho->superCluster()->eta());
1329         h_scPhi_[0]->Fill(aPho->superCluster()->phi());
1330         h_phoEta_[iDet]->Fill(aPho->eta());
1331         h_phoPhi_[iDet]->Fill(aPho->phi());
1332         h_scEta_[iDet]->Fill(aPho->superCluster()->eta());
1333         h_scPhi_[iDet]->Fill(aPho->superCluster()->phi());
1334         //SHOWER SHAPE
1335         h_r9_[0]->Fill(aPho->r9());
1336         h_e1x5_[0]->Fill(aPho->e1x5());
1337         h_e2x5_[0]->Fill(aPho->e2x5());
1338         h_r1x5_[0]->Fill(aPho->r1x5());
1339         h_r2x5_[0]->Fill(aPho->r2x5());
1340         h_phoSigmaIetaIeta_[0]->Fill(aPho->sigmaIetaIeta());
1341         //
1342         h_r9_[iDet]->Fill(aPho->r9());
1343         h_e1x5_[iDet]->Fill(aPho->e1x5());
1344         h_e2x5_[iDet]->Fill(aPho->e2x5());
1345         h_r1x5_[iDet]->Fill(aPho->r1x5());
1346         h_r2x5_[iDet]->Fill(aPho->r2x5());
1347         h_phoSigmaIetaIeta_[iDet]->Fill(aPho->sigmaIetaIeta());
1348         //TRACK ISOLATION
1349         h_nTrackIsolSolid_[0]->Fill(aPho->nTrkSolidConeDR04());
1350         h_nTrackIsolHollow_[0]->Fill(aPho->nTrkHollowConeDR04());
1351         h_trackPtSumSolid_[0]->Fill(aPho->trkSumPtSolidConeDR04());
1352         h_trackPtSumHollow_[0]->Fill(aPho->trkSumPtSolidConeDR04());
1353         h_nTrackIsolSolid_[iDet]->Fill(aPho->nTrkSolidConeDR04());
1354         h_nTrackIsolHollow_[iDet]->Fill(aPho->nTrkHollowConeDR04());
1355         h_trackPtSumSolid_[iDet]->Fill(aPho->trkSumPtSolidConeDR04());
1356         h_trackPtSumHollow_[iDet]->Fill(aPho->trkSumPtSolidConeDR04());
1357         //CALORIMETER ISOLATION
1358         h_ecalSum_[0]->Fill(aPho->ecalRecHitSumEtConeDR04());
1359         h_hcalSum_[0]->Fill(aPho->hcalTowerSumEtConeDR04());
1360         h_hOverE_[0]->Fill(aPho->hadTowOverEm());
1361         h_h1OverE_[0]->Fill(aPho->hadTowOverEm(1));
1362         h_h2OverE_[0]->Fill(aPho->hadTowOverEm(2));
1363         h_newhOverE_[0]->Fill(aPho->hadTowOverEm());
1364         h_ecalSum_[iDet]->Fill(aPho->ecalRecHitSumEtConeDR04());
1365         h_hcalSum_[iDet]->Fill(aPho->hcalTowerSumEtConeDR04());
1366         h_hOverE_[iDet]->Fill(aPho->hadTowOverEm());
1367         h_h1OverE_[iDet]->Fill(aPho->hadTowOverEm(1));
1368         h_h2OverE_[iDet]->Fill(aPho->hadTowOverEm(2));
1369         h_newhOverE_[iDet]->Fill(aPho->hadTowOverEm());
1370         // Isolation from particle flow
1371         h_chHadIso_[0]->Fill(aPho->chargedHadronIso());
1372         h_nHadIso_[0]->Fill(aPho->neutralHadronIso());
1373         h_phoIso_[0]->Fill(aPho->photonIso());
1374         h_nCluOutsideMustache_[0]->Fill(float(aPho->nClusterOutsideMustache()));
1375         h_etOutsideMustache_[0]->Fill(aPho->etOutsideMustache());
1376         h_pfMva_[0]->Fill(aPho->pfMVA());
1377         h_chHadIso_[iDet]->Fill(aPho->chargedHadronIso());
1378         h_nHadIso_[iDet]->Fill(aPho->neutralHadronIso());
1379         h_phoIso_[iDet]->Fill(aPho->photonIso());
1380         h_nCluOutsideMustache_[iDet]->Fill(float(aPho->nClusterOutsideMustache()));
1381         h_etOutsideMustache_[iDet]->Fill(aPho->etOutsideMustache());
1382         h_pfMva_[iDet]->Fill(aPho->pfMVA());
1383 
1384         ///////////////////////   Particle based isolation
1385         if (fName_ == "zmumugammaGedValidation") {
1386           float SumPtIsoValCh = 0.;
1387           float SumPtIsoValNh = 0.;
1388           float SumPtIsoValPh = 0.;
1389 
1390           float SumPtIsoValCleanCh = 0.;
1391           float SumPtIsoValCleanNh = 0.;
1392           float SumPtIsoValCleanPh = 0.;
1393 
1394           for (unsigned int lCand = 0; lCand < pfCandidateHandle->size(); lCand++) {
1395             reco::PFCandidateRef pfCandRef(reco::PFCandidateRef(pfCandidateHandle, lCand));
1396             float dR = deltaR2(aPho->eta(), aPho->phi(), pfCandRef->eta(), pfCandRef->phi());
1397             if (dR < 0.4 * 0.4) {
1398               /// uncleaned
1399               reco::PFCandidate::ParticleType type = pfCandRef->particleId();
1400               if (type == reco::PFCandidate::e)
1401                 continue;
1402               if (type == reco::PFCandidate::gamma && pfCandRef->mva_nothing_gamma() > 0.)
1403                 continue;
1404               dR = sqrt(dR);
1405 
1406               if (type == reco::PFCandidate::h) {
1407                 SumPtIsoValCh += pfCandRef->pt();
1408                 h_dRPhoPFcand_ChHad_unCleaned_[0]->Fill(dR);
1409                 h_dRPhoPFcand_ChHad_unCleaned_[iDet]->Fill(dR);
1410               }
1411               if (type == reco::PFCandidate::h0) {
1412                 SumPtIsoValNh += pfCandRef->pt();
1413                 h_dRPhoPFcand_NeuHad_unCleaned_[0]->Fill(dR);
1414                 h_dRPhoPFcand_NeuHad_unCleaned_[iDet]->Fill(dR);
1415               }
1416               if (type == reco::PFCandidate::gamma) {
1417                 SumPtIsoValPh += pfCandRef->pt();
1418                 h_dRPhoPFcand_Pho_unCleaned_[0]->Fill(dR);
1419                 h_dRPhoPFcand_Pho_unCleaned_[iDet]->Fill(dR);
1420               }
1421               ////////// acces the value map to access the PFCandidates in overlap with the photon which need to be excluded from the isolation
1422               bool skip = false;
1423               for (std::vector<reco::PFCandidateRef>::const_iterator i = phoToParticleBasedIsoMap[aPho].begin();
1424                    i != phoToParticleBasedIsoMap[aPho].end();
1425                    ++i) {
1426                 //        std::cout << " PhotonValidator PfCand pt " << pfCandRef->pt() << " id " <<pfCandRef->particleId() <<  " and in the map " << (*i)->pt() << " type " << (*i)->particleId() << std::endl;
1427                 if ((*i) == pfCandRef) {
1428                   skip = true;
1429                 }
1430               }  // loop over the PFCandidates flagged as overlapping with the photon
1431 
1432               if (skip)
1433                 continue;
1434               if (type == reco::PFCandidate::h) {
1435                 SumPtIsoValCleanCh += pfCandRef->pt();
1436                 h_dRPhoPFcand_ChHad_Cleaned_[0]->Fill(dR);
1437                 h_dRPhoPFcand_ChHad_Cleaned_[iDet]->Fill(dR);
1438               }
1439               if (type == reco::PFCandidate::h0) {
1440                 SumPtIsoValCleanNh += pfCandRef->pt();
1441                 h_dRPhoPFcand_NeuHad_Cleaned_[0]->Fill(dR);
1442                 h_dRPhoPFcand_NeuHad_Cleaned_[iDet]->Fill(dR);
1443               }
1444               if (type == reco::PFCandidate::gamma) {
1445                 SumPtIsoValCleanPh += pfCandRef->pt();
1446                 h_dRPhoPFcand_Pho_Cleaned_[0]->Fill(dR);
1447                 h_dRPhoPFcand_Pho_Cleaned_[iDet]->Fill(dR);
1448               }
1449             }  // dr=0.4
1450           }  // loop over all PF Candidates
1451 
1452           h_SumPtOverPhoPt_ChHad_Cleaned_[0]->Fill(SumPtIsoValCleanCh / aPho->pt());
1453           h_SumPtOverPhoPt_NeuHad_Cleaned_[0]->Fill(SumPtIsoValCleanNh / aPho->pt());
1454           h_SumPtOverPhoPt_Pho_Cleaned_[0]->Fill(SumPtIsoValCleanPh / aPho->pt());
1455           h_SumPtOverPhoPt_ChHad_unCleaned_[0]->Fill(SumPtIsoValCh / aPho->pt());
1456           h_SumPtOverPhoPt_NeuHad_unCleaned_[0]->Fill(SumPtIsoValNh / aPho->pt());
1457           h_SumPtOverPhoPt_Pho_unCleaned_[0]->Fill(SumPtIsoValPh / aPho->pt());
1458           //
1459           h_SumPtOverPhoPt_ChHad_Cleaned_[iDet]->Fill(SumPtIsoValCleanCh / aPho->pt());
1460           h_SumPtOverPhoPt_NeuHad_Cleaned_[iDet]->Fill(SumPtIsoValCleanNh / aPho->pt());
1461           h_SumPtOverPhoPt_Pho_Cleaned_[iDet]->Fill(SumPtIsoValCleanPh / aPho->pt());
1462           h_SumPtOverPhoPt_ChHad_unCleaned_[iDet]->Fill(SumPtIsoValCh / aPho->pt());
1463           h_SumPtOverPhoPt_NeuHad_unCleaned_[iDet]->Fill(SumPtIsoValNh / aPho->pt());
1464           h_SumPtOverPhoPt_Pho_unCleaned_[iDet]->Fill(SumPtIsoValPh / aPho->pt());
1465         }  // only for zmumugammaGedValidation
1466 
1467         if (makeProfiles_) {
1468           p_r9VsEt_[iDet]->Fill(aPho->et(), aPho->r9());
1469           p_r9VsEta_[0]->Fill(aPho->eta(), aPho->r9());
1470           p_e1x5VsEt_[iDet]->Fill(aPho->et(), aPho->e1x5());
1471           p_e1x5VsEta_[0]->Fill(aPho->eta(), aPho->e1x5());
1472           p_e2x5VsEt_[iDet]->Fill(aPho->et(), aPho->e2x5());
1473           p_e2x5VsEta_[0]->Fill(aPho->eta(), aPho->e2x5());
1474           p_r1x5VsEt_[iDet]->Fill(aPho->et(), aPho->r1x5());
1475           p_r1x5VsEta_[0]->Fill(aPho->eta(), aPho->r1x5());
1476           p_r2x5VsEt_[iDet]->Fill(aPho->et(), aPho->r2x5());
1477           p_r2x5VsEta_[0]->Fill(aPho->eta(), aPho->r2x5());
1478           //
1479           p_sigmaIetaIetaVsEta_[0]->Fill(aPho->eta(), aPho->sigmaIetaIeta());
1480           p_nTrackIsolSolidVsEt_[iDet]->Fill(aPho->et(), aPho->nTrkSolidConeDR04());
1481           p_nTrackIsolSolidVsEta_[0]->Fill(aPho->eta(), aPho->nTrkSolidConeDR04());
1482           p_nTrackIsolHollowVsEt_[iDet]->Fill(aPho->et(), aPho->nTrkHollowConeDR04());
1483           p_nTrackIsolHollowVsEta_[0]->Fill(aPho->eta(), aPho->nTrkHollowConeDR04());
1484           p_trackPtSumSolidVsEt_[iDet]->Fill(aPho->et(), aPho->trkSumPtSolidConeDR04());
1485           p_trackPtSumSolidVsEta_[0]->Fill(aPho->eta(), aPho->trkSumPtSolidConeDR04());
1486           p_trackPtSumHollowVsEt_[iDet]->Fill(aPho->et(), aPho->trkSumPtHollowConeDR04());
1487           p_trackPtSumHollowVsEta_[0]->Fill(aPho->eta(), aPho->trkSumPtHollowConeDR04());
1488           //
1489           p_ecalSumVsEt_[iDet]->Fill(aPho->et(), aPho->ecalRecHitSumEtConeDR04());
1490           p_ecalSumVsEta_[0]->Fill(aPho->eta(), aPho->ecalRecHitSumEtConeDR04());
1491           p_hcalSumVsEt_[iDet]->Fill(aPho->et(), aPho->hcalTowerSumEtConeDR04());
1492           p_hcalSumVsEta_[0]->Fill(aPho->eta(), aPho->hcalTowerSumEtConeDR04());
1493           p_hOverEVsEt_[iDet]->Fill(aPho->et(), aPho->hadTowOverEm());
1494           p_hOverEVsEta_[0]->Fill(aPho->eta(), aPho->hadTowOverEm());
1495         }
1496 
1497         //// 2D Histos ////
1498         if (use2DHistos_) {
1499           //SHOWER SHAPE
1500           h2_r9VsEt_[iDet]->Fill(aPho->et(), aPho->r9());
1501           h2_r9VsEta_[0]->Fill(aPho->eta(), aPho->r9());
1502           h2_e1x5VsEt_[iDet]->Fill(aPho->et(), aPho->e1x5());
1503           h2_e1x5VsEta_[0]->Fill(aPho->eta(), aPho->e1x5());
1504           h2_e2x5VsEta_[0]->Fill(aPho->eta(), aPho->e2x5());
1505           h2_e2x5VsEt_[iDet]->Fill(aPho->et(), aPho->e2x5());
1506           h2_r1x5VsEta_[0]->Fill(aPho->eta(), aPho->r1x5());
1507           h2_r1x5VsEt_[iDet]->Fill(aPho->et(), aPho->r1x5());
1508           h2_r2x5VsEt_[iDet]->Fill(aPho->et(), aPho->r2x5());
1509           h2_r2x5VsEta_[0]->Fill(aPho->eta(), aPho->r2x5());
1510           h2_sigmaIetaIetaVsEta_[0]->Fill(aPho->eta(), aPho->sigmaIetaIeta());
1511           //TRACK ISOLATION
1512           h2_nTrackIsolSolidVsEt_[0]->Fill(aPho->et(), aPho->nTrkSolidConeDR04());
1513           h2_nTrackIsolSolidVsEta_[0]->Fill(aPho->eta(), aPho->nTrkSolidConeDR04());
1514           h2_nTrackIsolHollowVsEt_[0]->Fill(aPho->et(), aPho->nTrkHollowConeDR04());
1515           h2_nTrackIsolHollowVsEta_[0]->Fill(aPho->eta(), aPho->nTrkHollowConeDR04());
1516           h2_trackPtSumSolidVsEt_[0]->Fill(aPho->et(), aPho->trkSumPtSolidConeDR04());
1517           h2_trackPtSumSolidVsEta_[0]->Fill(aPho->eta(), aPho->trkSumPtSolidConeDR04());
1518           h2_trackPtSumHollowVsEt_[0]->Fill(aPho->et(), aPho->trkSumPtHollowConeDR04());
1519           h2_trackPtSumHollowVsEta_[0]->Fill(aPho->eta(), aPho->trkSumPtHollowConeDR04());
1520           //CALORIMETER ISOLATION
1521           h2_ecalSumVsEt_[iDet]->Fill(aPho->et(), aPho->ecalRecHitSumEtConeDR04());
1522           h2_ecalSumVsEta_[0]->Fill(aPho->eta(), aPho->ecalRecHitSumEtConeDR04());
1523           h2_hcalSumVsEt_[iDet]->Fill(aPho->et(), aPho->hcalTowerSumEtConeDR04());
1524           h2_hcalSumVsEta_[0]->Fill(aPho->eta(), aPho->hcalTowerSumEtConeDR04());
1525         }
1526       }  //end photon loop
1527 
1528       h_nPho_[0]->Fill(float(nPho));
1529       h_nPho_[1]->Fill(float(nPhoBarrel));
1530       h_nPho_[2]->Fill(float(nPhoEndcap));
1531     }  //end inner muon loop
1532   }  //end outer muon loop
1533 }  //End of Analyze method
1534 
1535 bool ZToMuMuGammaAnalyzer::basicMuonSelection(const reco::Muon& mu) {
1536   bool result = true;
1537   if (!mu.innerTrack().isNonnull())
1538     result = false;
1539   if (!mu.globalTrack().isNonnull())
1540     result = false;
1541   if (!mu.isGlobalMuon())
1542     result = false;
1543   if (mu.pt() < muonMinPt_)
1544     result = false;
1545   if (fabs(mu.eta()) > 2.4)
1546     result = false;
1547 
1548   int pixHits = 0;
1549   int tkHits = 0;
1550   if (mu.innerTrack().isNonnull()) {
1551     pixHits = mu.innerTrack()->hitPattern().numberOfValidPixelHits();
1552     tkHits = mu.innerTrack()->hitPattern().numberOfValidStripHits();
1553   }
1554 
1555   if (pixHits + tkHits < minPixStripHits_)
1556     result = false;
1557 
1558   return result;
1559 }
1560 
1561 bool ZToMuMuGammaAnalyzer::muonSelection(const reco::Muon& mu, const reco::BeamSpot& beamSpot) {
1562   bool result = true;
1563   if (mu.globalTrack()->normalizedChi2() > muonMaxChi2_)
1564     result = false;
1565   if (fabs(mu.globalTrack()->dxy(beamSpot)) > muonMaxDxy_)
1566     result = false;
1567   if (mu.numberOfMatches() < muonMatches_)
1568     result = false;
1569 
1570   if (mu.track()->hitPattern().numberOfValidPixelHits() < validPixHits_)
1571     result = false;
1572   if (mu.globalTrack()->hitPattern().numberOfValidMuonHits() < validMuonHits_)
1573     result = false;
1574   if (!mu.isTrackerMuon())
1575     result = false;
1576   // track isolation
1577   if (mu.isolationR03().sumPt > muonTrackIso_)
1578     result = false;
1579   if (fabs(mu.eta()) > muonTightEta_)
1580     result = false;
1581 
1582   return result;
1583 }
1584 
1585 bool ZToMuMuGammaAnalyzer::photonSelection(const reco::PhotonRef& pho) {
1586   bool result = true;
1587   if (pho->pt() < photonMinEt_)
1588     result = false;
1589   if (fabs(pho->eta()) > photonMaxEta_)
1590     result = false;
1591   if (pho->isEBEEGap())
1592     result = false;
1593 
1594   double EtCorrHcalIso = pho->hcalTowerSumEtConeDR03() - 0.005 * pho->pt();
1595   double EtCorrTrkIso = pho->trkSumPtHollowConeDR03() - 0.002 * pho->pt();
1596 
1597   if (pho->r9() <= 0.9) {
1598     if (pho->isEB() && (pho->hadTowOverEm() > 0.075 || pho->sigmaIetaIeta() > 0.014))
1599       result = false;
1600     if (pho->isEE() && (pho->hadTowOverEm() > 0.075 || pho->sigmaIetaIeta() > 0.034))
1601       result = false;
1602     ///  remove after moriond    if (EtCorrEcalIso>4.0) result=false;
1603     if (EtCorrHcalIso > 4.0)
1604       result = false;
1605     if (EtCorrTrkIso > 4.0)
1606       result = false;
1607     if (pho->chargedHadronIso() > 4)
1608       result = false;
1609   } else {
1610     if (pho->isEB() && (pho->hadTowOverEm() > 0.082 || pho->sigmaIetaIeta() > 0.014))
1611       result = false;
1612     if (pho->isEE() && (pho->hadTowOverEm() > 0.075 || pho->sigmaIetaIeta() > 0.034))
1613       result = false;
1614     /// remove after moriond if (EtCorrEcalIso>50.0) result=false;
1615     if (EtCorrHcalIso > 50.0)
1616       result = false;
1617     if (EtCorrTrkIso > 50.0)
1618       result = false;
1619     if (pho->chargedHadronIso() > 4)
1620       result = false;
1621   }
1622   return result;
1623 }
1624 
1625 float ZToMuMuGammaAnalyzer::mumuInvMass(const reco::Muon& mu1, const reco::Muon& mu2) {
1626   math::XYZTLorentzVector p12 = mu1.p4() + mu2.p4();
1627   float mumuMass2 = p12.Dot(p12);
1628   float invMass = sqrt(mumuMass2);
1629   return invMass;
1630 }
1631 
1632 float ZToMuMuGammaAnalyzer::mumuGammaInvMass(const reco::Muon& mu1, const reco::Muon& mu2, const reco::PhotonRef& pho) {
1633   math::XYZTLorentzVector p12 = mu1.p4() + mu2.p4() + pho->p4();
1634   float Mass2 = p12.Dot(p12);
1635   float invMass = sqrt(Mass2);
1636   return invMass;
1637 }
1638 
1639 #include "FWCore/PluginManager/interface/ModuleDef.h"
1640 #include "FWCore/Framework/interface/MakerMacros.h"
1641 
1642 DEFINE_FWK_MODULE(ZToMuMuGammaAnalyzer);