Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-11 04:33:29

0001 #include <iostream>
0002 #include <memory>
0003 
0004 //
0005 #include "FWCore/ServiceRegistry/interface/Service.h"
0006 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0007 //
0008 #include "Validation/RecoEgamma/plugins/PhotonValidator.h"
0009 
0010 //
0011 #include "FWCore/Framework/interface/MakerMacros.h"
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 #include "FWCore/Utilities/interface/Exception.h"
0014 //
0015 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0016 //
0017 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
0018 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexContainer.h"
0019 #include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h"
0020 //
0021 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
0022 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0023 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0024 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0025 //
0026 #include "DataFormats/Math/interface/deltaR.h"
0027 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0028 #include "TrackingTools/PatternTools/interface/TwoTrackMinimumDistance.h"
0029 #include "TrackingTools/TransientTrack/interface/TrackTransientTrack.h"
0030 //
0031 #include "CLHEP/Units/GlobalPhysicalConstants.h"
0032 #include "CommonTools/Statistics/interface/ChiSquaredProbability.h"
0033 
0034 //
0035 #include "DataFormats/Common/interface/Handle.h"
0036 #include "DataFormats/TrackReco/interface/Track.h"
0037 #include "DataFormats/TrackReco/interface/TrackExtra.h"
0038 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0039 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0040 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
0041 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
0042 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0043 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
0044 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0045 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0046 #include "DataFormats/VertexReco/interface/Vertex.h"
0047 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0048 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
0049 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
0050 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
0051 #include "DataFormats/DetId/interface/DetId.h"
0052 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0053 #include "DataFormats/VertexReco/interface/Vertex.h"
0054 
0055 //
0056 #include "RecoEgamma/EgammaMCTools/interface/PhotonMCTruthFinder.h"
0057 #include "RecoEgamma/EgammaMCTools/interface/PhotonMCTruth.h"
0058 #include "RecoEgamma/EgammaMCTools/interface/ElectronMCTruth.h"
0059 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
0060 
0061 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0062 #include "Geometry/Records/interface/CaloTopologyRecord.h"
0063 //
0064 //#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0065 //
0066 #include "TFile.h"
0067 #include "TH1.h"
0068 #include "TH2.h"
0069 #include "TTree.h"
0070 #include "TVector3.h"
0071 #include "TProfile.h"
0072 //
0073 /** \class PhotonValidator
0074  **
0075  **
0076  **  $Id: PhotonValidator
0077  **  \author Nancy Marinelli, U. of Notre Dame, US
0078  **
0079  ***/
0080 
0081 using namespace std;
0082 
0083 PhotonValidator::PhotonValidator(const edm::ParameterSet& pset)
0084     : magneticFieldToken_{esConsumes<edm::Transition::BeginRun>()},
0085       caloGeometryToken_{esConsumes()},
0086       transientTrackBuilderToken_{esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))} {
0087   fName_ = pset.getParameter<std::string>("analyzerName");
0088   verbosity_ = pset.getUntrackedParameter<int>("Verbosity");
0089   parameters_ = pset;
0090   fastSim_ = pset.getParameter<bool>("fastSim");
0091   isRunCentrally_ = pset.getParameter<bool>("isRunCentrally");
0092 
0093   photonCollectionProducer_ = pset.getParameter<std::string>("phoProducer");
0094   photonCollection_ = pset.getParameter<std::string>("photonCollection");
0095   photonCollectionToken_ =
0096       consumes<reco::PhotonCollection>(edm::InputTag(photonCollectionProducer_, photonCollection_));
0097 
0098   token_tp_ = consumes<TrackingParticleCollection>(pset.getParameter<edm::InputTag>("label_tp"));
0099 
0100   barrelEcalHits_ = consumes<EcalRecHitCollection>(pset.getParameter<edm::InputTag>("barrelEcalHits"));
0101   endcapEcalHits_ = consumes<EcalRecHitCollection>(pset.getParameter<edm::InputTag>("endcapEcalHits"));
0102 
0103   conversionOITrackProducer_ = pset.getParameter<std::string>("conversionOITrackProducer");
0104   conversionIOTrackProducer_ = pset.getParameter<std::string>("conversionIOTrackProducer");
0105   conversionOITrackPr_Token_ = consumes<edm::View<reco::Track> >(edm::InputTag(conversionOITrackProducer_));
0106   conversionIOTrackPr_Token_ = consumes<edm::View<reco::Track> >(edm::InputTag(conversionIOTrackProducer_));
0107 
0108   pfCandidates_ = consumes<reco::PFCandidateCollection>(pset.getParameter<edm::InputTag>("pfCandidates"));
0109   valueMapPhoPFCandIso_ = pset.getParameter<std::string>("valueMapPhoToParticleBasedIso");
0110   particleBasedIso_token =
0111       consumes<edm::ValueMap<std::vector<reco::PFCandidateRef> > >(pset.getUntrackedParameter<edm::InputTag>(
0112           "particleBasedIso", edm::InputTag("particleBasedIsolation", valueMapPhoPFCandIso_)));
0113 
0114   minPhoEtCut_ = pset.getParameter<double>("minPhoEtCut");
0115   convTrackMinPtCut_ = pset.getParameter<double>("convTrackMinPtCut");
0116   likelihoodCut_ = pset.getParameter<double>("likelihoodCut");
0117 
0118   trkIsolExtRadius_ = pset.getParameter<double>("trkIsolExtR");
0119   trkIsolInnRadius_ = pset.getParameter<double>("trkIsolInnR");
0120   trkPtLow_ = pset.getParameter<double>("minTrackPtCut");
0121   lip_ = pset.getParameter<double>("lipCut");
0122   ecalIsolRadius_ = pset.getParameter<double>("ecalIsolR");
0123   bcEtLow_ = pset.getParameter<double>("minBcEtCut");
0124   hcalIsolExtRadius_ = pset.getParameter<double>("hcalIsolExtR");
0125   hcalIsolInnRadius_ = pset.getParameter<double>("hcalIsolInnR");
0126   hcalHitEtLow_ = pset.getParameter<double>("minHcalHitEtCut");
0127 
0128   numOfTracksInCone_ = pset.getParameter<int>("maxNumOfTracksInCone");
0129   trkPtSumCut_ = pset.getParameter<double>("trkPtSumCut");
0130   ecalEtSumCut_ = pset.getParameter<double>("ecalEtSumCut");
0131   hcalEtSumCut_ = pset.getParameter<double>("hcalEtSumCut");
0132   dCotCutOn_ = pset.getParameter<bool>("dCotCutOn");
0133   dCotCutValue_ = pset.getParameter<double>("dCotCutValue");
0134   dCotHardCutValue_ = pset.getParameter<double>("dCotHardCutValue");
0135 
0136   offline_pvToken_ = consumes<reco::VertexCollection>(
0137       pset.getUntrackedParameter<edm::InputTag>("offlinePV", edm::InputTag("offlinePrimaryVertices")));
0138   g4_simTk_Token_ = consumes<edm::SimTrackContainer>(edm::InputTag("g4SimHits"));
0139   g4_simVtx_Token_ = consumes<edm::SimVertexContainer>(edm::InputTag("g4SimHits"));
0140   famos_simTk_Token_ = consumes<edm::SimTrackContainer>(edm::InputTag("fastSimProducer"));
0141   famos_simVtx_Token_ = consumes<edm::SimVertexContainer>(edm::InputTag("fastSimProducer"));
0142   hepMC_Token_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
0143   genjets_Token_ = consumes<reco::GenJetCollection>(edm::InputTag("ak4GenJets"));
0144 
0145   genpartToken_ = consumes<reco::GenParticleCollection>(edm::InputTag("genParticles"));
0146 
0147   consumes<reco::TrackToTrackingParticleAssociator>(edm::InputTag("trackAssociatorByHitsForPhotonValidation"));
0148 
0149   nEvt_ = 0;
0150   nEntry_ = 0;
0151   nRecConv_ = 0;
0152   nRecConvAss_ = 0;
0153   nRecConvAssWithEcal_ = 0;
0154   nInvalidPCA_ = 0;
0155 }
0156 
0157 PhotonValidator::~PhotonValidator() {}
0158 
0159 void PhotonValidator::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const&) {
0160   double resMin = parameters_.getParameter<double>("resMin");
0161   double resMax = parameters_.getParameter<double>("resMax");
0162   int resBin = parameters_.getParameter<int>("resBin");
0163 
0164   double eMin = parameters_.getParameter<double>("eMin");
0165   double eMax = parameters_.getParameter<double>("eMax");
0166   int eBin = parameters_.getParameter<int>("eBin");
0167 
0168   double etMin = parameters_.getParameter<double>("etMin");
0169   double etMax = parameters_.getParameter<double>("etMax");
0170   int etBin = parameters_.getParameter<int>("etBin");
0171 
0172   double etScale = parameters_.getParameter<double>("etScale");
0173 
0174   double etaMin = parameters_.getParameter<double>("etaMin");
0175   double etaMax = parameters_.getParameter<double>("etaMax");
0176   int etaBin = parameters_.getParameter<int>("etaBin");
0177   int etaBin2 = parameters_.getParameter<int>("etaBin2");
0178 
0179   double dEtaMin = parameters_.getParameter<double>("dEtaMin");
0180   double dEtaMax = parameters_.getParameter<double>("dEtaMax");
0181   int dEtaBin = parameters_.getParameter<int>("dEtaBin");
0182 
0183   double phiMin = parameters_.getParameter<double>("phiMin");
0184   double phiMax = parameters_.getParameter<double>("phiMax");
0185   int phiBin = parameters_.getParameter<int>("phiBin");
0186 
0187   double dPhiMin = parameters_.getParameter<double>("dPhiMin");
0188   double dPhiMax = parameters_.getParameter<double>("dPhiMax");
0189   int dPhiBin = parameters_.getParameter<int>("dPhiBin");
0190 
0191   double rMin = parameters_.getParameter<double>("rMin");
0192   double rMax = parameters_.getParameter<double>("rMax");
0193   int rBin = parameters_.getParameter<int>("rBin");
0194 
0195   double zMin = parameters_.getParameter<double>("zMin");
0196   double zMax = parameters_.getParameter<double>("zMax");
0197   int zBin = parameters_.getParameter<int>("zBin");
0198 
0199   double r9Min = parameters_.getParameter<double>("r9Min");
0200   double r9Max = parameters_.getParameter<double>("r9Max");
0201   int r9Bin = parameters_.getParameter<int>("r9Bin");
0202 
0203   double dPhiTracksMin = parameters_.getParameter<double>("dPhiTracksMin");
0204   double dPhiTracksMax = parameters_.getParameter<double>("dPhiTracksMax");
0205   int dPhiTracksBin = parameters_.getParameter<int>("dPhiTracksBin");
0206 
0207   double dEtaTracksMin = parameters_.getParameter<double>("dEtaTracksMin");
0208   double dEtaTracksMax = parameters_.getParameter<double>("dEtaTracksMax");
0209   int dEtaTracksBin = parameters_.getParameter<int>("dEtaTracksBin");
0210 
0211   double dCotTracksMin = parameters_.getParameter<double>("dCotTracksMin");
0212   double dCotTracksMax = parameters_.getParameter<double>("dCotTracksMax");
0213   int dCotTracksBin = parameters_.getParameter<int>("dCotTracksBin");
0214 
0215   double povereMin = parameters_.getParameter<double>("povereMin");
0216   double povereMax = parameters_.getParameter<double>("povereMax");
0217   int povereBin = parameters_.getParameter<int>("povereBin");
0218 
0219   double eoverpMin = parameters_.getParameter<double>("eoverpMin");
0220   double eoverpMax = parameters_.getParameter<double>("eoverpMax");
0221   int eoverpBin = parameters_.getParameter<int>("eoverpBin");
0222 
0223   double chi2Min = parameters_.getParameter<double>("chi2Min");
0224   double chi2Max = parameters_.getParameter<double>("chi2Max");
0225 
0226   int ggMassBin = parameters_.getParameter<int>("ggMassBin");
0227   double ggMassMin = parameters_.getParameter<double>("ggMassMin");
0228   double ggMassMax = parameters_.getParameter<double>("ggMassMax");
0229 
0230   double rMinForXray = parameters_.getParameter<double>("rMinForXray");
0231   double rMaxForXray = parameters_.getParameter<double>("rMaxForXray");
0232   int rBinForXray = parameters_.getParameter<int>("rBinForXray");
0233   double zMinForXray = parameters_.getParameter<double>("zMinForXray");
0234   double zMaxForXray = parameters_.getParameter<double>("zMaxForXray");
0235   int zBinForXray = parameters_.getParameter<int>("zBinForXray");
0236   int zBin2ForXray = parameters_.getParameter<int>("zBin2ForXray");
0237 
0238   //// All MC photons
0239   // SC from reco photons
0240 
0241   iBooker.setCurrentFolder("EgammaV/" + fName_ + "/SimulationInfo");
0242 
0243   // simulation information about all MC photons found
0244   std::string histname = "nOfSimPhotons";
0245   if (!isRunCentrally_) {
0246     h_nSimPho_[0] = iBooker.book1D(histname, "# of Sim photons per event ", 20, -0.5, 19.5);
0247     histname = "SimPhoMotherEt";
0248     h_SimPhoMotherEt_[0] = iBooker.book1D(histname, "Sim photon Mother tranverse energy spectrum", etBin, etMin, etMax);
0249     h_SimPhoMotherEta_[0] = iBooker.book1D("SimPhoMotherEta", " Sim Photon Mother Eta ", etaBin, etaMin, etaMax);
0250     histname = "SimPhoMotherEtMatched";
0251     h_SimPhoMotherEt_[1] = iBooker.book1D(
0252         histname, "Sim photon  matched by a reco Photon: Mother tranverse energy spectrum", etBin, etMin, etMax);
0253     h_SimPhoMotherEta_[1] = iBooker.book1D(
0254         "SimPhoMotherEtaMatched", " Sim Photon matched by a reco Photon:  Mother Eta ", etaBin, etaMin, etaMax);
0255   }
0256 
0257   histname = "h_SimPhoEta";
0258   h_SimPho_[0] = iBooker.book1D(histname, " All photons simulated #eta", etaBin, etaMin, etaMax);
0259   histname = "h_SimPhoPhi";
0260   h_SimPho_[1] = iBooker.book1D(histname, " All photons simulated #phi", phiBin, phiMin, phiMax);
0261   histname = "h_SimPhoEt";
0262   h_SimPho_[2] = iBooker.book1D(histname, " All photons simulated Et", etBin, etMin, etMax);
0263   // Numerators
0264   histname = "nOfSimPhotonsMatched";
0265   h_nSimPho_[1] = iBooker.book1D(histname, "# of Sim photons matched by a reco Photon per event ", 20, -0.5, 19.5);
0266   histname = "h_MatchedSimPhoEta";
0267   h_MatchedSimPho_[0] = iBooker.book1D(histname, " Matching photons simulated #eta", etaBin, etaMin, etaMax);
0268   histname = "h_MatchedSimPhoPhi";
0269   h_MatchedSimPho_[1] = iBooker.book1D(histname, " Matching photons simulated #phi", phiBin, phiMin, phiMax);
0270   histname = "h_MatchedSimPhoEt";
0271   h_MatchedSimPho_[2] = iBooker.book1D(histname, " Matching photons simulated Et", etBin, etMin, etMax);
0272   //
0273   histname = "h_MatchedSimPhoBadChEta";
0274   h_MatchedSimPhoBadCh_[0] = iBooker.book1D(histname, " Matching photons simulated #eta", etaBin, etaMin, etaMax);
0275   histname = "h_MatchedSimPhoBadChPhi";
0276   h_MatchedSimPhoBadCh_[1] = iBooker.book1D(histname, " Matching photons simulated #phi", phiBin, phiMin, phiMax);
0277   histname = "h_MatchedSimPhoBadChEt";
0278   h_MatchedSimPhoBadCh_[2] = iBooker.book1D(histname, " Matching photons simulated Et", etBin, etMin, etMax);
0279 
0280   /// Histograms for efficiencies
0281   histname = "nOfSimConversions";
0282   if (!isRunCentrally_) {
0283     h_nSimConv_[0] = iBooker.book1D(histname, "# of Sim conversions per event ", 20, -0.5, 19.5);
0284     histname = "nOfVisSimConversions";
0285     h_nSimConv_[1] = iBooker.book1D(histname, "# of Sim conversions per event ", 20, -0.5, 19.5);
0286   }
0287   /// Denominators
0288   histname = "h_AllSimConvEta";
0289   h_AllSimConv_[0] = iBooker.book1D(histname, " All conversions: simulated #eta", etaBin2, etaMin, etaMax);
0290   histname = "h_AllSimConvPhi";
0291   h_AllSimConv_[1] = iBooker.book1D(histname, " All conversions: simulated #phi", phiBin, phiMin, phiMax);
0292   histname = "h_AllSimConvR";
0293   h_AllSimConv_[2] = iBooker.book1D(histname, " All conversions: simulated R", rBin, rMin, rMax);
0294   histname = "h_AllSimConvZ";
0295   h_AllSimConv_[3] = iBooker.book1D(histname, " All conversions: simulated Z", zBin, zMin, zMax);
0296   histname = "h_AllSimConvEt";
0297   h_AllSimConv_[4] = iBooker.book1D(histname, " All conversions: simulated Et", etBin, etMin, etMax);
0298   //
0299   histname = "h_VisSimConvEta";
0300   h_VisSimConv_[0] = iBooker.book1D(histname, " All vis conversions: simulated #eta", etaBin2, etaMin, etaMax);
0301   histname = "h_VisSimConvPhi";
0302   h_VisSimConv_[1] = iBooker.book1D(histname, " All vis conversions: simulated #phi", phiBin, phiMin, phiMax);
0303   histname = "h_VisSimConvR";
0304   h_VisSimConv_[2] = iBooker.book1D(histname, " All vis conversions: simulated R", rBin, rMin, rMax);
0305   histname = "h_VisSimConvZ";
0306   h_VisSimConv_[3] = iBooker.book1D(histname, " All vis conversions: simulated Z", zBin, zMin, zMax);
0307   histname = "h_VisSimConvEt";
0308   h_VisSimConv_[4] = iBooker.book1D(histname, " All vis conversions: simulated Et", etBin, etMin, etMax);
0309   /// Numerators
0310   histname = "h_SimConvOneTracksEta";
0311   h_SimConvOneTracks_[0] =
0312       iBooker.book1D(histname, " All vis conversions with 1 reco  tracks: simulated #eta", etaBin2, etaMin, etaMax);
0313   histname = "h_SimConvOneTracksPhi";
0314   h_SimConvOneTracks_[1] =
0315       iBooker.book1D(histname, " All vis conversions with 1 reco  tracks: simulated #phi", phiBin, phiMin, phiMax);
0316   histname = "h_SimConvOneTracksR";
0317   h_SimConvOneTracks_[2] =
0318       iBooker.book1D(histname, " All vis conversions with 1 reco  tracks: simulated R", rBin, rMin, rMax);
0319   histname = "h_SimConvOneTracksZ";
0320   h_SimConvOneTracks_[3] =
0321       iBooker.book1D(histname, " All vis conversions with 1 reco  tracks: simulated Z", zBin, zMin, zMax);
0322   histname = "h_SimConvOneTracksEt";
0323   h_SimConvOneTracks_[4] =
0324       iBooker.book1D(histname, " All vis conversions with 1 reco  tracks: simulated Et", etBin, etMin, etMax);
0325   //
0326   histname = "h_SimConvTwoMTracksEta";
0327   h_SimConvTwoMTracks_[0] = iBooker.book1D(
0328       histname, " All vis conversions with 2 reco-matching tracks: simulated #eta", etaBin2, etaMin, etaMax);
0329   histname = "h_SimConvTwoMTracksPhi";
0330   h_SimConvTwoMTracks_[1] = iBooker.book1D(
0331       histname, " All vis conversions with 2 reco-matching tracks: simulated #phi", phiBin, phiMin, phiMax);
0332   histname = "h_SimConvTwoMTracksR";
0333   h_SimConvTwoMTracks_[2] =
0334       iBooker.book1D(histname, " All vis conversions with 2 reco-matching tracks: simulated R", rBin, rMin, rMax);
0335   histname = "h_SimConvTwoMTracksZ";
0336   h_SimConvTwoMTracks_[3] =
0337       iBooker.book1D(histname, " All vis conversions with 2 reco-matching tracks: simulated Z", zBin, zMin, zMax);
0338   histname = "h_SimConvTwoMTracksEt";
0339   h_SimConvTwoMTracks_[4] =
0340       iBooker.book1D(histname, " All vis conversions with 2 reco-matching tracks: simulated Et", etBin, etMin, etMax);
0341   //
0342   histname = "h_SimConvTwoTracksEta";
0343   h_SimConvTwoTracks_[0] =
0344       iBooker.book1D(histname, " All vis conversions with 2 reco  tracks: simulated #eta", etaBin2, etaMin, etaMax);
0345   histname = "h_SimConvTwoTracksPhi";
0346   h_SimConvTwoTracks_[1] =
0347       iBooker.book1D(histname, " All vis conversions with 2 reco tracks: simulated #phi", phiBin, phiMin, phiMax);
0348   histname = "h_SimConvTwoTracksR";
0349   h_SimConvTwoTracks_[2] =
0350       iBooker.book1D(histname, " All vis conversions with 2 reco tracks: simulated R", rBin, rMin, rMax);
0351   histname = "h_SimConvTwoTracksZ";
0352   h_SimConvTwoTracks_[3] =
0353       iBooker.book1D(histname, " All vis conversions with 2 reco tracks: simulated Z", zBin, zMin, zMax);
0354   histname = "h_SimConvTwoTracksEt";
0355   h_SimConvTwoTracks_[4] =
0356       iBooker.book1D(histname, " All vis conversions with 2 reco tracks: simulated Et", etBin, etMin, etMax);
0357   //
0358   histname = "h_SimConvOneMTracksEta";
0359   h_SimConvOneMTracks_[0] = iBooker.book1D(
0360       histname, " All vis conversions with 1 reco-matching tracks: simulated #eta", etaBin2, etaMin, etaMax);
0361   histname = "h_SimConvOneMTracksPhi";
0362   h_SimConvOneMTracks_[1] = iBooker.book1D(
0363       histname, " All vis conversions with 1 reco-matching tracks: simulated #phi", phiBin, phiMin, phiMax);
0364   histname = "h_SimConvOneMTracksR";
0365   h_SimConvOneMTracks_[2] =
0366       iBooker.book1D(histname, " All vis conversions with 1 reco-matching tracks: simulated R", rBin, rMin, rMax);
0367   histname = "h_SimConvOneMTracksZ";
0368   h_SimConvOneMTracks_[3] =
0369       iBooker.book1D(histname, " All vis conversions with 1 reco-matching tracks: simulated Z", zBin, zMin, zMax);
0370   histname = "h_SimConvOneMTracksEt";
0371   h_SimConvOneMTracks_[4] =
0372       iBooker.book1D(histname, " All vis conversions with 1 reco-matching tracks: simulated Et", etBin, etMin, etMax);
0373   //
0374   histname = "h_SimConvTwoMTracksEtaAndVtxPGT0";
0375   h_SimConvTwoMTracksAndVtxPGT0_[0] = iBooker.book1D(
0376       histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated #eta", etaBin2, etaMin, etaMax);
0377   histname = "h_SimConvTwoMTracksPhiAndVtxPGT0";
0378   h_SimConvTwoMTracksAndVtxPGT0_[1] = iBooker.book1D(
0379       histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated #phi", phiBin, phiMin, phiMax);
0380   histname = "h_SimConvTwoMTracksRAndVtxPGT0";
0381   h_SimConvTwoMTracksAndVtxPGT0_[2] = iBooker.book1D(
0382       histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated R", rBin, rMin, rMax);
0383   histname = "h_SimConvTwoMTracksZAndVtxPGT0";
0384   h_SimConvTwoMTracksAndVtxPGT0_[3] = iBooker.book1D(
0385       histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated Z", zBin, zMin, zMax);
0386   histname = "h_SimConvTwoMTracksEtAndVtxPGT0";
0387   h_SimConvTwoMTracksAndVtxPGT0_[4] = iBooker.book1D(
0388       histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated Et", etBin, etMin, etMax);
0389   //
0390   histname = "h_SimConvTwoMTracksEtaAndVtxPGT0005";
0391   h_SimConvTwoMTracksAndVtxPGT0005_[0] = iBooker.book1D(
0392       histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated #eta", etaBin2, etaMin, etaMax);
0393   histname = "h_SimConvTwoMTracksPhiAndVtxPGT0005";
0394   h_SimConvTwoMTracksAndVtxPGT0005_[1] = iBooker.book1D(
0395       histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated #phi", phiBin, phiMin, phiMax);
0396   histname = "h_SimConvTwoMTracksRAndVtxPGT0005";
0397   h_SimConvTwoMTracksAndVtxPGT0005_[2] = iBooker.book1D(
0398       histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated R", rBin, rMin, rMax);
0399   histname = "h_SimConvTwoMTracksZAndVtxPGT0005";
0400   h_SimConvTwoMTracksAndVtxPGT0005_[3] = iBooker.book1D(
0401       histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated Z", zBin, zMin, zMax);
0402   histname = "h_SimConvTwoMTracksEtAndVtxPGT0005";
0403   h_SimConvTwoMTracksAndVtxPGT0005_[4] = iBooker.book1D(
0404       histname, " All vis conversions with 2 reco-matching tracks + vertex: simulated Et", etBin, etMin, etMax);
0405 
0406   if (!isRunCentrally_) {
0407     h_SimConvEtaPix_[0] = iBooker.book1D("simConvEtaPix", " sim converted Photon Eta: Pix ", etaBin, etaMin, etaMax);
0408     h_simTkPt_ = iBooker.book1D("simTkPt", "Sim conversion tracks pt ", etBin * 3, 0., etMax);
0409     h_simTkEta_ = iBooker.book1D("simTkEta", "Sim conversion tracks eta ", etaBin, etaMin, etaMax);
0410     h_simConvVtxRvsZ_[0] = iBooker.book2D("simConvVtxRvsZAll",
0411                                           " Photon Sim conversion vtx position",
0412                                           zBinForXray,
0413                                           zMinForXray,
0414                                           zMaxForXray,
0415                                           rBinForXray,
0416                                           rMinForXray,
0417                                           rMaxForXray);
0418     h_simConvVtxRvsZ_[1] = iBooker.book2D("simConvVtxRvsZBarrel",
0419                                           " Photon Sim conversion vtx position",
0420                                           zBinForXray,
0421                                           zMinForXray,
0422                                           zMaxForXray,
0423                                           rBinForXray,
0424                                           rMinForXray,
0425                                           rMaxForXray);
0426     h_simConvVtxRvsZ_[2] = iBooker.book2D("simConvVtxRvsZEndcap",
0427                                           " Photon Sim conversion vtx position",
0428                                           zBin2ForXray,
0429                                           zMinForXray,
0430                                           zMaxForXray,
0431                                           rBinForXray,
0432                                           rMinForXray,
0433                                           rMaxForXray);
0434     h_simConvVtxYvsX_ = iBooker.book2D(
0435         "simConvVtxYvsXTrkBarrel", " Photon Sim conversion vtx position, (x,y) eta<1 ", 100, -80., 80., 100, -80., 80.);
0436   }
0437 
0438   //// histograms for bkg
0439   histname = "h_SimJetEta";
0440   h_SimJet_[0] = iBooker.book1D(histname, " Jet bkg simulated #eta", etaBin, etaMin, etaMax);
0441   histname = "h_SimJetPhi";
0442   h_SimJet_[1] = iBooker.book1D(histname, " Jet bkg simulated #phi", phiBin, phiMin, phiMax);
0443   histname = "h_SimJetEt";
0444   h_SimJet_[2] = iBooker.book1D(histname, " Jet bkg simulated Et", etBin, etMin, etMax);
0445   //
0446   histname = "h_MatchedSimJetEta";
0447   h_MatchedSimJet_[0] = iBooker.book1D(histname, " Matching jet simulated #eta", etaBin, etaMin, etaMax);
0448   histname = "h_MatchedSimJetPhi";
0449   h_MatchedSimJet_[1] = iBooker.book1D(histname, " Matching jet simulated #phi", phiBin, phiMin, phiMax);
0450   histname = "h_MatchedSimJetEt";
0451   h_MatchedSimJet_[2] = iBooker.book1D(histname, " Matching jet simulated Et", etBin, etMin, etMax);
0452   //
0453   histname = "h_MatchedSimJetBadChEta";
0454   h_MatchedSimJetBadCh_[0] = iBooker.book1D(histname, " Matching jet simulated #eta", etaBin, etaMin, etaMax);
0455   histname = "h_MatchedSimJetBadChPhi";
0456   h_MatchedSimJetBadCh_[1] = iBooker.book1D(histname, " Matching jet simulated #phi", phiBin, phiMin, phiMax);
0457   histname = "h_MatchedSimJetBadChEt";
0458   h_MatchedSimJetBadCh_[2] = iBooker.book1D(histname, " Matching jet simulated Et", etBin, etMin, etMax);
0459 
0460   iBooker.setCurrentFolder("EgammaV/" + fName_ + "/Background");
0461 
0462   histname = "nOfPhotons";
0463   h_nPho_ = iBooker.book1D(histname, "# of Reco photons per event ", 20, -0.5, 19.5);
0464 
0465   h_scBkgEta_ = iBooker.book1D("scBkgEta", " SC Bkg Eta ", etaBin, etaMin, etaMax);
0466   h_scBkgPhi_ = iBooker.book1D("scBkgPhi", " SC Bkg  Phi ", phiBin, phiMin, phiMax);
0467   //
0468   h_phoBkgEta_ = iBooker.book1D("phoBkgEta", " Photon Bkg Eta ", etaBin, etaMin, etaMax);
0469   h_phoBkgPhi_ = iBooker.book1D("phoBkgPhi", " Photon Bkg Phi ", phiBin, phiMin, phiMax);
0470   //
0471   h_phoBkgDEta_ = iBooker.book1D("phoBkgDEta", " Photon Eta(rec)-Eta(true) ", dEtaBin, dEtaMin, dEtaMax);
0472   h_phoBkgDPhi_ = iBooker.book1D("phoBkgDPhi", " Photon  Phi(rec)-Phi(true) ", dPhiBin, dPhiMin, dPhiMax);
0473   //
0474   histname = "phoBkgE";
0475   h_phoBkgE_[0] = iBooker.book1D(histname + "All", " Photon Bkg Energy: All ecal ", eBin, eMin, eMax);
0476   h_phoBkgE_[1] = iBooker.book1D(histname + "Barrel", " Photon Bkg Energy: barrel ", eBin, eMin, eMax);
0477   h_phoBkgE_[2] = iBooker.book1D(histname + "Endcap", " Photon Bkg Energy: Endcap ", eBin, eMin, eMax);
0478   //
0479   histname = "phoBkgEt";
0480   h_phoBkgEt_[0] = iBooker.book1D(histname + "All", " Photon Bkg Transverse Energy: All ecal ", etBin, etMin, etMax);
0481   h_phoBkgEt_[1] = iBooker.book1D(histname + "Barrel", " Photon Bkg Transverse Energy: Barrel ", etBin, etMin, etMax);
0482   h_phoBkgEt_[2] = iBooker.book1D(histname + "Endcap", " Photon BkgTransverse Energy: Endcap ", etBin, etMin, etMax);
0483 
0484   //
0485   histname = "scBkgE";
0486   h_scBkgE_[0] = iBooker.book1D(histname + "All", "    SC bkg Energy: All Ecal  ", eBin, eMin, eMax);
0487   h_scBkgE_[1] = iBooker.book1D(histname + "Barrel", " SC bkg Energy: Barrel ", eBin, eMin, eMax);
0488   h_scBkgE_[2] = iBooker.book1D(histname + "Endcap", " SC bkg Energy: Endcap ", eBin, eMin, eMax);
0489   histname = "scBkgEt";
0490   h_scBkgEt_[0] = iBooker.book1D(histname + "All", "    SC bkg Et: All Ecal  ", eBin, eMin, eMax);
0491   h_scBkgEt_[1] = iBooker.book1D(histname + "Barrel", " SC bkg Et: Barrel ", eBin, eMin, eMax);
0492   h_scBkgEt_[2] = iBooker.book1D(histname + "Endcap", " SC bkg Et: Endcap ", eBin, eMin, eMax);
0493   //
0494   histname = "r9Bkg";
0495   h_r9Bkg_[0] = iBooker.book1D(histname + "All", " r9 bkg: All Ecal", r9Bin, r9Min, r9Max);
0496   h_r9Bkg_[1] = iBooker.book1D(histname + "Barrel", " r9 bkg: Barrel ", r9Bin, r9Min, r9Max);
0497   h_r9Bkg_[2] = iBooker.book1D(histname + "Endcap", " r9 bkg: Endcap ", r9Bin, r9Min, r9Max);
0498   //
0499   histname = "R9VsEtaBkg";
0500   if (!isRunCentrally_)
0501     h2_r9VsEtaBkg_ =
0502         iBooker.book2D(histname + "All", " Bkg r9 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
0503   //
0504   histname = "R9VsEtBkg";
0505   if (!isRunCentrally_)
0506     h2_r9VsEtBkg_ =
0507         iBooker.book2D(histname + "All", " Bkg photons r9 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
0508   //
0509   histname = "r1Bkg";
0510   h_r1Bkg_[0] = iBooker.book1D(histname + "All", " Bkg photon e1x5/e5x5: All Ecal", r9Bin, r9Min, r9Max);
0511   h_r1Bkg_[1] = iBooker.book1D(histname + "Barrel", " Bkg photon e1x5/e5x5: Barrel ", r9Bin, r9Min, r9Max);
0512   h_r1Bkg_[2] = iBooker.book1D(histname + "Endcap", " Bkg photon e1x5/e5x5: Endcap ", r9Bin, r9Min, r9Max);
0513   //
0514   histname = "R1VsEtaBkg";
0515   if (!isRunCentrally_)
0516     h2_r1VsEtaBkg_ = iBooker.book2D(
0517         histname + "All", " Bkg photons e1x5/e5x5 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
0518   histname = "pR1VsEtaBkg";
0519   if (!isRunCentrally_)
0520     p_r1VsEtaBkg_ = iBooker.bookProfile(
0521         histname + "All", " Bkg photons e1x5/e5x5 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
0522   //
0523   histname = "R1VsEtBkg";
0524   if (!isRunCentrally_)
0525     h2_r1VsEtBkg_ =
0526         iBooker.book2D(histname + "All", " Bkg photons e1x5/e5x5 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
0527   histname = "pR1VsEtBkg";
0528   if (!isRunCentrally_)
0529     p_r1VsEtBkg_ = iBooker.bookProfile(
0530         histname + "All", " Bkg photons e2x5/e5x5 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
0531   //
0532   histname = "r2Bkg";
0533   h_r2Bkg_[0] = iBooker.book1D(histname + "All", " Bkg photon e2x5/e5x5: All Ecal", r9Bin, r9Min, r9Max);
0534   h_r2Bkg_[1] = iBooker.book1D(histname + "Barrel", " Bkg photon e2x5/e5x5: Barrel ", r9Bin, r9Min, r9Max);
0535   h_r2Bkg_[2] = iBooker.book1D(histname + "Endcap", " Bkg photon e2x5/e5x5: Endcap ", r9Bin, r9Min, r9Max);
0536   //
0537   histname = "R2VsEtaBkg";
0538   if (!isRunCentrally_)
0539     h2_r2VsEtaBkg_ = iBooker.book2D(
0540         histname + "All", " Bkg photons e2x5/e5x5 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
0541   histname = "pR2VsEtaBkg";
0542   if (!isRunCentrally_)
0543     p_r2VsEtaBkg_ = iBooker.bookProfile(
0544         histname + "All", " Bkg photons e2x5/e5x5 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
0545   //
0546   histname = "R2VsEtBkg";
0547   if (!isRunCentrally_)
0548     h2_r2VsEtBkg_ =
0549         iBooker.book2D(histname + "All", " Bkg photons e2x5/e5x5 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
0550   histname = "pR2VsEtBkg";
0551   if (!isRunCentrally_)
0552     p_r2VsEtBkg_ = iBooker.bookProfile(
0553         histname + "All", " Bkg photons e2x5/e5x5 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
0554 
0555   histname = "sigmaIetaIetaBkg";
0556   h_sigmaIetaIetaBkg_[0] = iBooker.book1D(histname + "All", "Bkg sigmaIetaIeta: All Ecal", 100, 0., 0.1);
0557   h_sigmaIetaIetaBkg_[1] = iBooker.book1D(histname + "Barrel", "Bkg sigmaIetaIeta: Barrel ", 100, 0., 0.05);
0558   h_sigmaIetaIetaBkg_[2] = iBooker.book1D(histname + "Endcap", "Bkg sigmaIetaIeta: Endcap ", 100, 0., 0.1);
0559   //
0560   histname = "sigmaIetaIetaVsEtaBkg";
0561   if (!isRunCentrally_)
0562     h2_sigmaIetaIetaVsEtaBkg_ = iBooker.book2D(
0563         histname + "All", " Bkg photons sigmaIetaIeta vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
0564   histname = "pSigmaIetaIetaVsEtaBkg";
0565   if (!isRunCentrally_)
0566     p_sigmaIetaIetaVsEtaBkg_ = iBooker.bookProfile(
0567         histname + "All", " Bkg photons sigmaIetaIeta vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
0568   //
0569   histname = "sigmaIetaIetaVsEtBkg";
0570   if (!isRunCentrally_)
0571     h2_sigmaIetaIetaVsEtBkg_[0] = iBooker.book2D(
0572         histname + "All", " Bkg photons sigmaIetaIeta vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
0573   if (!isRunCentrally_)
0574     h2_sigmaIetaIetaVsEtBkg_[1] = iBooker.book2D(
0575         histname + "Barrel", " Bkg photons sigmaIetaIeta vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
0576   if (!isRunCentrally_)
0577     h2_sigmaIetaIetaVsEtBkg_[2] = iBooker.book2D(
0578         histname + "Endcap", " Bkg photons sigmaIetaIeta vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
0579   //
0580   histname = "pSigmaIetaIetaVsEtBkg";
0581   if (!isRunCentrally_)
0582     p_sigmaIetaIetaVsEtBkg_[0] = iBooker.bookProfile(
0583         histname + "All", " Bkg photons sigmaIetaIeta vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
0584   if (!isRunCentrally_)
0585     p_sigmaIetaIetaVsEtBkg_[1] = iBooker.bookProfile(
0586         histname + "Barrel", " Bkg photons sigmaIetaIeta vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
0587   if (!isRunCentrally_)
0588     p_sigmaIetaIetaVsEtBkg_[2] = iBooker.bookProfile(
0589         histname + "Endcap", " Bkg photons sigmaIetaIeta vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
0590   //
0591   histname = "hOverEBkg";
0592   h_hOverEBkg_[0] = iBooker.book1D(histname + "All", "H/E bkg: All Ecal", 100, 0., 1.);
0593   h_hOverEBkg_[1] = iBooker.book1D(histname + "Barrel", "H/E bkg: Barrel ", 100, 0., 1.);
0594   h_hOverEBkg_[2] = iBooker.book1D(histname + "Endcap", "H/E bkg: Endcap ", 100, 0., 1.);
0595   //
0596   histname = "pHOverEVsEtaBkg";
0597   if (!isRunCentrally_)
0598     p_hOverEVsEtaBkg_ =
0599         iBooker.bookProfile(histname + "All", " Bkg H/E vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
0600   histname = "pHOverEVsEtBkg";
0601   if (!isRunCentrally_)
0602     p_hOverEVsEtBkg_ =
0603         iBooker.bookProfile(histname + "All", " Bkg photons H/E vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
0604   if (!isRunCentrally_) {
0605     histname = "hOverEVsEtaBkg";
0606     h2_hOverEVsEtaBkg_ =
0607         iBooker.book2D(histname + "All", " Bkg H/E vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
0608     //
0609     histname = "hOverEVsEtBkg";
0610     h2_hOverEVsEtBkg_ =
0611         iBooker.book2D(histname + "All", " Bkg photons H/E vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
0612   }
0613   //
0614   histname = "ecalRecHitSumEtConeDR04Bkg";
0615   h_ecalRecHitSumEtConeDR04Bkg_[0] =
0616       iBooker.book1D(histname + "All", "bkg ecalRecHitSumEtDR04: All Ecal", etBin, etMin, 50.);
0617   h_ecalRecHitSumEtConeDR04Bkg_[1] =
0618       iBooker.book1D(histname + "Barrel", "bkg ecalRecHitSumEtDR04: Barrel ", etBin, etMin, 50.);
0619   h_ecalRecHitSumEtConeDR04Bkg_[2] =
0620       iBooker.book1D(histname + "Endcap", "bkg ecalRecHitSumEtDR04: Endcap ", etBin, etMin, 50.);
0621   //
0622   if (!isRunCentrally_) {
0623     histname = "ecalRecHitSumEtConeDR04VsEtaBkg";
0624     h2_ecalRecHitSumEtConeDR04VsEtaBkg_ = iBooker.book2D(histname + "All",
0625                                                          " bkg ecalRecHitSumEtDR04 vs #eta: all Ecal ",
0626                                                          etaBin2,
0627                                                          etaMin,
0628                                                          etaMax,
0629                                                          etBin,
0630                                                          etMin,
0631                                                          etMax * etScale);
0632     histname = "ecalRecHitSumEtConeDR04VsEtBkg";
0633     h2_ecalRecHitSumEtConeDR04VsEtBkg_[0] = iBooker.book2D(histname + "All",
0634                                                            " Bkg ecalRecHitSumEtDR04 vs Et: all Ecal ",
0635                                                            etBin,
0636                                                            etMin,
0637                                                            etMax,
0638                                                            etBin,
0639                                                            etMin,
0640                                                            etMax * etScale);
0641     h2_ecalRecHitSumEtConeDR04VsEtBkg_[1] = iBooker.book2D(histname + "Barrel",
0642                                                            " Bkg ecalRecHitSumEtDR04 vs Et: Barrel ",
0643                                                            etBin,
0644                                                            etMin,
0645                                                            etMax,
0646                                                            etBin,
0647                                                            etMin,
0648                                                            etMax * etScale);
0649     h2_ecalRecHitSumEtConeDR04VsEtBkg_[2] = iBooker.book2D(histname + "Endcap",
0650                                                            " Bkg ecalRecHitSumEtDR04 vs Et: Endcap ",
0651                                                            etBin,
0652                                                            etMin,
0653                                                            etMax,
0654                                                            etBin,
0655                                                            etMin,
0656                                                            etMax * etScale);
0657     histname = "hcalTowerSumEtConeDR04VsEtaBkg";
0658     h2_hcalTowerSumEtConeDR04VsEtaBkg_ = iBooker.book2D(histname + "All",
0659                                                         " bkg hcalTowerSumEtDR04 vs #eta: all Ecal ",
0660                                                         etaBin2,
0661                                                         etaMin,
0662                                                         etaMax,
0663                                                         etBin,
0664                                                         etMin,
0665                                                         etMax * etScale);
0666     histname = "hcalTowerSumEtConeDR04VsEtBkg";
0667     h2_hcalTowerSumEtConeDR04VsEtBkg_[0] = iBooker.book2D(histname + "All",
0668                                                           " Bkg hcalTowerSumEtDR04 vs Et: all Ecal ",
0669                                                           etBin,
0670                                                           etMin,
0671                                                           etMax,
0672                                                           etBin,
0673                                                           etMin,
0674                                                           etMax * etScale);
0675     h2_hcalTowerSumEtConeDR04VsEtBkg_[1] = iBooker.book2D(histname + "Barrel",
0676                                                           " Bkg hcalTowerSumEtDR04 vs Et: Barrel ",
0677                                                           etBin,
0678                                                           etMin,
0679                                                           etMax,
0680                                                           etBin,
0681                                                           etMin,
0682                                                           etMax * etScale);
0683     h2_hcalTowerSumEtConeDR04VsEtBkg_[2] = iBooker.book2D(histname + "Endcap",
0684                                                           " Bkg hcalTowerSumEtDR04 vs Et: Endcap ",
0685                                                           etBin,
0686                                                           etMin,
0687                                                           etMax,
0688                                                           etBin,
0689                                                           etMin,
0690                                                           etMax * etScale);
0691   }
0692 
0693   histname = "pEcalRecHitSumEtConeDR04VsEtaBkg";
0694   if (!isRunCentrally_)
0695     p_ecalRecHitSumEtConeDR04VsEtaBkg_ = iBooker.bookProfile(histname + "All",
0696                                                              "bkg photons ecalRecHitSumEtDR04 vs #eta: all Ecal ",
0697                                                              etaBin2,
0698                                                              etaMin,
0699                                                              etaMax,
0700                                                              etBin,
0701                                                              etMin,
0702                                                              etMax * etScale,
0703                                                              "");
0704   //
0705   histname = "pEcalRecHitSumEtConeDR04VsEtBkg";
0706   if (!isRunCentrally_)
0707     p_ecalRecHitSumEtConeDR04VsEtBkg_[0] = iBooker.bookProfile(histname + "All",
0708                                                                "Bkg ecalRecHitSumEtDR04 vs Et: all Ecal ",
0709                                                                etBin,
0710                                                                etMin,
0711                                                                etMax,
0712                                                                etBin,
0713                                                                etMin,
0714                                                                etMax * etScale,
0715                                                                "");
0716   if (!isRunCentrally_)
0717     p_ecalRecHitSumEtConeDR04VsEtBkg_[1] = iBooker.bookProfile(histname + "Barrel",
0718                                                                "Bkg ecalRecHitSumEtDR04 vs Et: all Ecal ",
0719                                                                etBin,
0720                                                                etMin,
0721                                                                etMax,
0722                                                                etBin,
0723                                                                etMin,
0724                                                                etMax * etScale,
0725                                                                "");
0726   if (!isRunCentrally_)
0727     p_ecalRecHitSumEtConeDR04VsEtBkg_[2] = iBooker.bookProfile(histname + "Endcap",
0728                                                                "Bkg ecalRecHitSumEtDR04 vs Et: all Ecal ",
0729                                                                etBin,
0730                                                                etMin,
0731                                                                etMax,
0732                                                                etBin,
0733                                                                etMin,
0734                                                                etMax * etScale,
0735                                                                "");
0736   //
0737   histname = "hcalTowerSumEtConeDR04Bkg";
0738   h_hcalTowerSumEtConeDR04Bkg_[0] =
0739       iBooker.book1D(histname + "All", "bkg hcalTowerSumEtDR04: All Ecal", etBin, etMin, 20.);
0740   h_hcalTowerSumEtConeDR04Bkg_[1] =
0741       iBooker.book1D(histname + "Barrel", "bkg hcalTowerSumEtDR04: Barrel ", etBin, etMin, 20.);
0742   h_hcalTowerSumEtConeDR04Bkg_[2] =
0743       iBooker.book1D(histname + "Endcap", "bkg hcalTowerSumEtDR04: Endcap ", etBin, etMin, 20.);
0744   //
0745   histname = "pHcalTowerSumEtConeDR04VsEtaBkg";
0746   if (!isRunCentrally_)
0747     p_hcalTowerSumEtConeDR04VsEtaBkg_ = iBooker.bookProfile(histname + "All",
0748                                                             "bkg photons hcalTowerSumEtDR04 vs #eta: all Ecal ",
0749                                                             etaBin2,
0750                                                             etaMin,
0751                                                             etaMax,
0752                                                             etBin,
0753                                                             etMin,
0754                                                             etMax * etScale,
0755                                                             "");
0756   //
0757   histname = "pHcalTowerSumEtConeDR04VsEtBkg";
0758   if (!isRunCentrally_)
0759     p_hcalTowerSumEtConeDR04VsEtBkg_[0] = iBooker.bookProfile(histname + "All",
0760                                                               "Bkg hcalTowerSumEtDR04 vs Et: all Ecal ",
0761                                                               etBin,
0762                                                               etMin,
0763                                                               etMax,
0764                                                               etBin,
0765                                                               etMin,
0766                                                               etMax * etScale,
0767                                                               "");
0768   if (!isRunCentrally_)
0769     p_hcalTowerSumEtConeDR04VsEtBkg_[1] = iBooker.bookProfile(histname + "Barrel",
0770                                                               "Bkg hcalTowerSumEtDR04 vs Et: all Ecal ",
0771                                                               etBin,
0772                                                               etMin,
0773                                                               etMax,
0774                                                               etBin,
0775                                                               etMin,
0776                                                               etMax * etScale,
0777                                                               "");
0778   if (!isRunCentrally_)
0779     p_hcalTowerSumEtConeDR04VsEtBkg_[2] = iBooker.bookProfile(histname + "Endcap",
0780                                                               "Bkg hcalTowerSumEtDR04 vs Et: all Ecal ",
0781                                                               etBin,
0782                                                               etMin,
0783                                                               etMax,
0784                                                               etBin,
0785                                                               etMin,
0786                                                               etMax * etScale,
0787                                                               "");
0788   //
0789   histname = "isoTrkSolidConeDR04Bkg";
0790   h_isoTrkSolidConeDR04Bkg_[0] =
0791       iBooker.book1D(histname + "All", "isoTrkSolidConeDR04 Bkg: All Ecal", etBin, etMin, etMax * 0.1);
0792   h_isoTrkSolidConeDR04Bkg_[1] =
0793       iBooker.book1D(histname + "Barrel", "isoTrkSolidConeDR04 Bkg: Barrel ", etBin, etMin, etMax * 0.1);
0794   h_isoTrkSolidConeDR04Bkg_[2] =
0795       iBooker.book1D(histname + "Endcap", "isoTrkSolidConeDR04 Bkg: Endcap ", etBin, etMin, etMax * 0.1);
0796   //
0797   histname = "isoTrkSolidConeDR04VsEtaBkg";
0798   if (!isRunCentrally_)
0799     h2_isoTrkSolidConeDR04VsEtaBkg_ = iBooker.book2D(histname + "All",
0800                                                      " Bkg photons isoTrkSolidConeDR04 vs #eta: all Ecal ",
0801                                                      etaBin2,
0802                                                      etaMin,
0803                                                      etaMax,
0804                                                      etBin,
0805                                                      etMin,
0806                                                      etMax * 0.1);
0807   histname = "pIsoTrkSolidConeDR04VsEtaBkg";
0808   if (!isRunCentrally_)
0809     p_isoTrkSolidConeDR04VsEtaBkg_ = iBooker.bookProfile(histname + "All",
0810                                                          " Bkg photons isoTrkSolidConeDR04 vs #eta: all Ecal ",
0811                                                          etaBin2,
0812                                                          etaMin,
0813                                                          etaMax,
0814                                                          etBin,
0815                                                          etMin,
0816                                                          etMax * 0.1);
0817   //
0818   histname = "isoTrkSolidConeDR04VsEtBkg";
0819   if (!isRunCentrally_)
0820     h2_isoTrkSolidConeDR04VsEtBkg_[0] = iBooker.book2D(histname + "All",
0821                                                        " Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",
0822                                                        etBin,
0823                                                        etMin,
0824                                                        etMax,
0825                                                        etBin,
0826                                                        etMin,
0827                                                        etMax * 0.1);
0828   if (!isRunCentrally_)
0829     h2_isoTrkSolidConeDR04VsEtBkg_[1] = iBooker.book2D(histname + "Barrel",
0830                                                        " Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",
0831                                                        etBin,
0832                                                        etMin,
0833                                                        etMax,
0834                                                        etBin,
0835                                                        etMin,
0836                                                        etMax * 0.1);
0837   if (!isRunCentrally_)
0838     h2_isoTrkSolidConeDR04VsEtBkg_[2] = iBooker.book2D(histname + "Endcap",
0839                                                        " Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",
0840                                                        etBin,
0841                                                        etMin,
0842                                                        etMax,
0843                                                        etBin,
0844                                                        etMin,
0845                                                        etMax * 0.1);
0846   histname = "pIsoTrkSolidConeDR04VsEtBkg";
0847   if (!isRunCentrally_)
0848     p_isoTrkSolidConeDR04VsEtBkg_[0] = iBooker.bookProfile(histname + "All",
0849                                                            " Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",
0850                                                            etBin,
0851                                                            etMin,
0852                                                            etMax,
0853                                                            etBin,
0854                                                            etMin,
0855                                                            etMax * 0.1);
0856   if (!isRunCentrally_)
0857     p_isoTrkSolidConeDR04VsEtBkg_[1] = iBooker.bookProfile(histname + "Barrel",
0858                                                            " Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",
0859                                                            etBin,
0860                                                            etMin,
0861                                                            etMax,
0862                                                            etBin,
0863                                                            etMin,
0864                                                            etMax * 0.1);
0865   if (!isRunCentrally_)
0866     p_isoTrkSolidConeDR04VsEtBkg_[2] = iBooker.bookProfile(histname + "Endcap",
0867                                                            " Bkg photons isoTrkSolidConeDR04 vs Et: all Ecal ",
0868                                                            etBin,
0869                                                            etMin,
0870                                                            etMax,
0871                                                            etBin,
0872                                                            etMin,
0873                                                            etMax * 0.1);
0874   //
0875   histname = "nTrkSolidConeDR04Bkg";
0876   h_nTrkSolidConeDR04Bkg_[0] = iBooker.book1D(histname + "All", "Bkg nTrkSolidConeDR04: All Ecal", 20, 0., 20);
0877   h_nTrkSolidConeDR04Bkg_[1] = iBooker.book1D(histname + "Barrel", "Bkg nTrkSolidConeDR04: Barrel ", 20, 0., 20);
0878   h_nTrkSolidConeDR04Bkg_[2] = iBooker.book1D(histname + "Endcap", "Bkg nTrkSolidConeDR04: Endcap ", 20, 0., 20);
0879   //
0880   histname = "nTrkSolidConeDR04VsEtaBkg";
0881   if (!isRunCentrally_)
0882     h2_nTrkSolidConeDR04VsEtaBkg_ = iBooker.book2D(
0883         histname + "All", " Bkg photons nTrkSolidConeDR04 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 20, 0., 20);
0884   histname = "p_nTrkSolidConeDR04VsEtaBkg";
0885   if (!isRunCentrally_)
0886     p_nTrkSolidConeDR04VsEtaBkg_ = iBooker.bookProfile(
0887         histname + "All", " Bkg photons nTrkSolidConeDR04 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 20, 0., 20);
0888   //
0889   histname = "nTrkSolidConeDR04VsEtBkg";
0890   if (!isRunCentrally_)
0891     h2_nTrkSolidConeDR04VsEtBkg_[0] = iBooker.book2D(
0892         histname + "All", "Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ", etBin, etMin, etMax, 20, 0., 20);
0893   if (!isRunCentrally_)
0894     h2_nTrkSolidConeDR04VsEtBkg_[1] = iBooker.book2D(
0895         histname + "Barrel", "Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ", etBin, etMin, etMax, 20, 0., 20);
0896   if (!isRunCentrally_)
0897     h2_nTrkSolidConeDR04VsEtBkg_[2] = iBooker.book2D(
0898         histname + "Endcap", "Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ", etBin, etMin, etMax, 20, 0., 20);
0899   //
0900   histname = "pnTrkSolidConeDR04VsEtBkg";
0901   if (!isRunCentrally_)
0902     p_nTrkSolidConeDR04VsEtBkg_[0] = iBooker.bookProfile(
0903         histname + "All", "Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ", etBin, etMin, etMax, 20, 0., 20);
0904   if (!isRunCentrally_)
0905     p_nTrkSolidConeDR04VsEtBkg_[1] = iBooker.bookProfile(
0906         histname + "Barrel", "Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ", etBin, etMin, etMax, 20, 0., 20);
0907   if (!isRunCentrally_)
0908     p_nTrkSolidConeDR04VsEtBkg_[2] = iBooker.bookProfile(
0909         histname + "Endcap", "Bkg photons nTrkSolidConeDR04 vs Et: all Ecal ", etBin, etMin, etMax, 20, 0., 20);
0910   //
0911   h_convEtaBkg_ = iBooker.book1D("convEtaBkg", " converted Photon Bkg Eta 2 tracks", etaBin, etaMin, etaMax);
0912   h_convPhiBkg_ = iBooker.book1D("convPhiBkg", " converted Photon Bkg Phi ", phiBin, phiMin, phiMax);
0913   //
0914   histname = "mvaOutBkg";
0915   h_mvaOutBkg_[0] = iBooker.book1D(histname + "All", " mvaOut  conversions bkg : All Ecal", 100, 0., 1.);
0916   h_mvaOutBkg_[1] = iBooker.book1D(histname + "Barrel", " mvaOut conversions bkg: Barrel Ecal", 100, 0., 1.);
0917   h_mvaOutBkg_[2] = iBooker.book1D(histname + "Endcap", " mvaOut  conversions bkg: Endcap Ecal", 100, 0., 1.);
0918 
0919   histname = "PoverEtracksBkg";
0920   h_PoverETracksBkg_[0] =
0921       iBooker.book1D(histname + "All", " bkg photons conversion p/E: all Ecal ", povereBin, povereMin, povereMax);
0922   h_PoverETracksBkg_[1] =
0923       iBooker.book1D(histname + "Barrel", "bkg photons conversion p/E: Barrel Ecal", povereBin, povereMin, povereMax);
0924   h_PoverETracksBkg_[2] =
0925       iBooker.book1D(histname + "Endcap", " bkg photons conversion p/E: Endcap Ecal ", povereBin, povereMin, povereMax);
0926 
0927   histname = "EoverPtracksBkg";
0928   h_EoverPTracksBkg_[0] =
0929       iBooker.book1D(histname + "All", " bkg photons conversion E/p: all Ecal ", eoverpBin, eoverpMin, eoverpMax);
0930   h_EoverPTracksBkg_[1] =
0931       iBooker.book1D(histname + "Barrel", "bkg photons conversion E/p: Barrel Ecal", eoverpBin, eoverpMin, eoverpMax);
0932   h_EoverPTracksBkg_[2] =
0933       iBooker.book1D(histname + "Endcap", " bkg photons conversion E/p: Endcap Ecal ", eoverpBin, eoverpMin, eoverpMax);
0934 
0935   histname = "hDCotTracksBkg";
0936   h_DCotTracksBkg_[0] = iBooker.book1D(histname + "All",
0937                                        " bkg Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",
0938                                        dCotTracksBin,
0939                                        dCotTracksMin,
0940                                        dCotTracksMax);
0941   h_DCotTracksBkg_[1] = iBooker.book1D(histname + "Barrel",
0942                                        " bkg Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",
0943                                        dCotTracksBin,
0944                                        dCotTracksMin,
0945                                        dCotTracksMax);
0946   h_DCotTracksBkg_[2] = iBooker.book1D(histname + "Endcap",
0947                                        " bkg Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",
0948                                        dCotTracksBin,
0949                                        dCotTracksMin,
0950                                        dCotTracksMax);
0951 
0952   histname = "hDPhiTracksAtVtxBkg";
0953   h_DPhiTracksAtVtxBkg_[0] =
0954       iBooker.book1D(histname + "All",
0955                      " Bkg Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",
0956                      dPhiTracksBin,
0957                      dPhiTracksMin,
0958                      dPhiTracksMax);
0959   h_DPhiTracksAtVtxBkg_[1] =
0960       iBooker.book1D(histname + "Barrel",
0961                      " Bkg Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",
0962                      dPhiTracksBin,
0963                      dPhiTracksMin,
0964                      dPhiTracksMax);
0965   h_DPhiTracksAtVtxBkg_[2] =
0966       iBooker.book1D(histname + "Endcap",
0967                      " Bkg Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",
0968                      dPhiTracksBin,
0969                      dPhiTracksMin,
0970                      dPhiTracksMax);
0971 
0972   if (!isRunCentrally_) {
0973     h_convVtxRvsZBkg_[0] = iBooker.book2D("convVtxRvsZAllBkg",
0974                                           " Bkg Photon Reco conversion vtx position",
0975                                           zBinForXray,
0976                                           zMinForXray,
0977                                           zMaxForXray,
0978                                           rBinForXray,
0979                                           rMinForXray,
0980                                           rMaxForXray);
0981     h_convVtxRvsZBkg_[1] = iBooker.book2D("convVtxRvsZBarrelBkg",
0982                                           " Bkg Photon Reco conversion vtx position",
0983                                           zBinForXray,
0984                                           zMinForXray,
0985                                           zMaxForXray,
0986                                           rBinForXray,
0987                                           rMinForXray,
0988                                           rMaxForXray);
0989     h_convVtxYvsXBkg_ = iBooker.book2D("convVtxYvsXTrkBarrelBkg",
0990                                        " Bkg Photon Reco conversion vtx position, (x,y) eta<1 ",
0991                                        100,
0992                                        -80.,
0993                                        80.,
0994                                        100,
0995                                        -80.,
0996                                        80.);
0997   }
0998 
0999   //
1000   iBooker.setCurrentFolder("EgammaV/" + fName_ + "/Photons");
1001 
1002   histname = "nOfflineVtx";
1003   h_nRecoVtx_ = iBooker.book1D(histname, "# of Offline Vertices", 200, -0.5, 199.5);
1004 
1005   h_phoEta_[0] = iBooker.book1D("phoEta", " Photon Eta ", etaBin, etaMin, etaMax);
1006   h_phoPhi_[0] = iBooker.book1D("phoPhi", " Photon  Phi ", phiBin, phiMin, phiMax);
1007 
1008   h_phoDEta_[0] = iBooker.book1D("phoDEta", " Photon Eta(rec)-Eta(true) ", dEtaBin, dEtaMin, dEtaMax);
1009   h_phoDPhi_[0] = iBooker.book1D("phoDPhi", " Photon  Phi(rec)-Phi(true) ", dPhiBin, dPhiMin, dPhiMax);
1010 
1011   h_scEta_[0] = iBooker.book1D("scEta", " SC Eta ", etaBin, etaMin, etaMax);
1012   h_scPhi_[0] = iBooker.book1D("scPhi", " SC Phi ", phiBin, phiMin, phiMax);
1013 
1014   if (!isRunCentrally_) {
1015     h_scEtaWidth_[0] = iBooker.book1D("scEtaWidth", " SC Eta Width ", 100, 0., 0.1);
1016     h_scPhiWidth_[0] = iBooker.book1D("scPhiWidth", " SC Phi Width ", 100, 0., 1.);
1017   }
1018 
1019   histname = "scE";
1020   h_scE_[0][0] = iBooker.book1D(histname + "All", " SC Energy: All Ecal  ", eBin, eMin, eMax);
1021   h_scE_[0][1] = iBooker.book1D(histname + "Barrel", " SC Energy: Barrel ", eBin, eMin, eMax);
1022   h_scE_[0][2] = iBooker.book1D(histname + "Endcap", " SC Energy: Endcap ", eBin, eMin, eMax);
1023 
1024   histname = "psE";
1025   h_psE_ = iBooker.book1D(histname + "Endcap", " ES Energy  ", eBin, eMin, 50.);
1026 
1027   histname = "scEt";
1028   h_scEt_[0][0] = iBooker.book1D(histname + "All", " SC Et: All Ecal ", etBin, etMin, etMax);
1029   h_scEt_[0][1] = iBooker.book1D(histname + "Barrel", " SC Et: Barrel", etBin, etMin, etMax);
1030   h_scEt_[0][2] = iBooker.book1D(histname + "Endcap", " SC Et: Endcap", etBin, etMin, etMax);
1031 
1032   histname = "r9";
1033   h_r9_[0][0] = iBooker.book1D(histname + "All", " r9: All Ecal", r9Bin, r9Min, r9Max);
1034   h_r9_[0][1] = iBooker.book1D(histname + "Barrel", " r9: Barrel ", r9Bin, r9Min, r9Max);
1035   h_r9_[0][2] = iBooker.book1D(histname + "Endcap", " r9: Endcap ", r9Bin, r9Min, r9Max);
1036   //
1037 
1038   if (!isRunCentrally_) {
1039     histname = "r9ConvFromMC";
1040     h_r9_[1][0] = iBooker.book1D(histname + "All", " r9: All Ecal", r9Bin, r9Min, r9Max);
1041     h_r9_[1][1] = iBooker.book1D(histname + "Barrel", " r9: Barrel ", r9Bin, r9Min, r9Max);
1042     h_r9_[1][2] = iBooker.book1D(histname + "Endcap", " r9: Endcap ", r9Bin, r9Min, r9Max);
1043     //
1044     histname = "r9ConvFromReco";
1045     h_r9_[2][0] = iBooker.book1D(histname + "All", " r9: All Ecal", r9Bin, r9Min, r9Max);
1046     h_r9_[2][1] = iBooker.book1D(histname + "Barrel", " r9: Barrel ", r9Bin, r9Min, r9Max);
1047     h_r9_[2][2] = iBooker.book1D(histname + "Endcap", " r9: Endcap ", r9Bin, r9Min, r9Max);
1048     //////
1049     histname = "EtR9Less093";
1050     h_EtR9Less093_[0][0] = iBooker.book1D(histname + "All", " r9 < 0.94 or 0.95 : All Ecal", etBin, etMin, etMax);
1051     h_EtR9Less093_[0][1] = iBooker.book1D(histname + "Barrel", " r9 < 0.94 : Barrel ", etBin, etMin, etMax);
1052     h_EtR9Less093_[0][2] = iBooker.book1D(histname + "Endcap", " r9 < 0.95 : Endcap ", etBin, etMin, etMax);
1053     histname = "EtR9Less093Conv";
1054     h_EtR9Less093_[1][0] =
1055         iBooker.book1D(histname + "All", " r9 < 0.94, 0.95 and good conv : All Ecal", etBin, etMin, etMax);
1056     h_EtR9Less093_[1][1] =
1057         iBooker.book1D(histname + "Barrel", " r9 < 0.94 and good conv : Barrel ", etBin, etMin, etMax);
1058     h_EtR9Less093_[1][2] =
1059         iBooker.book1D(histname + "Endcap", " r9 < 0.95 and good conv : Endcap ", etBin, etMin, etMax);
1060   }
1061 
1062   /////    //
1063   histname = "pR9VsEta";
1064   p_r9VsEta_[0] = iBooker.bookProfile(
1065       histname + "All", " All photons r9 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
1066   p_r9VsEta_[1] = iBooker.bookProfile(
1067       histname + "Unconv", " Unconv photons r9 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
1068   p_r9VsEta_[2] = iBooker.bookProfile(
1069       histname + "Conv", " Conv photons r9 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
1070   //
1071   histname = "R9VsEt";
1072   if (!isRunCentrally_)
1073     h2_r9VsEt_[0] =
1074         iBooker.book2D(histname + "All", " All photons r9 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
1075   if (!isRunCentrally_)
1076     h2_r9VsEt_[1] =
1077         iBooker.book2D(histname + "Unconv", " All photons r9 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
1078   //
1079   histname = "r1";
1080   h_r1_[0][0] = iBooker.book1D(histname + "All", " e1x5/e5x5: All Ecal", r9Bin, r9Min, r9Max);
1081   h_r1_[0][1] = iBooker.book1D(histname + "Barrel", " e1x5/e5x5: Barrel ", r9Bin, r9Min, r9Max);
1082   h_r1_[0][2] = iBooker.book1D(histname + "Endcap", " e1x5/e5x5: Endcap ", r9Bin, r9Min, r9Max);
1083   //
1084   histname = "R1VsEta";
1085   if (!isRunCentrally_)
1086     h2_r1VsEta_[0] = iBooker.book2D(
1087         histname + "All", " All photons e1x5/e5x5 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
1088   if (!isRunCentrally_)
1089     h2_r1VsEta_[1] = iBooker.book2D(
1090         histname + "Unconv", " All photons e1x5/e5x5 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
1091   //
1092   histname = "R1VsEt";
1093   if (!isRunCentrally_)
1094     h2_r1VsEt_[0] =
1095         iBooker.book2D(histname + "All", " All photons e1x5/e5x5 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
1096   if (!isRunCentrally_)
1097     h2_r1VsEt_[1] = iBooker.book2D(
1098         histname + "Unconv", " All photons e1x5/e5x5 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
1099   //
1100   histname = "r2";
1101   h_r2_[0][0] = iBooker.book1D(histname + "All", " e2x5/e5x5: All Ecal", r9Bin, r9Min, r9Max);
1102   h_r2_[0][1] = iBooker.book1D(histname + "Barrel", " e2x5/e5x5: Barrel ", r9Bin, r9Min, r9Max);
1103   h_r2_[0][2] = iBooker.book1D(histname + "Endcap", " e2x5/e5x5: Endcap ", r9Bin, r9Min, r9Max);
1104   //
1105   histname = "R2VsEta";
1106   if (!isRunCentrally_)
1107     h2_r2VsEta_[0] = iBooker.book2D(
1108         histname + "All", " All photons e2x5/e5x5 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
1109   if (!isRunCentrally_)
1110     h2_r2VsEta_[1] = iBooker.book2D(
1111         histname + "Unconv", " All photons e2x5/e5x5 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 1.1);
1112   //
1113   histname = "R2VsEt";
1114   if (!isRunCentrally_)
1115     h2_r2VsEt_[0] =
1116         iBooker.book2D(histname + "All", " All photons e2x5/e5x5 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
1117   if (!isRunCentrally_)
1118     h2_r2VsEt_[1] = iBooker.book2D(
1119         histname + "Unconv", " All photons e2x5/e5x5 vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 1.1);
1120   //
1121   histname = "sigmaIetaIeta";
1122   h_sigmaIetaIeta_[0][0] = iBooker.book1D(histname + "All", "sigmaIetaIeta: All Ecal", 100, 0., 0.1);
1123   h_sigmaIetaIeta_[0][1] = iBooker.book1D(histname + "Barrel", "sigmaIetaIeta: Barrel ", 100, 0., 0.05);
1124   h_sigmaIetaIeta_[0][2] = iBooker.book1D(histname + "Endcap", "sigmaIetaIeta: Endcap ", 100, 0., 0.1);
1125   //
1126   histname = "sigmaIetaIetaVsEta";
1127   if (!isRunCentrally_)
1128     h2_sigmaIetaIetaVsEta_[0] = iBooker.book2D(
1129         histname + "All", " All photons sigmaIetaIeta vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
1130   if (!isRunCentrally_)
1131     h2_sigmaIetaIetaVsEta_[1] = iBooker.book2D(
1132         histname + "Unconv", " All photons sigmaIetaIeta vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
1133   //
1134   histname = "sigmaIetaIetaVsEt";
1135   if (!isRunCentrally_)
1136     h2_sigmaIetaIetaVsEt_[0] = iBooker.book2D(
1137         histname + "All", " All photons sigmaIetaIeta vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
1138   if (!isRunCentrally_)
1139     h2_sigmaIetaIetaVsEt_[1] = iBooker.book2D(
1140         histname + "Unconv", " All photons sigmaIetaIeta vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
1141   //
1142   histname = "hOverE";
1143   h_hOverE_[0][0] = iBooker.book1D(histname + "All", "H/E: All Ecal", 100, 0., 0.1);
1144   h_hOverE_[0][1] = iBooker.book1D(histname + "Barrel", "H/E: Barrel ", 100, 0., 0.1);
1145   h_hOverE_[0][2] = iBooker.book1D(histname + "Endcap", "H/E: Endcap ", 100, 0., 0.1);
1146   //
1147   histname = "newhOverE";
1148   h_newhOverE_[0][0] = iBooker.book1D(histname + "All", "new H/E: All Ecal", 100, 0., 0.1);
1149   h_newhOverE_[0][1] = iBooker.book1D(histname + "Barrel", "new H/E: Barrel ", 100, 0., 0.1);
1150   h_newhOverE_[0][2] = iBooker.book1D(histname + "Endcap", "new H/E: Endcap ", 100, 0., 0.1);
1151 
1152   //
1153   if (!isRunCentrally_) {
1154     histname = "hOverEVsEta";
1155     h2_hOverEVsEta_[0] =
1156         iBooker.book2D(histname + "All", " All photons H/E vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
1157     h2_hOverEVsEta_[1] = iBooker.book2D(
1158         histname + "Unconv", " All photons H/E vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
1159     //
1160     histname = "hOverEVsEt";
1161     h2_hOverEVsEt_[0] =
1162         iBooker.book2D(histname + "All", " All photons H/E vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
1163     h2_hOverEVsEt_[1] =
1164         iBooker.book2D(histname + "Unconv", " All photons H/E vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
1165     //
1166   }
1167   histname = "pHoverEVsEta";
1168   p_hOverEVsEta_[0] = iBooker.bookProfile(
1169       histname + "All", " All photons H/E vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
1170   p_hOverEVsEta_[1] = iBooker.bookProfile(
1171       histname + "Unconv", " All photons H/E vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
1172   //
1173   histname = "pHoverEVsEt";
1174   p_hOverEVsEt_[0] =
1175       iBooker.bookProfile(histname + "All", " All photons H/E vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
1176   p_hOverEVsEt_[1] =
1177       iBooker.bookProfile(histname + "Unconv", " All photons H/E vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
1178   //
1179   histname = "pnewHoverEVsEta";
1180   p_newhOverEVsEta_[0] = iBooker.bookProfile(
1181       histname + "All", " All photons new H/E vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
1182   p_newhOverEVsEta_[1] = iBooker.bookProfile(
1183       histname + "Unconv", " All photons new H/E vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 0.1);
1184   //
1185   histname = "pnewHoverEVsEt";
1186   p_newhOverEVsEt_[0] =
1187       iBooker.bookProfile(histname + "All", " All photons new H/E vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
1188   p_newhOverEVsEt_[1] = iBooker.bookProfile(
1189       histname + "Unconv", " All photons new H/E vs Et: all Ecal ", etBin, etMin, etMax, 100, 0., 0.1);
1190   //
1191   histname = "ecalRecHitSumEtConeDR04";
1192   h_ecalRecHitSumEtConeDR04_[0][0] =
1193       iBooker.book1D(histname + "All", "ecalRecHitSumEtDR04: All Ecal", etBin, etMin, 50.);
1194   h_ecalRecHitSumEtConeDR04_[0][1] =
1195       iBooker.book1D(histname + "Barrel", "ecalRecHitSumEtDR04: Barrel ", etBin, etMin, 50.);
1196   h_ecalRecHitSumEtConeDR04_[0][2] =
1197       iBooker.book1D(histname + "Endcap", "ecalRecHitSumEtDR04: Endcap ", etBin, etMin, 50.);
1198   //
1199 
1200   if (!isRunCentrally_) {
1201     histname = "ecalRecHitSumEtConeDR04VsEta";
1202     h2_ecalRecHitSumEtConeDR04VsEta_[0] = iBooker.book2D(histname + "All",
1203                                                          " All photons ecalRecHitSumEtDR04 vs #eta: all Ecal ",
1204                                                          etaBin2,
1205                                                          etaMin,
1206                                                          etaMax,
1207                                                          etBin,
1208                                                          etMin,
1209                                                          etMax * etScale);
1210     h2_ecalRecHitSumEtConeDR04VsEta_[1] = iBooker.book2D(histname + "Unconv",
1211                                                          " All photons ecalRecHitSumEtDR04 vs #eta: all Ecal ",
1212                                                          etaBin2,
1213                                                          etaMin,
1214                                                          etaMax,
1215                                                          etBin,
1216                                                          etMin,
1217                                                          etMax * etScale);
1218   }
1219   histname = "pEcalRecHitSumEtConeDR04VsEta";
1220   p_ecalRecHitSumEtConeDR04VsEta_[0] = iBooker.bookProfile(histname + "All",
1221                                                            "All photons ecalRecHitSumEtDR04 vs #eta: all Ecal ",
1222                                                            etaBin2,
1223                                                            etaMin,
1224                                                            etaMax,
1225                                                            etBin,
1226                                                            etMin,
1227                                                            etMax * etScale,
1228                                                            "");
1229   p_ecalRecHitSumEtConeDR04VsEta_[1] = iBooker.bookProfile(histname + "Unconv",
1230                                                            "All photons ecalRecHitSumEtDR04 vs #eta: all Ecal ",
1231                                                            etaBin2,
1232                                                            etaMin,
1233                                                            etaMax,
1234                                                            etBin,
1235                                                            etMin,
1236                                                            etMax * etScale,
1237                                                            "");
1238   //
1239   if (!isRunCentrally_) {
1240     histname = "ecalRecHitSumEtConeDR04VsEt";
1241     h2_ecalRecHitSumEtConeDR04VsEt_[0] = iBooker.book2D(histname + "All",
1242                                                         " All photons ecalRecHitSumEtDR04 vs Et: all Ecal ",
1243                                                         etBin,
1244                                                         etMin,
1245                                                         etMax,
1246                                                         etBin,
1247                                                         etMin,
1248                                                         etMax * etScale);
1249     h2_ecalRecHitSumEtConeDR04VsEt_[1] = iBooker.book2D(histname + "Barrel",
1250                                                         " All photons ecalRecHitSumEtDR04 vs Et: Barrel ",
1251                                                         etBin,
1252                                                         etMin,
1253                                                         etMax,
1254                                                         etBin,
1255                                                         etMin,
1256                                                         etMax * etScale);
1257     h2_ecalRecHitSumEtConeDR04VsEt_[2] = iBooker.book2D(histname + "Endcap",
1258                                                         " All photons ecalRecHitSumEtDR04 vs Et: Endcap ",
1259                                                         etBin,
1260                                                         etMin,
1261                                                         etMax,
1262                                                         etBin,
1263                                                         etMin,
1264                                                         etMax * etScale);
1265   }
1266   histname = "pEcalRecHitSumEtConeDR04VsEt";
1267   if (!isRunCentrally_)
1268     p_ecalRecHitSumEtConeDR04VsEt_[0] = iBooker.bookProfile(histname + "All",
1269                                                             "All photons ecalRecHitSumEtDR04 vs Et: all Ecal ",
1270                                                             etBin,
1271                                                             etMin,
1272                                                             etMax,
1273                                                             etBin,
1274                                                             etMin,
1275                                                             etMax * etScale,
1276                                                             "");
1277   p_ecalRecHitSumEtConeDR04VsEt_[1] = iBooker.bookProfile(histname + "Barrel",
1278                                                           "All photons ecalRecHitSumEtDR04 vs Et: all Ecal ",
1279                                                           etBin,
1280                                                           etMin,
1281                                                           etMax,
1282                                                           etBin,
1283                                                           etMin,
1284                                                           etMax * etScale,
1285                                                           "");
1286   p_ecalRecHitSumEtConeDR04VsEt_[2] = iBooker.bookProfile(histname + "Endcap",
1287                                                           "All photons ecalRecHitSumEtDR04 vs Et: all Ecal ",
1288                                                           etBin,
1289                                                           etMin,
1290                                                           etMax,
1291                                                           etBin,
1292                                                           etMin,
1293                                                           etMax * etScale,
1294                                                           "");
1295   //
1296   histname = "hcalTowerSumEtConeDR04";
1297   h_hcalTowerSumEtConeDR04_[0][0] =
1298       iBooker.book1D(histname + "All", "hcalTowerSumEtConeDR04: All Ecal", etBin, etMin, 50.);
1299   h_hcalTowerSumEtConeDR04_[0][1] =
1300       iBooker.book1D(histname + "Barrel", "hcalTowerSumEtConeDR04: Barrel ", etBin, etMin, 50.);
1301   h_hcalTowerSumEtConeDR04_[0][2] =
1302       iBooker.book1D(histname + "Endcap", "hcalTowerSumEtConeDR04: Endcap ", etBin, etMin, 50.);
1303   //
1304   histname = "hcalTowerBcSumEtConeDR04";
1305   if (!isRunCentrally_)
1306     h_hcalTowerBcSumEtConeDR04_[0][0] =
1307         iBooker.book1D(histname + "All", "hcalTowerBcSumEtConeDR04: All Ecal", etBin, etMin, 50.);
1308   h_hcalTowerBcSumEtConeDR04_[0][1] =
1309       iBooker.book1D(histname + "Barrel", "hcalTowerBcSumEtConeDR04: Barrel ", etBin, etMin, 50.);
1310   h_hcalTowerBcSumEtConeDR04_[0][2] =
1311       iBooker.book1D(histname + "Endcap", "hcalTowerBcSumEtConeDR04: Endcap ", etBin, etMin, 50.);
1312 
1313   //
1314   if (!isRunCentrally_) {
1315     histname = "hcalTowerSumEtConeDR04VsEta";
1316     h2_hcalTowerSumEtConeDR04VsEta_[0] = iBooker.book2D(histname + "All",
1317                                                         " All photons hcalTowerSumEtConeDR04 vs #eta: all Ecal ",
1318                                                         etaBin2,
1319                                                         etaMin,
1320                                                         etaMax,
1321                                                         etBin,
1322                                                         etMin,
1323                                                         etMax * 0.1);
1324     h2_hcalTowerSumEtConeDR04VsEta_[1] = iBooker.book2D(histname + "Unconv",
1325                                                         " All photons hcalTowerSumEtConeDR04 vs #eta: all Ecal ",
1326                                                         etaBin2,
1327                                                         etaMin,
1328                                                         etaMax,
1329                                                         etBin,
1330                                                         etMin,
1331                                                         etMax * 0.1);
1332   }
1333   histname = "pHcalTowerSumEtConeDR04VsEta";
1334   p_hcalTowerSumEtConeDR04VsEta_[0] = iBooker.bookProfile(histname + "All",
1335                                                           "All photons hcalTowerSumEtDR04 vs #eta: all Ecal ",
1336                                                           etaBin2,
1337                                                           etaMin,
1338                                                           etaMax,
1339                                                           etBin,
1340                                                           etMin,
1341                                                           etMax * 0.1,
1342                                                           "");
1343   p_hcalTowerSumEtConeDR04VsEta_[1] = iBooker.bookProfile(histname + "Unconv",
1344                                                           "All photons hcalTowerSumEtDR04 vs #eta: all Ecal ",
1345                                                           etaBin2,
1346                                                           etaMin,
1347                                                           etaMax,
1348                                                           etBin,
1349                                                           etMin,
1350                                                           etMax * 0.1,
1351                                                           "");
1352   histname = "pHcalTowerBcSumEtConeDR04VsEta";
1353   p_hcalTowerBcSumEtConeDR04VsEta_[0] = iBooker.bookProfile(histname + "All",
1354                                                             "All photons hcalTowerBcSumEtDR04 vs #eta: all Ecal ",
1355                                                             etaBin2,
1356                                                             etaMin,
1357                                                             etaMax,
1358                                                             etBin,
1359                                                             etMin,
1360                                                             etMax * 0.1,
1361                                                             "");
1362   p_hcalTowerBcSumEtConeDR04VsEta_[1] = iBooker.bookProfile(histname + "Unconv",
1363                                                             "All photons hcalTowerBcSumEtDR04 vs #eta: all Ecal ",
1364                                                             etaBin2,
1365                                                             etaMin,
1366                                                             etaMax,
1367                                                             etBin,
1368                                                             etMin,
1369                                                             etMax * 0.1,
1370                                                             "");
1371   //
1372   if (!isRunCentrally_) {
1373     histname = "hcalTowerSumEtConeDR04VsEt";
1374     h2_hcalTowerSumEtConeDR04VsEt_[0] = iBooker.book2D(histname + "All",
1375                                                        " All photons hcalTowerSumEtConeDR04 vs Et: all Ecal ",
1376                                                        etBin,
1377                                                        etMin,
1378                                                        etMax,
1379                                                        etBin,
1380                                                        etMin,
1381                                                        etMax * 0.1);
1382     h2_hcalTowerSumEtConeDR04VsEt_[1] = iBooker.book2D(histname + "Barrel",
1383                                                        " All photons hcalTowerSumEtConeDR04 vs Et: Barrel ",
1384                                                        etBin,
1385                                                        etMin,
1386                                                        etMax,
1387                                                        etBin,
1388                                                        etMin,
1389                                                        etMax * 0.1);
1390     h2_hcalTowerSumEtConeDR04VsEt_[2] = iBooker.book2D(histname + "Endcap",
1391                                                        " All photons hcalTowerSumEtConeDR04 vs Et: Endcap ",
1392                                                        etBin,
1393                                                        etMin,
1394                                                        etMax,
1395                                                        etBin,
1396                                                        etMin,
1397                                                        etMax * 0.1);
1398   }
1399   histname = "pHcalTowerSumEtConeDR04VsEt";
1400   if (!isRunCentrally_)
1401     p_hcalTowerSumEtConeDR04VsEt_[0] = iBooker.bookProfile(histname + "All",
1402                                                            "All photons hcalTowerSumEtDR04 vs Et: all Ecal ",
1403                                                            etBin,
1404                                                            etMin,
1405                                                            etMax,
1406                                                            etBin,
1407                                                            etMin,
1408                                                            etMax * etScale,
1409                                                            "");
1410   p_hcalTowerSumEtConeDR04VsEt_[1] = iBooker.bookProfile(histname + "Barrel",
1411                                                          "All photons hcalTowerSumEtDR04 vs Et: all Ecal ",
1412                                                          etBin,
1413                                                          etMin,
1414                                                          etMax,
1415                                                          etBin,
1416                                                          etMin,
1417                                                          etMax * etScale,
1418                                                          "");
1419   p_hcalTowerSumEtConeDR04VsEt_[2] = iBooker.bookProfile(histname + "Endcap",
1420                                                          "All photons hcalTowerSumEtDR04 vs Et: all Ecal ",
1421                                                          etBin,
1422                                                          etMin,
1423                                                          etMax,
1424                                                          etBin,
1425                                                          etMin,
1426                                                          etMax * etScale,
1427                                                          "");
1428   //
1429   histname = "pHcalTowerBcSumEtConeDR04VsEt";
1430   if (!isRunCentrally_)
1431     p_hcalTowerBcSumEtConeDR04VsEt_[0] = iBooker.bookProfile(histname + "All",
1432                                                              "All photons hcalTowerBcSumEtDR04 vs Et: all Ecal ",
1433                                                              etBin,
1434                                                              etMin,
1435                                                              etMax,
1436                                                              etBin,
1437                                                              etMin,
1438                                                              etMax * etScale,
1439                                                              "");
1440   p_hcalTowerBcSumEtConeDR04VsEt_[1] = iBooker.bookProfile(histname + "Barrel",
1441                                                            "All photons hcalTowerBcSumEtDR04 vs Et: all Ecal ",
1442                                                            etBin,
1443                                                            etMin,
1444                                                            etMax,
1445                                                            etBin,
1446                                                            etMin,
1447                                                            etMax * etScale,
1448                                                            "");
1449   p_hcalTowerBcSumEtConeDR04VsEt_[2] = iBooker.bookProfile(histname + "Endcap",
1450                                                            "All photons hcalTowerBcSumEtDR04 vs Et: all Ecal ",
1451                                                            etBin,
1452                                                            etMin,
1453                                                            etMax,
1454                                                            etBin,
1455                                                            etMin,
1456                                                            etMax * etScale,
1457                                                            "");
1458 
1459   //
1460   histname = "isoTrkSolidConeDR04";
1461   h_isoTrkSolidConeDR04_[0][0] =
1462       iBooker.book1D(histname + "All", "isoTrkSolidConeDR04: All Ecal", etBin, etMin, etMax * 0.1);
1463   h_isoTrkSolidConeDR04_[0][1] =
1464       iBooker.book1D(histname + "Barrel", "isoTrkSolidConeDR04: Barrel ", etBin, etMin, etMax * 0.1);
1465   h_isoTrkSolidConeDR04_[0][2] =
1466       iBooker.book1D(histname + "Endcap", "isoTrkSolidConeDR04: Endcap ", etBin, etMin, etMax * 0.1);
1467   //
1468 
1469   histname = "isoTrkSolidConeDR04VsEta";
1470   if (!isRunCentrally_)
1471     h2_isoTrkSolidConeDR04VsEta_[0] = iBooker.book2D(histname + "All",
1472                                                      " All photons isoTrkSolidConeDR04 vs #eta: all Ecal ",
1473                                                      etaBin2,
1474                                                      etaMin,
1475                                                      etaMax,
1476                                                      etBin,
1477                                                      etMin,
1478                                                      etMax * 0.1);
1479   if (!isRunCentrally_)
1480     h2_isoTrkSolidConeDR04VsEta_[1] = iBooker.book2D(histname + "Unconv",
1481                                                      " All photons isoTrkSolidConeDR04 vs #eta: all Ecal ",
1482                                                      etaBin2,
1483                                                      etaMin,
1484                                                      etaMax,
1485                                                      etBin,
1486                                                      etMin,
1487                                                      etMax * 0.1);
1488 
1489   //
1490   histname = "isoTrkSolidConeDR04VsEt";
1491   if (!isRunCentrally_)
1492     h2_isoTrkSolidConeDR04VsEt_[0] = iBooker.book2D(histname + "All",
1493                                                     " All photons isoTrkSolidConeDR04 vs Et: all Ecal ",
1494                                                     etBin,
1495                                                     etMin,
1496                                                     etMax,
1497                                                     etBin,
1498                                                     etMin,
1499                                                     etMax * 0.1);
1500   if (!isRunCentrally_)
1501     h2_isoTrkSolidConeDR04VsEt_[1] = iBooker.book2D(histname + "Unconv",
1502                                                     " All photons isoTrkSolidConeDR04 vs Et: all Ecal ",
1503                                                     etBin,
1504                                                     etMin,
1505                                                     etMax,
1506                                                     etBin,
1507                                                     etMin,
1508                                                     etMax * 0.1);
1509   //
1510   histname = "nTrkSolidConeDR04";
1511   h_nTrkSolidConeDR04_[0][0] = iBooker.book1D(histname + "All", "nTrkSolidConeDR04: All Ecal", 20, 0., 20);
1512   h_nTrkSolidConeDR04_[0][1] = iBooker.book1D(histname + "Barrel", "nTrkSolidConeDR04: Barrel ", 20, 0., 20);
1513   h_nTrkSolidConeDR04_[0][2] = iBooker.book1D(histname + "Endcap", "nTrkSolidConeDR04: Endcap ", 20, 0., 20);
1514   //
1515   histname = "nTrkSolidConeDR04VsEta";
1516   if (!isRunCentrally_)
1517     h2_nTrkSolidConeDR04VsEta_[0] = iBooker.book2D(
1518         histname + "All", " All photons nTrkSolidConeDR04 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 20, 0., 20);
1519   if (!isRunCentrally_)
1520     h2_nTrkSolidConeDR04VsEta_[1] = iBooker.book2D(
1521         histname + "Unconv", " All photons nTrkSolidConeDR04 vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 20, 0., 20);
1522   //
1523   histname = "nTrkSolidConeDR04VsEt";
1524   if (!isRunCentrally_)
1525     h2_nTrkSolidConeDR04VsEt_[0] = iBooker.book2D(
1526         histname + "All", " All photons nTrkSolidConeDR04 vs Et: all Ecal ", etBin, etMin, etMax, 20, 0., 20);
1527   if (!isRunCentrally_)
1528     h2_nTrkSolidConeDR04VsEt_[1] = iBooker.book2D(
1529         histname + "Unconv", " All photons nTrkSolidConeDR04 vs Et: all Ecal ", etBin, etMin, etMax, 20, 0., 20);
1530   //
1531   histname = "phoE";
1532   h_phoE_[0][0] = iBooker.book1D(histname + "All", " Photon Energy: All ecal ", eBin, eMin, eMax);
1533   h_phoE_[0][1] = iBooker.book1D(histname + "Barrel", " Photon Energy: barrel ", eBin, eMin, eMax);
1534   h_phoE_[0][2] = iBooker.book1D(histname + "Endcap", " Photon Energy: Endcap ", eBin, eMin, eMax);
1535 
1536   histname = "phoEt";
1537   h_phoEt_[0][0] = iBooker.book1D(histname + "All", " Photon Transverse Energy: All ecal ", etBin, etMin, etMax);
1538   h_phoEt_[0][1] = iBooker.book1D(histname + "Barrel", " Photon Transverse Energy: Barrel ", etBin, etMin, etMax);
1539   h_phoEt_[0][2] = iBooker.book1D(histname + "Endcap", " Photon Transverse Energy: Endcap ", etBin, etMin, etMax);
1540 
1541   histname = "eRes";
1542   h_phoERes_[0][0] =
1543       iBooker.book1D(histname + "All", " Photon E/E_{true}: All ecal;  E/E_{true} (GeV)", resBin, resMin, resMax);
1544   h_phoERes_[0][1] =
1545       iBooker.book1D(histname + "Barrel", "Photon E/E_{true}: Barrel; E/E_{true} (GeV)", resBin, resMin, resMax);
1546   h_phoERes_[0][2] =
1547       iBooker.book1D(histname + "Endcap", " Photon E/E_{true}: Endcap; E/E_{true} (GeV)", resBin, resMin, resMax);
1548 
1549   h_phoERes_[1][0] = iBooker.book1D(
1550       histname + "unconvAll", " Photon E/E_{true} if r9>0.94, 0.95: All ecal; E/E_{true} (GeV)", resBin, resMin, resMax);
1551   h_phoERes_[1][1] = iBooker.book1D(
1552       histname + "unconvBarrel", " Photon E/E_{true} if r9>0.94: Barrel; E/E_{true} (GeV)", resBin, resMin, resMax);
1553   h_phoERes_[1][2] = iBooker.book1D(
1554       histname + "unconvEndcap", " Photon E/E_{true} if r9>0.95: Endcap; E/E_{true} (GeV)", resBin, resMin, resMax);
1555 
1556   h_phoERes_[2][0] = iBooker.book1D(
1557       histname + "convAll", " Photon E/E_{true} if r9<0.0.94, 0.95: All ecal; E/E_{true} (GeV)", resBin, resMin, resMax);
1558   h_phoERes_[2][1] = iBooker.book1D(
1559       histname + "convBarrel", " Photon E/E_{true} if r9<0.94: Barrel; E/E_{true} (GeV)", resBin, resMin, resMax);
1560   h_phoERes_[2][2] = iBooker.book1D(
1561       histname + "convEndcap", " Photon E/E_{true} if r9<0.95: Endcap; E/E_{true} (GeV)", resBin, resMin, resMax);
1562 
1563   histname = "sigmaEoE";
1564   h_phoSigmaEoE_[0][0] = iBooker.book1D(histname + "All", "#sigma_{E}/E: All ecal; #sigma_{E}/E", 100, 0., 0.08);
1565   h_phoSigmaEoE_[0][1] = iBooker.book1D(histname + "Barrel", "#sigma_{E}/E: Barrel; #sigma_{E}/E", 100, 0., 0.08);
1566   h_phoSigmaEoE_[0][2] = iBooker.book1D(histname + "Endcap", "#sigma_{E}/E: Endcap, #sigma_{E}/E", 100, 0., 0.08);
1567 
1568   h_phoSigmaEoE_[1][0] =
1569       iBooker.book1D(histname + "unconvAll", "#sigma_{E}/E if r9>0.94, 0.95: All ecal; #sigma_{E}/E", 100, 0., 0.08);
1570   h_phoSigmaEoE_[1][1] =
1571       iBooker.book1D(histname + "unconvBarrel", "#sigma_{E}/E if r9>0.94: Barrel; #sigma_{E}/E", 100, 0., 0.08);
1572   h_phoSigmaEoE_[1][2] =
1573       iBooker.book1D(histname + "unconvEndcap", "#sigma_{E}/E r9>0.95: Endcap; #sigma_{E}/E", 100, 0., 0.08);
1574 
1575   h_phoSigmaEoE_[2][0] =
1576       iBooker.book1D(histname + "convAll", "#sigma_{E}/E if r9<0.0.94, 0.95: All ecal, #sigma_{E}/E", 100, 0., 0.08);
1577   h_phoSigmaEoE_[2][1] =
1578       iBooker.book1D(histname + "convBarrel", "#sigma_{E}/E if r9<0.94: Barrel, #sigma_{E}/E", 100, 0., 0.08);
1579   h_phoSigmaEoE_[2][2] =
1580       iBooker.book1D(histname + "convEndcap", "#sigma_{E}/E if r9<0.95: Endcap, #sigma_{E}/E", 100, 0., 0.08);
1581 
1582   histname = "eResVsEta";
1583   if (!isRunCentrally_)
1584     h2_eResVsEta_[0] = iBooker.book2D(
1585         histname + "All", " All photons E/Etrue vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 2.5);
1586   if (!isRunCentrally_)
1587     h2_eResVsEta_[1] = iBooker.book2D(
1588         histname + "Unconv", " Unconv photons E/Etrue vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 2.5);
1589 
1590   histname = "pEResVsEta";
1591   p_eResVsEta_[0] = iBooker.bookProfile(
1592       histname + "All", "All photons  E/Etrue vs #eta: all Ecal ", etaBin2, etaMin, etaMax, resBin, resMin, resMax, "");
1593   p_eResVsEta_[1] = iBooker.bookProfile(histname + "Unconv",
1594                                         "Unconv photons  E/Etrue vs #eta: all Ecal",
1595                                         etaBin2,
1596                                         etaMin,
1597                                         etaMax,
1598                                         resBin,
1599                                         resMin,
1600                                         resMax,
1601                                         "");
1602   p_eResVsEta_[2] = iBooker.bookProfile(
1603       histname + "Conv", "Conv photons  E/Etrue vs #eta: all Ecal", etaBin2, etaMin, etaMax, resBin, resMin, resMax, "");
1604 
1605   histname = "pSigmaEoEVsEta";
1606   p_sigmaEoEVsEta_[0] = iBooker.bookProfile(histname + "All",
1607                                             "All photons: #sigma_{E}/E vs #eta: all Ecal; #eta; #sigma_{E}/E",
1608                                             etaBin2,
1609                                             etaMin,
1610                                             etaMax,
1611                                             100,
1612                                             0.,
1613                                             0.08,
1614                                             "");
1615   p_sigmaEoEVsEta_[1] = iBooker.bookProfile(histname + "Unconv",
1616                                             "Unconv photons #sigma_{E}/E vs #eta: all Ecal; #eta; #sigma_{E}/E ",
1617                                             etaBin2,
1618                                             etaMin,
1619                                             etaMax,
1620                                             100,
1621                                             0.,
1622                                             0.08,
1623                                             "");
1624   p_sigmaEoEVsEta_[2] = iBooker.bookProfile(histname + "Conv",
1625                                             "Conv photons  #sigma_{E}/E vs #eta: all Ecal;  #eta; #sigma_{E}/E",
1626                                             etaBin2,
1627                                             etaMin,
1628                                             etaMax,
1629                                             100,
1630                                             0.,
1631                                             0.08,
1632                                             "");
1633 
1634   histname = "pSigmaEoEVsEt";
1635   p_sigmaEoEVsEt_[1][0] = iBooker.bookProfile(histname + "Barrel",
1636                                               "All photons #sigma_{E}/E vs E_{T}: Barrel;  E_{T} (GeV); #sigma_{E}/E ",
1637                                               etBin,
1638                                               etMin,
1639                                               etMax,
1640                                               100,
1641                                               0.,
1642                                               0.08,
1643                                               "");
1644   p_sigmaEoEVsEt_[1][1] =
1645       iBooker.bookProfile(histname + "unconvBarrel",
1646                           "Unconv photons #sigma_{E}/E vs E_{T}: Barrel;  E_{T} (GeV); #sigma_{E}/E ",
1647                           etBin,
1648                           etMin,
1649                           etMax,
1650                           100,
1651                           0.,
1652                           0.08,
1653                           "");
1654   p_sigmaEoEVsEt_[1][2] = iBooker.bookProfile(histname + "convBarrel",
1655                                               "Conv photons  #sigma_{E}/E vs E_{T}: Barrel;  E_{T} (GeV); #sigma_{E}/E",
1656                                               etBin,
1657                                               etMin,
1658                                               etMax,
1659                                               100,
1660                                               0.,
1661                                               0.08,
1662                                               "");
1663   p_sigmaEoEVsEt_[2][0] = iBooker.bookProfile(histname + "Endcap",
1664                                               "All photons #sigma_{E}/E vs E_{T}: Endcap;  E_{T} (GeV); #sigma_{E}/E ",
1665                                               etBin,
1666                                               etMin,
1667                                               etMax,
1668                                               100,
1669                                               0.,
1670                                               0.08,
1671                                               "");
1672   p_sigmaEoEVsEt_[2][1] =
1673       iBooker.bookProfile(histname + "unconvEndcap",
1674                           "Unconv photons #sigma_{E}/E vs E_{T}: Endcap;  E_{T} (GeV); #sigma_{E}/E ",
1675                           etBin,
1676                           etMin,
1677                           etMax,
1678                           100,
1679                           0.,
1680                           0.08,
1681                           "");
1682   p_sigmaEoEVsEt_[2][2] = iBooker.bookProfile(histname + "convEndcap",
1683                                               "Conv photons  #sigma_{E}/E vs E_{T}: Endcap;  E_{T} (GeV); #sigma_{E}/E",
1684                                               etBin,
1685                                               etMin,
1686                                               etMax,
1687                                               100,
1688                                               0.,
1689                                               0.08,
1690                                               "");
1691 
1692   histname = "pSigmaEoEVsNVtx";
1693   p_sigmaEoEVsNVtx_[1][0] = iBooker.bookProfile(histname + "Barrel",
1694                                                 "All photons: #sigma_{E}/E vs N_{vtx}: Barrel; N_{vtx}; #sigma_{E}/E",
1695                                                 200,
1696                                                 -0.5,
1697                                                 199.5,
1698                                                 100,
1699                                                 0.,
1700                                                 0.08,
1701                                                 "");
1702   p_sigmaEoEVsNVtx_[1][1] =
1703       iBooker.bookProfile(histname + "unconvBarrel",
1704                           "Unconv photons #sigma_{E}/E vs N_{vtx}: Barrel; N_{vtx}; #sigma_{E}/E ",
1705                           200,
1706                           -0.5,
1707                           199.5,
1708                           100,
1709                           0.,
1710                           0.08,
1711                           "");
1712   p_sigmaEoEVsNVtx_[1][2] = iBooker.bookProfile(histname + "convBarrel",
1713                                                 "Conv photons  #sigma_{E}/E vs N_{vtx}: Barrel;  N_{vtx}; #sigma_{E}/E",
1714                                                 200,
1715                                                 -0.5,
1716                                                 199.5,
1717                                                 100,
1718                                                 0.,
1719                                                 0.08,
1720                                                 "");
1721   p_sigmaEoEVsNVtx_[2][0] = iBooker.bookProfile(histname + "Endcap",
1722                                                 "All photons: #sigma_{E}/E vs N_{vtx}: Endcap; N_{vtx}; #sigma_{E}/E",
1723                                                 200,
1724                                                 -0.5,
1725                                                 199.5,
1726                                                 100,
1727                                                 0.,
1728                                                 0.08,
1729                                                 "");
1730   p_sigmaEoEVsNVtx_[2][1] =
1731       iBooker.bookProfile(histname + "unconvEndcap",
1732                           "Unconv photons #sigma_{E}/E vs N_{vtx}: Endcap; N_{vtx}; #sigma_{E}/E ",
1733                           200,
1734                           -0.5,
1735                           199.5,
1736                           100,
1737                           0.,
1738                           0.08,
1739                           "");
1740   p_sigmaEoEVsNVtx_[2][2] = iBooker.bookProfile(histname + "convEndcap",
1741                                                 "Conv photons  #sigma_{E}/E vs N_{vtx}: Endcap;  N_{vtx}; #sigma_{E}/E",
1742                                                 200,
1743                                                 -0.5,
1744                                                 199.5,
1745                                                 100,
1746                                                 0.,
1747                                                 0.08,
1748                                                 "");
1749 
1750   if (!isRunCentrally_) {
1751     histname = "eResVsEt";
1752     h2_eResVsEt_[0][0] = iBooker.book2D(
1753         histname + "All", " All photons E/Etrue vs true Et: all Ecal ", etBin, etMin, etMax, 100, 0.9, 1.1);
1754     h2_eResVsEt_[0][1] = iBooker.book2D(
1755         histname + "unconv", " All photons E/Etrue vs true Et: all Ecal ", etBin, etMin, etMax, 100, 0.9, 1.1);
1756     h2_eResVsEt_[0][2] = iBooker.book2D(
1757         histname + "conv", " All photons E/Etrue vs true Et: all Ecal ", etBin, etMin, etMax, 100, 0.9, 1.1);
1758     h2_eResVsEt_[1][0] = iBooker.book2D(
1759         histname + "Barrel", " All photons E/Etrue vs true Et: Barrel ", etBin, etMin, etMax, 100, 0.9, 1.1);
1760     h2_eResVsEt_[1][1] = iBooker.book2D(
1761         histname + "unconvBarrel", " All photons E/Etrue vs true Et: Barrel ", etBin, etMin, etMax, 100, 0.9, 1.1);
1762     h2_eResVsEt_[1][2] = iBooker.book2D(
1763         histname + "convBarrel", " All photons E/Etrue vs true Et: Barrel ", etBin, etMin, etMax, 100, 0.9, 1.1);
1764     h2_eResVsEt_[2][0] = iBooker.book2D(
1765         histname + "Endcap", " All photons E/Etrue vs true Et: Endcap ", etBin, etMin, etMax, 100, 0.9, 1.1);
1766     h2_eResVsEt_[2][1] = iBooker.book2D(
1767         histname + "unconvEndcap", " All photons E/Etrue vs true Et: Endcap ", etBin, etMin, etMax, 100, 0.9, 1.1);
1768     h2_eResVsEt_[2][2] = iBooker.book2D(
1769         histname + "convEndcap", " All photons E/Etrue vs true Et: Endcap ", etBin, etMin, etMax, 100, 0.9, 1.1);
1770   }
1771 
1772   histname = "pEResVsEt";
1773   p_eResVsEt_[0][0] = iBooker.bookProfile(
1774       histname + "All", "All photons  E/Etrue vs Et: all Ecal ", etBin, etMin, etMax, resBin, resMin, resMax, "");
1775   p_eResVsEt_[0][1] = iBooker.bookProfile(
1776       histname + "unconv", "All photons  E/Etrue vs Et: all Ecal ", etBin, etMin, etMax, resBin, resMin, resMax, "");
1777   p_eResVsEt_[0][2] = iBooker.bookProfile(
1778       histname + "conv", "All photons  E/Etrue vs Et: all Ecal ", etBin, etMin, etMax, resBin, resMin, resMax, "");
1779   p_eResVsEt_[1][0] = iBooker.bookProfile(
1780       histname + "Barrel", "All photons  E/Etrue vs Et: Barrel ", etBin, etMin, etMax, resBin, resMin, resMax, "");
1781   p_eResVsEt_[1][1] = iBooker.bookProfile(
1782       histname + "unconvBarrel", "All photons  E/Etrue vs Et: Barrel ", etBin, etMin, etMax, resBin, resMin, resMax, "");
1783   p_eResVsEt_[1][2] = iBooker.bookProfile(
1784       histname + "convBarrel", "All photons  E/Etrue vs Et: Barrel ", etBin, etMin, etMax, resBin, resMin, resMax, "");
1785   p_eResVsEt_[2][0] = iBooker.bookProfile(
1786       histname + "Endcap", "All photons  E/Etrue vs Et: Endcap ", etBin, etMin, etMax, resBin, resMin, resMax, "");
1787   p_eResVsEt_[2][1] = iBooker.bookProfile(
1788       histname + "unconvEndcap", "All photons  E/Etrue vs Et: Endcap ", etBin, etMin, etMax, resBin, resMin, resMax, "");
1789   p_eResVsEt_[2][2] = iBooker.bookProfile(
1790       histname + "convEndcap", "All photons  E/Etrue vs Et: Endcap ", etBin, etMin, etMax, resBin, resMin, resMax, "");
1791 
1792   histname = "pEResVsNVtx";
1793   p_eResVsNVtx_[1][0] = iBooker.bookProfile(histname + "Barrel",
1794                                             "All photons  E/E_{true}  vs N_{vtx}: Barrel;  N_{vtx}; E}/E_{true}",
1795                                             200,
1796                                             -0.5,
1797                                             199.5,
1798                                             resBin,
1799                                             resMin,
1800                                             resMax,
1801                                             "");
1802   p_eResVsNVtx_[1][1] =
1803       iBooker.bookProfile(histname + "unconvBarrel",
1804                           "Unconverted photons E/E_{true}  vs N_{vtx}: Barrel;  N_{vtx}; E}/E_{true} ",
1805                           200,
1806                           -0.5,
1807                           199.5,
1808                           resBin,
1809                           resMin,
1810                           resMax,
1811                           "");
1812   p_eResVsNVtx_[1][2] =
1813       iBooker.bookProfile(histname + "convBarrel",
1814                           " Converted photons  E/E_{true}  vs N_{vtx}: Barrel;  N_{vtx}; E}/E_{true} ",
1815                           200,
1816                           -0.5,
1817                           199.5,
1818                           resBin,
1819                           resMin,
1820                           resMax,
1821                           "");
1822   p_eResVsNVtx_[2][0] = iBooker.bookProfile(histname + "Endcap",
1823                                             "All photons  E/E_{true}  vs N_{vtx}: Endcap;  N_{vtx}; E}/E_{true} ",
1824                                             200,
1825                                             -0.5,
1826                                             199.5,
1827                                             resBin,
1828                                             resMin,
1829                                             resMax,
1830                                             "");
1831   p_eResVsNVtx_[2][1] =
1832       iBooker.bookProfile(histname + "unconvEndcap",
1833                           "Uncoverted photons  E/E_{true}  vs N_{vtx}: Endcap;  N_{vtx}; E}/E_{true} ",
1834                           2080,
1835                           -0.5,
1836                           199.5,
1837                           resBin,
1838                           resMin,
1839                           resMax,
1840                           "");
1841   p_eResVsNVtx_[2][2] = iBooker.bookProfile(histname + "convEndcap",
1842                                             "Converted photons E/E_{true}  vs N_{vtx}: Endcap;  N_{vtx}; E}/E_{true} ",
1843                                             200,
1844                                             -0.5,
1845                                             199.5,
1846                                             resBin,
1847                                             resMin,
1848                                             resMax,
1849                                             "");
1850 
1851   histname = "eResVsR9";
1852   if (!isRunCentrally_)
1853     h2_eResVsR9_[0] = iBooker.book2D(
1854         histname + "All", " All photons E/Etrue vs R9: all Ecal ", r9Bin * 2, r9Min, r9Max, 100, 0., 2.5);
1855   if (!isRunCentrally_)
1856     h2_eResVsR9_[1] = iBooker.book2D(
1857         histname + "Barrel", " All photons E/Etrue vs R9: Barrel ", r9Bin * 2, r9Min, r9Max, 100, 0., 2.5);
1858   if (!isRunCentrally_)
1859     h2_eResVsR9_[2] = iBooker.book2D(
1860         histname + "Endcap", " All photons E/Etrue vs R9: Endcap ", r9Bin * 2, r9Min, r9Max, 100, 0., 2.5);
1861   histname = "pEResVsR9";
1862   if (!isRunCentrally_)
1863     p_eResVsR9_[0] = iBooker.bookProfile(
1864         histname + "All", " All photons  E/Etrue vs R9: all Ecal ", r9Bin * 2, r9Min, r9Max, resBin, resMin, resMax, "");
1865   p_eResVsR9_[1] = iBooker.bookProfile(
1866       histname + "Barrel", " All photons  E/Etrue vs R9: Barrel ", r9Bin * 2, r9Min, r9Max, resBin, resMin, resMax, "");
1867   p_eResVsR9_[2] = iBooker.bookProfile(
1868       histname + "Endcap", " All photons  E/Etrue vs R9: Endcap ", r9Bin * 2, r9Min, r9Max, resBin, resMin, resMax, "");
1869   histname = "sceResVsR9";
1870   if (!isRunCentrally_)
1871     h2_sceResVsR9_[0] = iBooker.book2D(
1872         histname + "All", " All photons scE/Etrue vs R9: all Ecal ", r9Bin * 2, r9Min, r9Max, 100, 0., 2.5);
1873   if (!isRunCentrally_)
1874     h2_sceResVsR9_[1] = iBooker.book2D(
1875         histname + "Barrel", " All photons scE/Etrue vs R9: Barrel ", r9Bin * 2, r9Min, r9Max, 100, 0., 2.5);
1876   if (!isRunCentrally_)
1877     h2_sceResVsR9_[2] = iBooker.book2D(
1878         histname + "Endcap", " All photons scE/Etrue vs R9: Endcap ", r9Bin * 2, r9Min, r9Max, 100, 0., 2.5);
1879   histname = "scpEResVsR9";
1880   if (!isRunCentrally_)
1881     p_sceResVsR9_[0] = iBooker.bookProfile(histname + "All",
1882                                            " All photons  scE/Etrue vs R9: all Ecal ",
1883                                            r9Bin * 2,
1884                                            r9Min,
1885                                            r9Max,
1886                                            resBin,
1887                                            resMin,
1888                                            resMax,
1889                                            "");
1890   p_sceResVsR9_[1] = iBooker.bookProfile(histname + "Barrel",
1891                                          " All photons  scE/Etrue vs R9: Barrel ",
1892                                          r9Bin * 2,
1893                                          r9Min,
1894                                          r9Max,
1895                                          resBin,
1896                                          resMin,
1897                                          resMax,
1898                                          "");
1899   p_sceResVsR9_[2] = iBooker.bookProfile(histname + "Endcap",
1900                                          " All photons  scE/Etrue vs R9: Endcap ",
1901                                          r9Bin * 2,
1902                                          r9Min,
1903                                          r9Max,
1904                                          resBin,
1905                                          resMin,
1906                                          resMax,
1907                                          "");
1908 
1909   // Photon E resolution when using energy values from regressions
1910   histname = "eResRegr1";
1911   h_phoEResRegr1_[0][0] =
1912       iBooker.book1D(histname + "All", " Photon rec/true Energy from Regression1 : All ecal ", resBin, resMin, resMax);
1913   h_phoEResRegr1_[0][1] =
1914       iBooker.book1D(histname + "Barrel", " Photon rec/true Energy from Regression1: Barrel ", resBin, resMin, resMax);
1915   h_phoEResRegr1_[0][2] =
1916       iBooker.book1D(histname + "Endcap", " Photon rec/true Energy from Regression1: Endcap ", resBin, resMin, resMax);
1917 
1918   h_phoEResRegr1_[1][0] = iBooker.book1D(histname + "unconvAll",
1919                                          " Photon rec/true Energy from Regression1 if r9>0.94, 0.95: All ecal ",
1920                                          resBin,
1921                                          resMin,
1922                                          resMax);
1923   h_phoEResRegr1_[1][1] = iBooker.book1D(
1924       histname + "unconvBarrel", " Photon rec/true Energy from Regression1 if r9>0.94: Barrel ", resBin, resMin, resMax);
1925   h_phoEResRegr1_[1][2] = iBooker.book1D(
1926       histname + "unconvEndcap", " Photon rec/true Energy from Regression1 if r9>0.95: Endcap ", resBin, resMin, resMax);
1927 
1928   h_phoEResRegr1_[2][0] = iBooker.book1D(histname + "convAll",
1929                                          " Photon rec/true Energy  from Regression1if r9<0.0.94, 0.95: All ecal ",
1930                                          resBin,
1931                                          resMin,
1932                                          resMax);
1933   h_phoEResRegr1_[2][1] = iBooker.book1D(
1934       histname + "convBarrel", " Photon rec/true Energy from Regression1 if r9<0.94: Barrel ", resBin, resMin, resMax);
1935   h_phoEResRegr1_[2][2] = iBooker.book1D(
1936       histname + "convEndcap", " Photon rec/true Energy from Regression1 if r9<0.95: Endcap ", resBin, resMin, resMax);
1937 
1938   histname = "eResRegr2";
1939   h_phoEResRegr2_[0][0] =
1940       iBooker.book1D(histname + "All", " Photon rec/true Energy from Regression2 : All ecal ", resBin, resMin, resMax);
1941   h_phoEResRegr2_[0][1] =
1942       iBooker.book1D(histname + "Barrel", " Photon rec/true Energy from Regression2: Barrel ", resBin, resMin, resMax);
1943   h_phoEResRegr2_[0][2] =
1944       iBooker.book1D(histname + "Endcap", " Photon rec/true Energy from Regression2: Endcap ", resBin, resMin, resMax);
1945 
1946   h_phoEResRegr2_[1][0] = iBooker.book1D(histname + "unconvAll",
1947                                          " Photon rec/true Energy from Regression2 if r9>0.94, 0.95: All ecal ",
1948                                          resBin,
1949                                          resMin,
1950                                          resMax);
1951   h_phoEResRegr2_[1][1] = iBooker.book1D(
1952       histname + "unconvBarrel", " Photon rec/true Energy from Regression2 if r9>0.94: Barrel ", resBin, resMin, resMax);
1953   h_phoEResRegr2_[1][2] = iBooker.book1D(
1954       histname + "unconvEndcap", " Photon rec/true Energy from Regression2 if r9>0.95: Endcap ", resBin, resMin, resMax);
1955 
1956   h_phoEResRegr2_[2][0] = iBooker.book1D(histname + "convAll",
1957                                          " Photon rec/true Energy  from Regression2 if r9<0.0.94, 0.95: All ecal ",
1958                                          resBin,
1959                                          resMin,
1960                                          resMax);
1961   h_phoEResRegr2_[2][1] = iBooker.book1D(
1962       histname + "convBarrel", " Photon rec/true Energy from Regression2 if r9<0.94: Barrel ", resBin, resMin, resMax);
1963   h_phoEResRegr2_[2][2] = iBooker.book1D(
1964       histname + "convEndcap", " Photon rec/true Energy from Regression2 if r9<0.95: Endcap ", resBin, resMin, resMax);
1965   //
1966   histname = "phoPixSeedSize";
1967   h_phoPixSeedSize_[0] = iBooker.book1D(histname + "Barrel", "Pixel seeds size ", 100, 0., 100.);
1968   h_phoPixSeedSize_[1] = iBooker.book1D(histname + "Endcap", "Pixel seeds size ", 100, 0., 100.);
1969 
1970   //  Infos from Particle Flow - isolation and ID
1971   histname = "chargedHadIso";
1972   h_chHadIso_[0] = iBooker.book1D(histname + "All", "PF chargedHadIso:  All Ecal", etBin, etMin, 20.);
1973   h_chHadIso_[1] = iBooker.book1D(histname + "Barrel", "PF chargedHadIso:  Barrel", etBin, etMin, 20.);
1974   h_chHadIso_[2] = iBooker.book1D(histname + "Endcap", "PF chargedHadIso:  Endcap", etBin, etMin, 20.);
1975   histname = "neutralHadIso";
1976   h_nHadIso_[0] = iBooker.book1D(histname + "All", "PF neutralHadIso:  All Ecal", etBin, etMin, 20.);
1977   h_nHadIso_[1] = iBooker.book1D(histname + "Barrel", "PF neutralHadIso:  Barrel", etBin, etMin, 20.);
1978   h_nHadIso_[2] = iBooker.book1D(histname + "Endcap", "PF neutralHadIso:  Endcap", etBin, etMin, 20.);
1979   histname = "photonIso";
1980   h_phoIso_[0] = iBooker.book1D(histname + "All", "PF photonIso:  All Ecal", etBin, etMin, 20.);
1981   h_phoIso_[1] = iBooker.book1D(histname + "Barrel", "PF photonIso:  Barrel", etBin, etMin, 20.);
1982   h_phoIso_[2] = iBooker.book1D(histname + "Endcap", "PF photonIso:  Endcap", etBin, etMin, 20.);
1983   histname = "nCluOutMustache";
1984   h_nCluOutsideMustache_[0] =
1985       iBooker.book1D(histname + "All", "PF number of clusters outside Mustache:  All Ecal", 50, 0., 50.);
1986   h_nCluOutsideMustache_[1] =
1987       iBooker.book1D(histname + "Barrel", "PF number of clusters outside Mustache:  Barrel", 50, 0., 50.);
1988   h_nCluOutsideMustache_[2] =
1989       iBooker.book1D(histname + "Endcap", "PF number of clusters outside Mustache:  Endcap", 50, 0., 50.);
1990   histname = "etOutMustache";
1991   h_etOutsideMustache_[0] = iBooker.book1D(histname + "All", "PF et outside Mustache:  All Ecal", etBin, etMin, 20.);
1992   h_etOutsideMustache_[1] = iBooker.book1D(histname + "Barrel", "PF et outside Mustache:  Barrel", etBin, etMin, 20.);
1993   h_etOutsideMustache_[2] = iBooker.book1D(histname + "Endcap", "PF et outside Mustache:  Endcap", etBin, etMin, 20.);
1994   histname = "pfMVA";
1995   h_pfMva_[0] = iBooker.book1D(histname + "All", "PF MVA output:  All Ecal", 50, -1., 2.);
1996   h_pfMva_[1] = iBooker.book1D(histname + "Barrel", "PF MVA output:  Barrel", 50, -1., 2.);
1997   h_pfMva_[2] = iBooker.book1D(histname + "Endcap", "PF MVA output:  Endcap", 50, -1, 2.);
1998   ////////// particle based isolation from value map
1999   histname = "SumPtOverPhoPt_ChHad_Cleaned";
2000   h_SumPtOverPhoPt_ChHad_Cleaned_[0] =
2001       iBooker.book1D(histname + "All", "Pf Cand SumPt/P_{T}_{#gamma}: Charged Hadrons:  All Ecal", etBin, etMin, 2.);
2002   h_SumPtOverPhoPt_ChHad_Cleaned_[1] =
2003       iBooker.book1D(histname + "Barrel", "PF Cand SumPt/P_{T}_{#gamma}: Charged Hadrons:  Barrel", etBin, etMin, 2.);
2004   h_SumPtOverPhoPt_ChHad_Cleaned_[2] =
2005       iBooker.book1D(histname + "Endcap", "PF Cand SumPt/P_{T}_{#gamma}: Charged Hadrons:  Endcap", etBin, etMin, 2.);
2006   histname = "SumPtOverPhoPt_NeuHad_Cleaned";
2007   h_SumPtOverPhoPt_NeuHad_Cleaned_[0] =
2008       iBooker.book1D(histname + "All", "Pf Cand  SumPt/P_{T}_{#gamma}: Neutral Hadrons:  All Ecal", etBin, etMin, 2.);
2009   h_SumPtOverPhoPt_NeuHad_Cleaned_[1] =
2010       iBooker.book1D(histname + "Barrel", "PF Cand  SumPt/P_{T}_{#gamma}: Neutral Hadrons:  Barrel", etBin, etMin, 2.);
2011   h_SumPtOverPhoPt_NeuHad_Cleaned_[2] =
2012       iBooker.book1D(histname + "Endcap", "PF Cand  SumPt/P_{T}_{#gamma}: Neutral Hadrons:  Endcap", etBin, etMin, 2.);
2013   histname = "SumPtOverPhoPt_Pho_Cleaned";
2014   h_SumPtOverPhoPt_Pho_Cleaned_[0] =
2015       iBooker.book1D(histname + "All", "Pf Cand SumPt/P_{T}_{#gamma}: Photons:  All Ecal", etBin, etMin, 2.);
2016   h_SumPtOverPhoPt_Pho_Cleaned_[1] =
2017       iBooker.book1D(histname + "Barrel", "PF Cand SumPt/P_{T}_{#gamma}: Photons:  Barrel", etBin, etMin, 2.);
2018   h_SumPtOverPhoPt_Pho_Cleaned_[2] =
2019       iBooker.book1D(histname + "Endcap", "PF Cand SumPt/P_{T}_{#gamma}: Photons:  Endcap", etBin, etMin, 2.);
2020 
2021   histname = "dRPhoPFcand_ChHad_Cleaned";
2022   h_dRPhoPFcand_ChHad_Cleaned_[0] =
2023       iBooker.book1D(histname + "All", "dR(pho,cand) Charged Hadrons : All Ecal", etBin, etMin, 0.7);
2024   h_dRPhoPFcand_ChHad_Cleaned_[1] =
2025       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Charged Hadrons :  Barrel", etBin, etMin, 0.7);
2026   h_dRPhoPFcand_ChHad_Cleaned_[2] =
2027       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Charged Hadrons :  Endcap", etBin, etMin, 0.7);
2028   histname = "dRPhoPFcand_NeuHad_Cleaned";
2029   h_dRPhoPFcand_NeuHad_Cleaned_[0] =
2030       iBooker.book1D(histname + "All", "dR(pho,cand) Neutral Hadrons : All Ecal", etBin, etMin, 0.7);
2031   h_dRPhoPFcand_NeuHad_Cleaned_[1] =
2032       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Neutral Hadrons :  Barrel", etBin, etMin, 0.7);
2033   h_dRPhoPFcand_NeuHad_Cleaned_[2] =
2034       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Neutral Hadrons :  Endcap", etBin, etMin, 0.7);
2035   h_dRPhoPFcand_NeuHad_Cleaned_[3] =
2036       iBooker.book1D(histname + "Barrel_1", "dR(pho,cand) Neutral Hadrons :  Barrel |eta| <=1", etBin, etMin, 0.7);
2037   h_dRPhoPFcand_NeuHad_Cleaned_[4] =
2038       iBooker.book1D(histname + "Barrel_2", "dR(pho,cand) Neutral Hadrons :  Barrel |eta | > 1", etBin, etMin, 0.7);
2039   histname = "dRPhoPFcand_Pho_Cleaned";
2040   h_dRPhoPFcand_Pho_Cleaned_[0] =
2041       iBooker.book1D(histname + "All", "dR(pho,cand) Photons : All Ecal", etBin, etMin, 0.7);
2042   h_dRPhoPFcand_Pho_Cleaned_[1] =
2043       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Photons :  Barrel", etBin, etMin, 0.7);
2044   h_dRPhoPFcand_Pho_Cleaned_[2] =
2045       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Photons :  Endcap", etBin, etMin, 0.7);
2046 
2047   //
2048   histname = "SumPtOverPhoPt_ChHad_unCleaned";
2049   h_SumPtOverPhoPt_ChHad_unCleaned_[0] =
2050       iBooker.book1D(histname + "All", "Pf Cand Sum Pt Over photon pt Charged Hadrons :  All Ecal", etBin, etMin, 2.);
2051   h_SumPtOverPhoPt_ChHad_unCleaned_[1] =
2052       iBooker.book1D(histname + "Barrel", "PF Cand Sum Pt Over photon pt Charged Hadrons:  Barrel", etBin, etMin, 2.);
2053   h_SumPtOverPhoPt_ChHad_unCleaned_[2] =
2054       iBooker.book1D(histname + "Endcap", "PF Cand Sum Pt Over photon pt Charged Hadrons:  Endcap", etBin, etMin, 2.);
2055   histname = "SumPtOverPhoPt_NeuHad_unCleaned";
2056   h_SumPtOverPhoPt_NeuHad_unCleaned_[0] =
2057       iBooker.book1D(histname + "All", "Pf Cand Sum Pt Over photon pt Neutral Hadrons :  All Ecal", etBin, etMin, 2.);
2058   h_SumPtOverPhoPt_NeuHad_unCleaned_[1] =
2059       iBooker.book1D(histname + "Barrel", "PF Cand Sum Pt Over photon pt Neutral Hadrons:  Barrel", etBin, etMin, 2.);
2060   h_SumPtOverPhoPt_NeuHad_unCleaned_[2] =
2061       iBooker.book1D(histname + "Endcap", "PF Cand Sum Pt Over photon pt Neutral Hadrons:  Endcap", etBin, etMin, 2.);
2062   histname = "SumPtOverPhoPt_Pho_unCleaned";
2063   h_SumPtOverPhoPt_Pho_unCleaned_[0] =
2064       iBooker.book1D(histname + "All", "Pf Cand Sum Pt Over photon pt Photons:  All Ecal", etBin, etMin, 2.);
2065   h_SumPtOverPhoPt_Pho_unCleaned_[1] =
2066       iBooker.book1D(histname + "Barrel", "PF Cand Sum Pt Over photon pt Photons:  Barrel", etBin, etMin, 2.);
2067   h_SumPtOverPhoPt_Pho_unCleaned_[2] =
2068       iBooker.book1D(histname + "Endcap", "PF Cand Sum Pt Over photon pt Photons:  Endcap", etBin, etMin, 2.);
2069   histname = "dRPhoPFcand_ChHad_unCleaned";
2070   h_dRPhoPFcand_ChHad_unCleaned_[0] =
2071       iBooker.book1D(histname + "All", "dR(pho,cand) Charged Hadrons :  All Ecal", etBin, etMin, 0.7);
2072   h_dRPhoPFcand_ChHad_unCleaned_[1] =
2073       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Charged Hadrons :  Barrel", etBin, etMin, 0.7);
2074   h_dRPhoPFcand_ChHad_unCleaned_[2] =
2075       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Charged Hadrons :  Endcap", etBin, etMin, 0.7);
2076 
2077   histname = "dRPhoPFcand_NeuHad_unCleaned";
2078   h_dRPhoPFcand_NeuHad_unCleaned_[0] =
2079       iBooker.book1D(histname + "All", "dR(pho,cand) Neutral Hadrons :  All Ecal", etBin, etMin, 0.7);
2080   h_dRPhoPFcand_NeuHad_unCleaned_[1] =
2081       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Neutral Hadrons :  Barrel", etBin, etMin, 0.7);
2082   h_dRPhoPFcand_NeuHad_unCleaned_[2] =
2083       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Neutral Hadrons :  Endcap", etBin, etMin, 0.7);
2084   h_dRPhoPFcand_NeuHad_unCleaned_[3] =
2085       iBooker.book1D(histname + "Barrel_1", "dR(pho,cand) Neutral Hadrons :  Barrel |eta| <=1  ", etBin, etMin, 0.7);
2086   h_dRPhoPFcand_NeuHad_unCleaned_[4] =
2087       iBooker.book1D(histname + "Barrel_2", "dR(pho,cand) Neutral Hadrons :  Barrel |eta| > 1", etBin, etMin, 0.7);
2088 
2089   histname = "dRPhoPFcand_Pho_unCleaned";
2090   h_dRPhoPFcand_Pho_unCleaned_[0] =
2091       iBooker.book1D(histname + "All", "dR(pho,cand) Photons:  All Ecal", etBin, etMin, 0.7);
2092   h_dRPhoPFcand_Pho_unCleaned_[1] =
2093       iBooker.book1D(histname + "Barrel", "dR(pho,cand) Photons:  Barrel", etBin, etMin, 0.7);
2094   h_dRPhoPFcand_Pho_unCleaned_[2] =
2095       iBooker.book1D(histname + "Endcap", "dR(pho,cand) Photons:  Endcap", etBin, etMin, 0.7);
2096 
2097   //    if ( ! isRunCentrally_ ) {
2098   // Photon pair invariant mass
2099   histname = "gamgamMass";
2100   h_gamgamMass_[0][0] =
2101       iBooker.book1D(histname + "All", "2 photons invariant mass: All ecal ", ggMassBin, ggMassMin, ggMassMax);
2102   h_gamgamMass_[0][1] =
2103       iBooker.book1D(histname + "Barrel", "2 photons invariant mass:  Barrel ", ggMassBin, ggMassMin, ggMassMax);
2104   h_gamgamMass_[0][2] =
2105       iBooker.book1D(histname + "Endcap", "2 photons invariant mass:  Endcap ", ggMassBin, ggMassMin, ggMassMax);
2106   //
2107   histname = "gamgamMassNoConv";
2108   h_gamgamMass_[1][0] = iBooker.book1D(
2109       histname + "All", "2 photons with no conversion invariant mass: All ecal ", ggMassBin, ggMassMin, ggMassMax);
2110   h_gamgamMass_[1][1] = iBooker.book1D(
2111       histname + "Barrel", "2 photons with no conversion  invariant mass:  Barrel ", ggMassBin, ggMassMin, ggMassMax);
2112   h_gamgamMass_[1][2] = iBooker.book1D(
2113       histname + "Endcap", "2 photons with no conversion  invariant mass:  Endcap ", ggMassBin, ggMassMin, ggMassMax);
2114   //
2115   histname = "gamgamMassConv";
2116   h_gamgamMass_[2][0] = iBooker.book1D(
2117       histname + "All", "2 photons with conversion invariant mass: All ecal ", ggMassBin, ggMassMin, ggMassMax);
2118   h_gamgamMass_[2][1] = iBooker.book1D(
2119       histname + "Barrel", "2 photons with  conversion  invariant mass:  Barrel ", ggMassBin, ggMassMin, ggMassMax);
2120   h_gamgamMass_[2][2] = iBooker.book1D(
2121       histname + "Endcap", "2 photons with  conversion  invariant mass:  Endcap ", ggMassBin, ggMassMin, ggMassMax);
2122   // with energy regression1
2123   histname = "gamgamMassRegr1";
2124   h_gamgamMassRegr1_[0][0] =
2125       iBooker.book1D(histname + "All", "2 photons invariant mass Regr1 : All ecal ", ggMassBin, ggMassMin, ggMassMax);
2126   h_gamgamMassRegr1_[0][1] =
2127       iBooker.book1D(histname + "Barrel", "2 photons invariant mass Regr1 :  Barrel ", ggMassBin, ggMassMin, ggMassMax);
2128   h_gamgamMassRegr1_[0][2] =
2129       iBooker.book1D(histname + "Endcap", "2 photons invariant mass Regr1 :  Endcap ", ggMassBin, ggMassMin, ggMassMax);
2130   //
2131   histname = "gamgamMassRegr1NoConv";
2132   h_gamgamMassRegr1_[1][0] = iBooker.book1D(
2133       histname + "All", "2 photons with no conversion invariant mass Regr1: All ecal ", ggMassBin, ggMassMin, ggMassMax);
2134   h_gamgamMassRegr1_[1][1] = iBooker.book1D(histname + "Barrel",
2135                                             "2 photons with no conversion  invariant mass Regr1:  Barrel ",
2136                                             ggMassBin,
2137                                             ggMassMin,
2138                                             ggMassMax);
2139   h_gamgamMassRegr1_[1][2] = iBooker.book1D(histname + "Endcap",
2140                                             "2 photons with no conversion  invariant mass Regr1:  Endcap ",
2141                                             ggMassBin,
2142                                             ggMassMin,
2143                                             ggMassMax);
2144   //
2145   histname = "gamgamMassRegr1Conv";
2146   h_gamgamMassRegr1_[2][0] = iBooker.book1D(
2147       histname + "All", "2 photons with conversion invariant mass Regr1: All ecal ", ggMassBin, ggMassMin, ggMassMax);
2148   h_gamgamMassRegr1_[2][1] = iBooker.book1D(histname + "Barrel",
2149                                             "2 photons with  conversion  invariant mass Regr1:  Barrel ",
2150                                             ggMassBin,
2151                                             ggMassMin,
2152                                             ggMassMax);
2153   h_gamgamMassRegr1_[2][2] = iBooker.book1D(histname + "Endcap",
2154                                             "2 photons with  conversion  invariant mass Regr1:  Endcap ",
2155                                             ggMassBin,
2156                                             ggMassMin,
2157                                             ggMassMax);
2158   // with energy regression2
2159   histname = "gamgamMassRegr2";
2160   h_gamgamMassRegr2_[0][0] =
2161       iBooker.book1D(histname + "All", "2 photons invariant mass Regr2 : All ecal ", ggMassBin, ggMassMin, ggMassMax);
2162   h_gamgamMassRegr2_[0][1] =
2163       iBooker.book1D(histname + "Barrel", "2 photons invariant mass Regr2 :  Barrel ", ggMassBin, ggMassMin, ggMassMax);
2164   h_gamgamMassRegr2_[0][2] =
2165       iBooker.book1D(histname + "Endcap", "2 photons invariant mass Regr2 :  Endcap ", ggMassBin, ggMassMin, ggMassMax);
2166   //
2167   histname = "gamgamMassRegr2NoConv";
2168   h_gamgamMassRegr2_[1][0] = iBooker.book1D(
2169       histname + "All", "2 photons with no conversion invariant mass Regr2: All ecal ", ggMassBin, ggMassMin, ggMassMax);
2170   h_gamgamMassRegr2_[1][1] = iBooker.book1D(histname + "Barrel",
2171                                             "2 photons with no conversion  invariant mass Regr2:  Barrel ",
2172                                             ggMassBin,
2173                                             ggMassMin,
2174                                             ggMassMax);
2175   h_gamgamMassRegr2_[1][2] = iBooker.book1D(histname + "Endcap",
2176                                             "2 photons with no conversion  invariant mass Regr2:  Endcap ",
2177                                             ggMassBin,
2178                                             ggMassMin,
2179                                             ggMassMax);
2180   //
2181   histname = "gamgamMassRegr2Conv";
2182   h_gamgamMassRegr2_[2][0] = iBooker.book1D(
2183       histname + "All", "2 photons with conversion invariant mass Regr2: All ecal ", ggMassBin, ggMassMin, ggMassMax);
2184   h_gamgamMassRegr2_[2][1] = iBooker.book1D(histname + "Barrel",
2185                                             "2 photons with  conversion  invariant mass Regr2:  Barrel ",
2186                                             ggMassBin,
2187                                             ggMassMin,
2188                                             ggMassMax);
2189   h_gamgamMassRegr2_[2][2] = iBooker.book1D(histname + "Endcap",
2190                                             "2 photons with  conversion  invariant mass Regr2:  Endcap ",
2191                                             ggMassBin,
2192                                             ggMassMin,
2193                                             ggMassMax);
2194 
2195   //}
2196 
2197   ///// Histos to allow comparison with miniAOD
2198 
2199   h_scEta_miniAOD_[0] = iBooker.book1D("scEta_miniAOD", " SC Eta ", etaBin, etaMin, etaMax);
2200   h_scPhi_miniAOD_[0] = iBooker.book1D("scPhi_miniAOD", " SC Phi ", phiBin, phiMin, phiMax);
2201   histname = "phoE";
2202   h_phoE_miniAOD_[0][0] = iBooker.book1D(histname + "All_miniAOD", " Photon Energy: All ecal ", eBin, eMin, eMax);
2203   h_phoE_miniAOD_[0][1] = iBooker.book1D(histname + "Barrel_miniAOD", " Photon Energy: barrel ", eBin, eMin, eMax);
2204   h_phoE_miniAOD_[0][2] = iBooker.book1D(histname + "Endcap_miniAOD", " Photon Energy: Endcap ", eBin, eMin, eMax);
2205 
2206   histname = "phoEt";
2207   h_phoEt_miniAOD_[0][0] =
2208       iBooker.book1D(histname + "All_miniAOD", " Photon Transverse Energy: All ecal ", etBin, etMin, etMax);
2209   h_phoEt_miniAOD_[0][1] =
2210       iBooker.book1D(histname + "Barrel_miniAOD", " Photon Transverse Energy: Barrel ", etBin, etMin, etMax);
2211   h_phoEt_miniAOD_[0][2] =
2212       iBooker.book1D(histname + "Endcap_miniAOD", " Photon Transverse Energy: Endcap ", etBin, etMin, etMax);
2213 
2214   histname = "eRes";
2215   h_phoERes_miniAOD_[0][0] = iBooker.book1D(
2216       histname + "All_miniAOD", " Photon E/E_{true}: All ecal;  E/E_{true} (GeV)", resBin, resMin, resMax);
2217   h_phoERes_miniAOD_[0][1] = iBooker.book1D(
2218       histname + "Barrel_miniAOD", "Photon E/E_{true}: Barrel; E/E_{true} (GeV)", resBin, resMin, resMax);
2219   h_phoERes_miniAOD_[0][2] = iBooker.book1D(
2220       histname + "Endcap_miniAOD", " Photon E/E_{true}: Endcap; E/E_{true} (GeV)", resBin, resMin, resMax);
2221 
2222   histname = "sigmaEoE";
2223   h_phoSigmaEoE_miniAOD_[0][0] =
2224       iBooker.book1D(histname + "All_miniAOD", "#sigma_{E}/E: All ecal; #sigma_{E}/E", 100, 0., 0.08);
2225   h_phoSigmaEoE_miniAOD_[0][1] =
2226       iBooker.book1D(histname + "Barrel_miniAOD", "#sigma_{E}/E: Barrel; #sigma_{E}/E", 100, 0., 0.08);
2227   h_phoSigmaEoE_miniAOD_[0][2] =
2228       iBooker.book1D(histname + "Endcap_miniAOD", "#sigma_{E}/E: Endcap, #sigma_{E}/E", 100, 0., 0.08);
2229 
2230   histname = "r9";
2231   h_r9_miniAOD_[0][0] = iBooker.book1D(histname + "All_miniAOD", " r9: All Ecal", r9Bin, r9Min, r9Max);
2232   h_r9_miniAOD_[0][1] = iBooker.book1D(histname + "Barrel_miniAOD", " r9: Barrel ", r9Bin, r9Min, r9Max);
2233   h_r9_miniAOD_[0][2] = iBooker.book1D(histname + "Endcap_miniAOD", " r9: Endcap ", r9Bin, r9Min, r9Max);
2234   histname = "full5x5_r9";
2235   h_full5x5_r9_miniAOD_[0][0] = iBooker.book1D(histname + "All_miniAOD", " r9: All Ecal", r9Bin, r9Min, r9Max);
2236   h_full5x5_r9_miniAOD_[0][1] = iBooker.book1D(histname + "Barrel_miniAOD", " r9: Barrel ", r9Bin, r9Min, r9Max);
2237   h_full5x5_r9_miniAOD_[0][2] = iBooker.book1D(histname + "Endcap_miniAOD", " r9: Endcap ", r9Bin, r9Min, r9Max);
2238   histname = "r1";
2239   h_r1_miniAOD_[0][0] = iBooker.book1D(histname + "All_miniAOD", " e1x5/e5x5: All Ecal", r9Bin, r9Min, r9Max);
2240   h_r1_miniAOD_[0][1] = iBooker.book1D(histname + "Barrel_miniAOD", " e1x5/e5x5: Barrel ", r9Bin, r9Min, r9Max);
2241   h_r1_miniAOD_[0][2] = iBooker.book1D(histname + "Endcap_miniAOD", " e1x5/e5x5: Endcap ", r9Bin, r9Min, r9Max);
2242   histname = "r2";
2243   h_r2_miniAOD_[0][0] = iBooker.book1D(histname + "All_miniAOD", " e2x5/e5x5: All Ecal", r9Bin, r9Min, r9Max);
2244   h_r2_miniAOD_[0][1] = iBooker.book1D(histname + "Barrel_miniAOD", " e2x5/e5x5: Barrel ", r9Bin, r9Min, r9Max);
2245   h_r2_miniAOD_[0][2] = iBooker.book1D(histname + "Endcap_miniAOD", " e2x5/e5x5: Endcap ", r9Bin, r9Min, r9Max);
2246   histname = "hOverE";
2247   h_hOverE_miniAOD_[0][0] = iBooker.book1D(histname + "All_miniAOD", "H/E: All Ecal", 100, 0., 0.2);
2248   h_hOverE_miniAOD_[0][1] = iBooker.book1D(histname + "Barrel_miniAOD", "H/E: Barrel ", 100, 0., 0.2);
2249   h_hOverE_miniAOD_[0][2] = iBooker.book1D(histname + "Endcap_miniAOD", "H/E: Endcap ", 100, 0., 0.2);
2250   //
2251   histname = "newhOverE";
2252   h_newhOverE_miniAOD_[0][0] = iBooker.book1D(histname + "All_miniAOD", "new H/E: All Ecal", 100, 0., 0.2);
2253   h_newhOverE_miniAOD_[0][1] = iBooker.book1D(histname + "Barrel_miniAOD", "new H/E: Barrel ", 100, 0., 0.2);
2254   h_newhOverE_miniAOD_[0][2] = iBooker.book1D(histname + "Endcap_miniAOD", "new H/E: Endcap ", 100, 0., 0.2);
2255   //
2256   histname = "sigmaIetaIeta";
2257   h_sigmaIetaIeta_miniAOD_[0][0] = iBooker.book1D(histname + "All_miniAOD", "sigmaIetaIeta: All Ecal", 100, 0., 0.1);
2258   h_sigmaIetaIeta_miniAOD_[0][1] = iBooker.book1D(histname + "Barrel_miniAOD", "sigmaIetaIeta: Barrel ", 100, 0., 0.05);
2259   h_sigmaIetaIeta_miniAOD_[0][2] = iBooker.book1D(histname + "Endcap_miniAOD", "sigmaIetaIeta: Endcap ", 100, 0., 0.1);
2260   histname = "full5x5_sigmaIetaIeta";
2261   h_full5x5_sigmaIetaIeta_miniAOD_[0][0] =
2262       iBooker.book1D(histname + "All_miniAOD", "Full5x5 sigmaIetaIeta: All Ecal", 100, 0., 0.1);
2263   h_full5x5_sigmaIetaIeta_miniAOD_[0][1] =
2264       iBooker.book1D(histname + "Barrel_miniAOD", "Full5x5 sigmaIetaIeta: Barrel ", 100, 0., 0.05);
2265   h_full5x5_sigmaIetaIeta_miniAOD_[0][2] =
2266       iBooker.book1D(histname + "Endcap_miniAOD", "Full5x5 sigmaIetaIeta: Endcap ", 100, 0., 0.1);
2267   //
2268   histname = "ecalRecHitSumEtConeDR04";
2269   h_ecalRecHitSumEtConeDR04_miniAOD_[0][0] =
2270       iBooker.book1D(histname + "All_miniAOD", "ecalRecHitSumEtDR04: All Ecal", etBin, etMin, 50.);
2271   h_ecalRecHitSumEtConeDR04_miniAOD_[0][1] =
2272       iBooker.book1D(histname + "Barrel_miniAOD", "ecalRecHitSumEtDR04: Barrel ", etBin, etMin, 50.);
2273   h_ecalRecHitSumEtConeDR04_miniAOD_[0][2] =
2274       iBooker.book1D(histname + "Endcap_miniAOD", "ecalRecHitSumEtDR04: Endcap ", etBin, etMin, 50.);
2275   histname = "hcalTowerSumEtConeDR04";
2276   h_hcalTowerSumEtConeDR04_miniAOD_[0][0] =
2277       iBooker.book1D(histname + "All_miniAOD", "hcalTowerSumEtConeDR04: All Ecal", etBin, etMin, 50.);
2278   h_hcalTowerSumEtConeDR04_miniAOD_[0][1] =
2279       iBooker.book1D(histname + "Barrel_miniAOD", "hcalTowerSumEtConeDR04: Barrel ", etBin, etMin, 50.);
2280   h_hcalTowerSumEtConeDR04_miniAOD_[0][2] =
2281       iBooker.book1D(histname + "Endcap_miniAOD", "hcalTowerSumEtConeDR04: Endcap ", etBin, etMin, 50.);
2282   //
2283   histname = "hcalTowerBcSumEtConeDR04";
2284   h_hcalTowerBcSumEtConeDR04_miniAOD_[0][0] =
2285       iBooker.book1D(histname + "All_miniAOD", "hcalTowerBcSumEtConeDR04: All Ecal", etBin, etMin, 50.);
2286   h_hcalTowerBcSumEtConeDR04_miniAOD_[0][1] =
2287       iBooker.book1D(histname + "Barrel_miniAOD", "hcalTowerBcSumEtConeDR04: Barrel ", etBin, etMin, 50.);
2288   h_hcalTowerBcSumEtConeDR04_miniAOD_[0][2] =
2289       iBooker.book1D(histname + "Endcap_miniAOD", "hcalTowerBcSumEtConeDR04: Endcap ", etBin, etMin, 50.);
2290   histname = "isoTrkSolidConeDR04";
2291   h_isoTrkSolidConeDR04_miniAOD_[0][0] =
2292       iBooker.book1D(histname + "All_miniAOD", "isoTrkSolidConeDR04: All Ecal", etBin, etMin, etMax * 0.1);
2293   h_isoTrkSolidConeDR04_miniAOD_[0][1] =
2294       iBooker.book1D(histname + "Barrel_miniAOD", "isoTrkSolidConeDR04: Barrel ", etBin, etMin, etMax * 0.1);
2295   h_isoTrkSolidConeDR04_miniAOD_[0][2] =
2296       iBooker.book1D(histname + "Endcap_miniAOD", "isoTrkSolidConeDR04: Endcap ", etBin, etMin, etMax * 0.1);
2297   histname = "nTrkSolidConeDR04";
2298   h_nTrkSolidConeDR04_miniAOD_[0][0] =
2299       iBooker.book1D(histname + "All_miniAOD", "nTrkSolidConeDR04: All Ecal", 20, 0., 20);
2300   h_nTrkSolidConeDR04_miniAOD_[0][1] =
2301       iBooker.book1D(histname + "Barrel_miniAOD", "nTrkSolidConeDR04: Barrel ", 20, 0., 20);
2302   h_nTrkSolidConeDR04_miniAOD_[0][2] =
2303       iBooker.book1D(histname + "Endcap_miniAOD", "nTrkSolidConeDR04: Endcap ", 20, 0., 20);
2304 
2305   //  Infos from Particle Flow - isolation and ID
2306   histname = "chargedHadIso";
2307   h_chHadIso_miniAOD_[0] = iBooker.book1D(histname + "All_miniAOD", "PF chargedHadIso:  All Ecal", etBin, etMin, 20.);
2308   h_chHadIso_miniAOD_[1] = iBooker.book1D(histname + "Barrel_miniAOD", "PF chargedHadIso:  Barrel", etBin, etMin, 20.);
2309   h_chHadIso_miniAOD_[2] = iBooker.book1D(histname + "Endcap_miniAOD", "PF chargedHadIso:  Endcap", etBin, etMin, 20.);
2310   histname = "neutralHadIso";
2311   h_nHadIso_miniAOD_[0] = iBooker.book1D(histname + "All_miniAOD", "PF neutralHadIso:  All Ecal", etBin, etMin, 20.);
2312   h_nHadIso_miniAOD_[1] = iBooker.book1D(histname + "Barrel_miniAOD", "PF neutralHadIso:  Barrel", etBin, etMin, 20.);
2313   h_nHadIso_miniAOD_[2] = iBooker.book1D(histname + "Endcap_miniAOD", "PF neutralHadIso:  Endcap", etBin, etMin, 20.);
2314   histname = "photonIso";
2315   h_phoIso_miniAOD_[0] = iBooker.book1D(histname + "All_miniAOD", "PF photonIso:  All Ecal", etBin, etMin, 20.);
2316   h_phoIso_miniAOD_[1] = iBooker.book1D(histname + "Barrel_miniAOD", "PF photonIso:  Barrel", etBin, etMin, 20.);
2317   h_phoIso_miniAOD_[2] = iBooker.book1D(histname + "Endcap_miniAOD", "PF photonIso:  Endcap", etBin, etMin, 20.);
2318 
2319   iBooker.setCurrentFolder("EgammaV/" + fName_ + "/ConversionInfo");
2320 
2321   histname = "nConv";
2322   h_nConv_[0][0] = iBooker.book1D(histname + "All",
2323                                   "Number Of two-tracks Conversions per isolated candidates per events: All Ecal  ",
2324                                   10,
2325                                   -0.5,
2326                                   9.5);
2327   h_nConv_[0][1] = iBooker.book1D(histname + "Barrel",
2328                                   "Number Of two-tracks Conversions per isolated candidates per events: Ecal Barrel  ",
2329                                   10,
2330                                   -0.5,
2331                                   9.5);
2332   h_nConv_[0][2] = iBooker.book1D(histname + "Endcap",
2333                                   "Number Of two-tracks Conversions per isolated candidates per events: Ecal Endcap ",
2334                                   10,
2335                                   -0.5,
2336                                   9.5);
2337   h_nConv_[1][0] = iBooker.book1D(histname + "OneLegAll",
2338                                   "Number Of single leg Conversions per isolated candidates per events: All Ecal  ",
2339                                   10,
2340                                   -0.5,
2341                                   9.5);
2342   h_nConv_[1][1] = iBooker.book1D(histname + "OneLegBarrel",
2343                                   "Number Of single leg Conversions per isolated candidates per events: Ecal Barrel  ",
2344                                   10,
2345                                   -0.5,
2346                                   9.5);
2347   h_nConv_[1][2] = iBooker.book1D(histname + "OneLegEndcap",
2348                                   "Number Of single leg Conversions per isolated candidates per events: Ecal Endcap ",
2349                                   10,
2350                                   -0.5,
2351                                   9.5);
2352 
2353   h_convEta_[0] = iBooker.book1D("convEta1", " converted Photon Eta >1 track", etaBin, etaMin, etaMax);
2354   h_convEta_[1] = iBooker.book1D("convEta2", " converted Photon Eta =2 tracks ", etaBin, etaMin, etaMax);
2355   h_convEta_[2] = iBooker.book1D("convEta2ass", " converted Photon Eta =2 tracks, both ass ", etaBin, etaMin, etaMax);
2356   h_convPhi_[0] = iBooker.book1D("convPhi", " converted Photon  Phi ", phiBin, phiMin, phiMax);
2357 
2358   histname = "convERes";
2359   h_convERes_[0][0] =
2360       iBooker.book1D(histname + "All", " Conversion rec/true Energy: All ecal ", resBin, resMin, resMax);
2361   h_convERes_[0][1] =
2362       iBooker.book1D(histname + "Barrel", " Conversion rec/true Energy: Barrel ", resBin, resMin, resMax);
2363   h_convERes_[0][2] =
2364       iBooker.book1D(histname + "Endcap", " Conversion rec/true Energy: Endcap ", resBin, resMin, resMax);
2365 
2366   histname = "p_EResVsR";
2367   p_eResVsR_ = iBooker.bookProfile(
2368       histname + "All", " photons conversion E/Etrue vs R: all Ecal ", rBin, rMin, rMax, 100, 0., 1.5, "");
2369 
2370   histname = "convPtRes";
2371   h_convPtRes_[1][0] =
2372       iBooker.book1D(histname + "All", " Conversion Pt rec/true  from tracks : All ecal ", resBin, 0., 1.5);
2373   h_convPtRes_[1][1] =
2374       iBooker.book1D(histname + "Barrel", " Conversion Pt rec/true  from tracks: Barrel ", resBin, 0., 1.5);
2375   h_convPtRes_[1][2] =
2376       iBooker.book1D(histname + "Endcap", " Conversion Pt rec/true  from tracks: Endcap ", resBin, 0., 1.5);
2377 
2378   if (!isRunCentrally_) {
2379     histname = "r9VsTracks";
2380     h_r9VsNofTracks_[0][0] = iBooker.book2D(
2381         histname + "All", " photons r9 vs nTracks from conversions: All Ecal", r9Bin, r9Min, r9Max, 3, -0.5, 2.5);
2382     h_r9VsNofTracks_[0][1] = iBooker.book2D(
2383         histname + "Barrel", " photons r9 vs nTracks from conversions: Barrel Ecal", r9Bin, r9Min, r9Max, 3, -0.5, 2.5);
2384     h_r9VsNofTracks_[0][2] = iBooker.book2D(
2385         histname + "Endcap", " photons r9 vs nTracks from conversions: Endcap Ecal", r9Bin, r9Min, r9Max, 3, -0.5, 2.5);
2386   }
2387 
2388   histname = "mvaOut";
2389   h_mvaOut_[0] = iBooker.book1D(histname + "All", " mvaOut for all conversions : All Ecal", 100, 0., 1.);
2390   h_mvaOut_[1] = iBooker.book1D(histname + "Barrel", " mvaOut for all conversions : Barrel Ecal", 100, 0., 1.);
2391   h_mvaOut_[2] = iBooker.book1D(histname + "Endcap", " mvaOut for all conversions : Endcap Ecal", 100, 0., 1.);
2392 
2393   histname = "EoverPtracks";
2394   h_EoverPTracks_[0][0] =
2395       iBooker.book1D(histname + "BarrelPix", " photons conversion E/p: barrel pix", eoverpBin, eoverpMin, eoverpMax);
2396   h_EoverPTracks_[0][1] =
2397       iBooker.book1D(histname + "BarrelTib", " photons conversion E/p: barrel tib", eoverpBin, eoverpMin, eoverpMax);
2398   h_EoverPTracks_[0][2] =
2399       iBooker.book1D(histname + "BarrelTob", " photons conversion E/p: barrel tob ", eoverpBin, eoverpMin, eoverpMax);
2400 
2401   h_EoverPTracks_[1][0] = iBooker.book1D(histname + "All", " photons conversion E/p: all Ecal ", 100, 0., 5.);
2402   h_EoverPTracks_[1][1] = iBooker.book1D(histname + "Barrel", " photons conversion E/p: Barrel Ecal", 100, 0., 5.);
2403   h_EoverPTracks_[1][2] = iBooker.book1D(histname + "Endcap", " photons conversion E/p: Endcap Ecal ", 100, 0., 5.);
2404   histname = "EoverP_SL";
2405   h_EoverP_SL_[0] = iBooker.book1D(histname + "All", " photons single leg conversion E/p: all Ecal ", 100, 0., 5.);
2406   h_EoverP_SL_[1] = iBooker.book1D(histname + "Barrel", " photons single leg conversion E/p: Barrel Ecal", 100, 0., 5.);
2407   h_EoverP_SL_[2] =
2408       iBooker.book1D(histname + "Endcap", " photons single leg conversion E/p: Endcap Ecal ", 100, 0., 5.);
2409 
2410   histname = "PoverEtracks";
2411   h_PoverETracks_[1][0] =
2412       iBooker.book1D(histname + "All", " photons conversion p/E: all Ecal ", povereBin, povereMin, povereMax);
2413   h_PoverETracks_[1][1] =
2414       iBooker.book1D(histname + "Barrel", " photons conversion p/E: Barrel Ecal", povereBin, povereMin, povereMax);
2415   h_PoverETracks_[1][2] =
2416       iBooker.book1D(histname + "Endcap", " photons conversion p/E: Endcap Ecal ", povereBin, povereMin, povereMax);
2417 
2418   histname = "pEoverEtrueVsEta";
2419   p_EoverEtrueVsEta_[0] =
2420       iBooker.bookProfile(histname + "All",
2421                           " photons conversion with 2 (associated) reco tracks E/Etrue vs #eta: all Ecal ",
2422                           etaBin2,
2423                           etaMin,
2424                           etaMax,
2425                           100,
2426                           0.,
2427                           2.5,
2428                           "");
2429 
2430   histname = "pEoverEtrueVsR";
2431   p_EoverEtrueVsR_[0] = iBooker.bookProfile(
2432       histname + "All", " photons conversion E/Etrue vs R: all Ecal ", rBin, rMin, rMax, 100, 0., 2.5, "");
2433 
2434   histname = "pEoverEtrueVsEta";
2435   p_EoverEtrueVsEta_[1] = iBooker.bookProfile(histname + "All2",
2436                                               " photons conversion  2 reco tracks  E/Etrue vs #eta: all Ecal ",
2437                                               etaBin2,
2438                                               etaMin,
2439                                               etaMax,
2440                                               100,
2441                                               0.,
2442                                               2.5,
2443                                               "");
2444 
2445   histname = "pPoverPtrueVsEta";
2446   p_PoverPtrueVsEta_[0] = iBooker.bookProfile(
2447       histname + "All", " photons conversion P/Ptrue vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 5., "");
2448 
2449   histname = "pEoverPVsEta";
2450   p_EoverPVsEta_[0] = iBooker.bookProfile(
2451       histname + "All", " photons conversion E/P vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 5., "");
2452 
2453   if (!isRunCentrally_) {
2454     histname = "EoverEtrueVsEoverP";
2455     h2_EoverEtrueVsEoverP_[0] =
2456         iBooker.book2D(histname + "All", " photons conversion E/Etrue vs E/P: all Ecal ", 100, 0., 5., 100, 0.5, 1.5);
2457     h2_EoverEtrueVsEoverP_[1] = iBooker.book2D(
2458         histname + "Barrel", " photons conversion  E/Etrue vs E/: Barrel Ecal", 100, 0., 5., 100, 0.5, 1.5);
2459     h2_EoverEtrueVsEoverP_[2] = iBooker.book2D(
2460         histname + "Endcap", " photons conversion  E/Etrue vs E/: Endcap Ecal ", 100, 0., 5., 100, 0.5, 1.5);
2461     histname = "PoverPtrueVsEoverP";
2462     h2_PoverPtrueVsEoverP_[0] =
2463         iBooker.book2D(histname + "All", " photons conversion P/Ptrue vs E/P: all Ecal ", 100, 0., 5., 100, 0., 2.5);
2464     h2_PoverPtrueVsEoverP_[1] = iBooker.book2D(
2465         histname + "Barrel", " photons conversion  P/Ptrue vs E/: Barrel Ecal", 100, 0., 5., 100, 0., 2.5);
2466     h2_PoverPtrueVsEoverP_[2] = iBooker.book2D(
2467         histname + "Endcap", " photons conversion  P/Ptrue vs E/: Endcap Ecal ", 100, 0., 5., 100, 0., 2.5);
2468 
2469     histname = "EoverEtrueVsEta";
2470     h2_EoverEtrueVsEta_[0] =
2471         iBooker.book2D(histname + "All",
2472                        " photons conversion with 2 (associated) reco tracks  E/Etrue vs #eta: all Ecal ",
2473                        etaBin2,
2474                        etaMin,
2475                        etaMax,
2476                        100,
2477                        0.,
2478                        2.5);
2479 
2480     histname = "EoverEtrueVsEta";
2481     h2_EoverEtrueVsEta_[1] = iBooker.book2D(histname + "All2",
2482                                             " photons conversion  2 reco tracks  E/Etrue vs #eta: all Ecal ",
2483                                             etaBin2,
2484                                             etaMin,
2485                                             etaMax,
2486                                             100,
2487                                             0.,
2488                                             2.5);
2489 
2490     histname = "EoverEtrueVsR";
2491     h2_EoverEtrueVsR_[0] =
2492         iBooker.book2D(histname + "All", " photons conversion E/Etrue vs R: all Ecal ", rBin, rMin, rMax, 100, 0., 2.5);
2493 
2494     histname = "PoverPtrueVsEta";
2495     h2_PoverPtrueVsEta_[0] = iBooker.book2D(
2496         histname + "All", " photons conversion P/Ptrue vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 5.);
2497 
2498     histname = "EoverPVsEta";
2499     h2_EoverPVsEta_[0] = iBooker.book2D(
2500         histname + "All", " photons conversion E/P vs #eta: all Ecal ", etaBin2, etaMin, etaMax, 100, 0., 5.);
2501 
2502     histname = "EoverPVsR";
2503     h2_EoverPVsR_[0] =
2504         iBooker.book2D(histname + "All", " photons conversion E/P vs R: all Ecal ", rBin, rMin, rMax, 100, 0., 5.);
2505 
2506     histname = "etaVsRsim";
2507     h2_etaVsRsim_[0] = iBooker.book2D(histname + "All",
2508                                       " eta(sim) vs R (sim) for associated conversions: all Ecal ",
2509                                       etaBin,
2510                                       etaMin,
2511                                       etaMax,
2512                                       rBin,
2513                                       rMin,
2514                                       rMax);
2515     histname = "etaVsRreco";
2516     h2_etaVsRreco_[0] = iBooker.book2D(histname + "All",
2517                                        " eta(reco) vs R (reco) for associated conversions: all Ecal ",
2518                                        etaBin,
2519                                        etaMin,
2520                                        etaMax,
2521                                        rBin,
2522                                        rMin,
2523                                        rMax);
2524   }
2525 
2526   histname = "pEoverPVsR";
2527   p_EoverPVsR_[0] = iBooker.bookProfile(
2528       histname + "All", " photons conversion E/P vs R: all Ecal ", rBin, rMin, rMax, 100, 0., 5., "");
2529 
2530   histname = "hInvMass";
2531   h_invMass_[0][0] = iBooker.book1D(
2532       histname + "All_AllTracks", " Photons:Tracks from conversion: Pair invariant mass: all Ecal ", 100, 0., 1.5);
2533   h_invMass_[0][1] = iBooker.book1D(
2534       histname + "Barrel_AllTracks", " Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ", 100, 0., 1.5);
2535   h_invMass_[0][2] = iBooker.book1D(
2536       histname + "Endcap_AllTracks", " Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ", 100, 0., 1.5);
2537   histname = "hInvMass";
2538   h_invMass_[1][0] = iBooker.book1D(
2539       histname + "All_AssTracks", " Photons:Tracks from conversion: Pair invariant mass: all Ecal ", 100, 0., 1.5);
2540   h_invMass_[1][1] = iBooker.book1D(
2541       histname + "Barrel_AssTracks", " Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal ", 100, 0., 1.5);
2542   h_invMass_[1][2] = iBooker.book1D(
2543       histname + "Endcap_AssTracks", " Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal ", 100, 0., 1.5);
2544 
2545   histname = "hDPhiTracksAtVtx";
2546   h_DPhiTracksAtVtx_[1][0] = iBooker.book1D(histname + "All",
2547                                             " Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal",
2548                                             dPhiTracksBin,
2549                                             dPhiTracksMin,
2550                                             dPhiTracksMax);
2551   h_DPhiTracksAtVtx_[1][1] =
2552       iBooker.book1D(histname + "Barrel",
2553                      " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal",
2554                      dPhiTracksBin,
2555                      dPhiTracksMin,
2556                      dPhiTracksMax);
2557   h_DPhiTracksAtVtx_[1][2] =
2558       iBooker.book1D(histname + "Endcap",
2559                      " Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal",
2560                      dPhiTracksBin,
2561                      dPhiTracksMin,
2562                      dPhiTracksMax);
2563 
2564   if (!isRunCentrally_) {
2565     histname = "hDPhiTracksAtVtxVsEta";
2566     h2_DPhiTracksAtVtxVsEta_ = iBooker.book2D(histname + "All",
2567                                               "  Photons:Tracks from conversions: #delta#phi Tracks at vertex vs #eta",
2568                                               etaBin2,
2569                                               etaMin,
2570                                               etaMax,
2571                                               100,
2572                                               -0.5,
2573                                               0.5);
2574 
2575     histname = "hDPhiTracksAtVtxVsR";
2576     h2_DPhiTracksAtVtxVsR_ = iBooker.book2D(histname + "All",
2577                                             "  Photons:Tracks from conversions: #delta#phi Tracks at vertex vs R",
2578                                             rBin,
2579                                             rMin,
2580                                             rMax,
2581                                             100,
2582                                             -0.5,
2583                                             0.5);
2584 
2585     histname = "hDCotTracksVsEta";
2586     h2_DCotTracksVsEta_ = iBooker.book2D(histname + "All",
2587                                          "  Photons:Tracks from conversions:  #delta cotg(#Theta) Tracks vs #eta",
2588                                          etaBin2,
2589                                          etaMin,
2590                                          etaMax,
2591                                          100,
2592                                          -0.2,
2593                                          0.2);
2594 
2595     histname = "hDCotTracksVsR";
2596     h2_DCotTracksVsR_ = iBooker.book2D(histname + "All",
2597                                        "  Photons:Tracks from conversions:  #delta cotg(#Theta)  Tracks at vertex vs R",
2598                                        rBin,
2599                                        rMin,
2600                                        rMax,
2601                                        100,
2602                                        -0.2,
2603                                        0.2);
2604 
2605     histname = "h2_DPhiTracksAtEcalVsR";
2606     if (fName_ != "pfPhotonValidator" && fName_ != "oldpfPhotonValidator")
2607       h2_DPhiTracksAtEcalVsR_ = iBooker.book2D(histname + "All",
2608                                                " Photons:Tracks from conversions:  #delta#phi at Ecal vs R : all Ecal ",
2609                                                rBin,
2610                                                rMin,
2611                                                rMax,
2612                                                dPhiTracksBin,
2613                                                0.,
2614                                                dPhiTracksMax);
2615 
2616     histname = "h2_DPhiTracksAtEcalVsEta";
2617     if (fName_ != "pfPhotonValidator" && fName_ != "oldpfPhotonValidator")
2618       h2_DPhiTracksAtEcalVsEta_ =
2619           iBooker.book2D(histname + "All",
2620                          " Photons:Tracks from conversions:  #delta#phi at Ecal vs #eta : all Ecal ",
2621                          etaBin2,
2622                          etaMin,
2623                          etaMax,
2624                          dPhiTracksBin,
2625                          0.,
2626                          dPhiTracksMax);
2627   }
2628 
2629   histname = "pDPhiTracksAtVtxVsEta";
2630   p_DPhiTracksAtVtxVsEta_ =
2631       iBooker.bookProfile(histname + "All",
2632                           " Photons:Tracks from conversions: #delta#phi Tracks at vertex vs #eta ",
2633                           etaBin2,
2634                           etaMin,
2635                           etaMax,
2636                           100,
2637                           -0.5,
2638                           0.5,
2639                           "");
2640 
2641   histname = "pDPhiTracksAtVtxVsR";
2642   p_DPhiTracksAtVtxVsR_ = iBooker.bookProfile(histname + "All",
2643                                               " Photons:Tracks from conversions: #delta#phi Tracks at vertex vs R ",
2644                                               rBin,
2645                                               rMin,
2646                                               rMax,
2647                                               100,
2648                                               -0.5,
2649                                               0.5,
2650                                               "");
2651 
2652   histname = "hDCotTracks";
2653   h_DCotTracks_[1][0] = iBooker.book1D(histname + "All",
2654                                        " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal ",
2655                                        dCotTracksBin,
2656                                        dCotTracksMin,
2657                                        dCotTracksMax);
2658   h_DCotTracks_[1][1] = iBooker.book1D(histname + "Barrel",
2659                                        " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal ",
2660                                        dCotTracksBin,
2661                                        dCotTracksMin,
2662                                        dCotTracksMax);
2663   h_DCotTracks_[1][2] = iBooker.book1D(histname + "Endcap",
2664                                        " Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal ",
2665                                        dCotTracksBin,
2666                                        dCotTracksMin,
2667                                        dCotTracksMax);
2668 
2669   histname = "pDCotTracksVsEta";
2670   p_DCotTracksVsEta_ = iBooker.bookProfile(histname + "All",
2671                                            " Photons:Tracks from conversions:  #delta cotg(#Theta) Tracks vs #eta ",
2672                                            etaBin2,
2673                                            etaMin,
2674                                            etaMax,
2675                                            100,
2676                                            -0.2,
2677                                            0.2,
2678                                            "");
2679 
2680   histname = "pDCotTracksVsR";
2681   p_DCotTracksVsR_ =
2682       iBooker.bookProfile(histname + "All",
2683                           " Photons:Tracks from conversions:  #delta cotg(#Theta) Tracks at vertex vs R ",
2684                           rBin,
2685                           rMin,
2686                           rMax,
2687                           100,
2688                           -0.2,
2689                           0.2,
2690                           "");
2691 
2692   histname = "hDistMinAppTracks";
2693   h_distMinAppTracks_[1][0] = iBooker.book1D(histname + "All",
2694                                              " Photons:Tracks from conversions Min Approach Dist Tracks: all Ecal ",
2695                                              dEtaTracksBin,
2696                                              -0.1,
2697                                              0.6);
2698   h_distMinAppTracks_[1][1] = iBooker.book1D(histname + "Barrel",
2699                                              " Photons:Tracks from conversions Min Approach Dist Tracks: Barrel Ecal ",
2700                                              dEtaTracksBin,
2701                                              -0.1,
2702                                              0.6);
2703   h_distMinAppTracks_[1][2] = iBooker.book1D(histname + "Endcap",
2704                                              " Photons:Tracks from conversions Min Approach Dist Tracks: Endcap Ecal ",
2705                                              dEtaTracksBin,
2706                                              -0.1,
2707                                              0.6);
2708 
2709   // if ( fName_ != "pfPhotonValidator" &&  fName_ != "oldpfPhotonValidator" ) {
2710   histname = "hDPhiTracksAtEcal";
2711   h_DPhiTracksAtEcal_[1][0] = iBooker.book1D(histname + "All",
2712                                              " Photons:Tracks from conversions:  #delta#phi at Ecal : all Ecal ",
2713                                              dPhiTracksBin,
2714                                              0.,
2715                                              dPhiTracksMax);
2716   h_DPhiTracksAtEcal_[1][1] = iBooker.book1D(histname + "Barrel",
2717                                              " Photons:Tracks from conversions:  #delta#phi at Ecal : Barrel Ecal ",
2718                                              dPhiTracksBin,
2719                                              0.,
2720                                              dPhiTracksMax);
2721   h_DPhiTracksAtEcal_[1][2] = iBooker.book1D(histname + "Endcap",
2722                                              " Photons:Tracks from conversions:  #delta#phi at Ecal : Endcap Ecal ",
2723                                              dPhiTracksBin,
2724                                              0.,
2725                                              dPhiTracksMax);
2726 
2727   histname = "pDPhiTracksAtEcalVsR";
2728   p_DPhiTracksAtEcalVsR_ = iBooker.bookProfile(histname + "All",
2729                                                " Photons:Tracks from conversions:  #delta#phi at Ecal  vs R ",
2730                                                rBin,
2731                                                rMin,
2732                                                rMax,
2733                                                dPhiTracksBin,
2734                                                0.,
2735                                                dPhiTracksMax,
2736                                                "");
2737 
2738   histname = "pDPhiTracksAtEcalVsEta";
2739   p_DPhiTracksAtEcalVsEta_ = iBooker.bookProfile(histname + "All",
2740                                                  " Photons:Tracks from conversions:  #delta#phi at Ecal  vs #eta ",
2741                                                  etaBin2,
2742                                                  etaMin,
2743                                                  etaMax,
2744                                                  dPhiTracksBin,
2745                                                  0.,
2746                                                  dPhiTracksMax,
2747                                                  "");
2748 
2749   histname = "hDEtaTracksAtEcal";
2750   h_DEtaTracksAtEcal_[1][0] = iBooker.book1D(histname + "All",
2751                                              " Photons:Tracks from conversions:  #delta#eta at Ecal : all Ecal ",
2752                                              dEtaTracksBin,
2753                                              dEtaTracksMin,
2754                                              dEtaTracksMax);
2755   h_DEtaTracksAtEcal_[1][1] = iBooker.book1D(histname + "Barrel",
2756                                              " Photons:Tracks from conversions:  #delta#eta at Ecal : Barrel Ecal ",
2757                                              dEtaTracksBin,
2758                                              dEtaTracksMin,
2759                                              dEtaTracksMax);
2760   h_DEtaTracksAtEcal_[1][2] = iBooker.book1D(histname + "Endcap",
2761                                              " Photons:Tracks from conversions:  #delta#eta at Ecal : Endcap Ecal ",
2762                                              dEtaTracksBin,
2763                                              dEtaTracksMin,
2764                                              dEtaTracksMax);
2765 
2766   //  }
2767 
2768   h_convVtxRvsZ_[0] = iBooker.book2D("convVtxRvsZAll",
2769                                      " Photon Reco conversion vtx position",
2770                                      zBinForXray,
2771                                      zMinForXray,
2772                                      zMaxForXray,
2773                                      rBinForXray,
2774                                      rMinForXray,
2775                                      rMaxForXray);
2776   h_convVtxRvsZ_[1] = iBooker.book2D("convVtxRvsZBarrel",
2777                                      " Photon Reco conversion vtx position",
2778                                      zBinForXray,
2779                                      zMinForXray,
2780                                      zMaxForXray,
2781                                      rBinForXray,
2782                                      rMinForXray,
2783                                      rMaxForXray);
2784   h_convVtxRvsZ_[2] = iBooker.book2D("convVtxRvsZEndcap",
2785                                      " Photon Reco conversion vtx position",
2786                                      zBin2ForXray,
2787                                      zMinForXray,
2788                                      zMaxForXray,
2789                                      rBinForXray,
2790                                      rMinForXray,
2791                                      rMaxForXray);
2792   h_convVtxYvsX_ = iBooker.book2D(
2793       "convVtxYvsXTrkBarrel", " Photon Reco conversion vtx position, (x,y) eta<1 ", 100, -80., 80., 100, -80., 80.);
2794   //
2795   h_convSLVtxRvsZ_[0] = iBooker.book2D("convSLVtxRvsZAll",
2796                                        " Photon Reco single leg conversion innermost hit  position",
2797                                        zBinForXray,
2798                                        zMinForXray,
2799                                        zMaxForXray,
2800                                        rBinForXray,
2801                                        rMinForXray,
2802                                        rMaxForXray);
2803   h_convSLVtxRvsZ_[1] = iBooker.book2D("convSLVtxRvsZBarrel",
2804                                        " Photon Reco single leg conversion innermost hit position",
2805                                        zBinForXray,
2806                                        zMinForXray,
2807                                        zMaxForXray,
2808                                        rBinForXray,
2809                                        rMinForXray,
2810                                        rMaxForXray);
2811   h_convSLVtxRvsZ_[2] = iBooker.book2D("convSLVtxRvsZEndcap",
2812                                        " Photon Reco single leg conversion innermost hit position",
2813                                        zBin2ForXray,
2814                                        zMinForXray,
2815                                        zMaxForXray,
2816                                        rBinForXray,
2817                                        rMinForXray,
2818                                        rMaxForXray);
2819 
2820   /// zooms
2821   if (!isRunCentrally_) {
2822     h_convVtxRvsZ_zoom_[0] = iBooker.book2D("convVtxRvsZBarrelZoom1",
2823                                             " Photon Reco conversion vtx position",
2824                                             zBinForXray,
2825                                             zMinForXray,
2826                                             zMaxForXray,
2827                                             rBinForXray,
2828                                             -10.,
2829                                             40.);
2830     h_convVtxRvsZ_zoom_[1] = iBooker.book2D("convVtxRvsZBarrelZoom2",
2831                                             " Photon Reco conversion vtx position",
2832                                             zBinForXray,
2833                                             zMinForXray,
2834                                             zMaxForXray,
2835                                             rBinForXray,
2836                                             -10.,
2837                                             20.);
2838     h_convVtxYvsX_zoom_[0] = iBooker.book2D("convVtxYvsXTrkBarrelZoom1",
2839                                             " Photon Reco conversion vtx position, (x,y) eta<1 ",
2840                                             100,
2841                                             -40.,
2842                                             40.,
2843                                             100,
2844                                             -40.,
2845                                             40.);
2846     h_convVtxYvsX_zoom_[1] = iBooker.book2D("convVtxYvsXTrkBarrelZoom2",
2847                                             " Photon Reco conversion vtx position, (x,y) eta<1 ",
2848                                             100,
2849                                             -20.,
2850                                             20.,
2851                                             100,
2852                                             -20.,
2853                                             20.);
2854   }
2855 
2856   h_convVtxdX_ = iBooker.book1D("convVtxdX", " Photon Reco conversion vtx dX", 100, -20., 20.);
2857   h_convVtxdY_ = iBooker.book1D("convVtxdY", " Photon Reco conversion vtx dY", 100, -20., 20.);
2858   h_convVtxdZ_ = iBooker.book1D("convVtxdZ", " Photon Reco conversion vtx dZ", 100, -20., 20.);
2859   h_convVtxdR_ = iBooker.book1D("convVtxdR", " Photon Reco conversion vtx dR", 100, -20., 20.);
2860 
2861   h_convVtxdX_barrel_ =
2862       iBooker.book1D("convVtxdX_barrel", " Photon Reco conversion vtx dX, |eta|<=1.2", 100, -20., 20.);
2863   h_convVtxdY_barrel_ =
2864       iBooker.book1D("convVtxdY_barrel", " Photon Reco conversion vtx dY, |eta|<=1.2 ", 100, -20., 20.);
2865   h_convVtxdZ_barrel_ =
2866       iBooker.book1D("convVtxdZ_barrel", " Photon Reco conversion vtx dZ, |eta|<=1.2,", 100, -20., 20.);
2867   h_convVtxdR_barrel_ =
2868       iBooker.book1D("convVtxdR_barrel", " Photon Reco conversion vtx dR, |eta|<=1.2", 100, -20., 20.);
2869   h_convVtxdX_endcap_ =
2870       iBooker.book1D("convVtxdX_endcap", " Photon Reco conversion vtx dX,  |eta|>1.2", 100, -20., 20.);
2871   h_convVtxdY_endcap_ =
2872       iBooker.book1D("convVtxdY_endcap", " Photon Reco conversion vtx dY,  |eta|>1.2", 100, -20., 20.);
2873   h_convVtxdZ_endcap_ =
2874       iBooker.book1D("convVtxdZ_endcap", " Photon Reco conversion vtx dZ,  |eta|>1.2", 100, -20., 20.);
2875   h_convVtxdR_endcap_ =
2876       iBooker.book1D("convVtxdR_endcap", " Photon Reco conversion vtx dR,  |eta|>1.2 ", 100, -20., 20.);
2877 
2878   h_convVtxdPhi_ = iBooker.book1D("convVtxdPhi", " Photon Reco conversion vtx dPhi", 100, -0.005, 0.005);
2879   h_convVtxdEta_ = iBooker.book1D("convVtxdEta", " Photon Reco conversion vtx dEta", 100, -0.5, 0.5);
2880 
2881   if (!isRunCentrally_) {
2882     h2_convVtxdRVsR_ =
2883         iBooker.book2D("h2ConvVtxdRVsR", "Photon Reco conversion vtx dR vsR", rBin, rMin, rMax, 100, -20., 20.);
2884     h2_convVtxdRVsEta_ = iBooker.book2D(
2885         "h2ConvVtxdRVsEta", "Photon Reco conversion vtx dR vs Eta", etaBin2, etaMin, etaMax, 100, -20., 20.);
2886   }
2887 
2888   p_convVtxdRVsR_ =
2889       iBooker.bookProfile("pConvVtxdRVsR", "Photon Reco conversion vtx dR vsR", rBin, rMin, rMax, 100, -20., 20., "");
2890   p_convVtxdRVsEta_ = iBooker.bookProfile(
2891       "pConvVtxdRVsEta", "Photon Reco conversion vtx dR vs Eta", etaBin2, etaMin, etaMax, 100, -20., 20., "");
2892   p_convVtxdXVsX_ = iBooker.bookProfile("pConvVtxdXVsX", "Conversion vtx dX vs X", 120, -60, 60, 100, -20., 20., "");
2893   p_convVtxdYVsY_ = iBooker.bookProfile("pConvVtxdYVsY", "Conversion vtx dY vs Y", 120, -60, 60, 100, -20., 20., "");
2894   p_convVtxdZVsZ_ =
2895       iBooker.bookProfile("pConvVtxdZVsZ", "Conversion vtx dZ vs Z", zBin, zMin, zMax, 100, -20., 20., "");
2896 
2897   if (!isRunCentrally_) {
2898     h2_convVtxRrecVsTrue_ = iBooker.book2D(
2899         "h2ConvVtxRrecVsTrue", "Photon Reco conversion vtx R rec vs true", rBin, rMin, rMax, rBin, rMin, rMax);
2900   }
2901 
2902   histname = "vtxChi2";
2903   h_vtxChi2_[0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 100, chi2Min, chi2Max);
2904   h_vtxChi2_[1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 100, chi2Min, chi2Max);
2905   h_vtxChi2_[2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 100, chi2Min, chi2Max);
2906   histname = "vtxChi2Prob";
2907   h_vtxChi2Prob_[0] = iBooker.book1D(histname + "All", "vertex #chi^{2} all", 100, 0., 1.);
2908   h_vtxChi2Prob_[1] = iBooker.book1D(histname + "Barrel", "vertex #chi^{2} barrel", 100, 0., 1.);
2909   h_vtxChi2Prob_[2] = iBooker.book1D(histname + "Endcap", "vertex #chi^{2} endcap", 100, 0., 1.);
2910 
2911   histname = "zPVFromTracks";
2912   h_zPVFromTracks_[0] = iBooker.book1D(histname + "All", " Photons: PV z from conversion tracks", 100, -30., 30.);
2913   h_zPVFromTracks_[1] = iBooker.book1D(histname + "Barrel", " Photons: PV z from conversion tracks", 100, -30., 30.);
2914   h_zPVFromTracks_[2] = iBooker.book1D(histname + "Endcap", " Photons: PV z from conversion tracks", 100, -30., 30.);
2915   h_zPVFromTracks_[3] = iBooker.book1D(histname + "EndcapP", " Photons: PV z from conversion tracks", 100, -30., 30.);
2916   h_zPVFromTracks_[4] = iBooker.book1D(histname + "EndcapM", " Photons: PV z from conversion tracks", 100, -30., 30.);
2917   histname = "dzPVFromTracks";
2918   h_dzPVFromTracks_[0] =
2919       iBooker.book1D(histname + "All", " Photons: PV Z_rec - Z_true from conversion tracks", 100, -10., 10.);
2920   h_dzPVFromTracks_[1] =
2921       iBooker.book1D(histname + "Barrel", " Photons: PV Z_rec - Z_true from conversion tracks", 100, -10., 10.);
2922   h_dzPVFromTracks_[2] =
2923       iBooker.book1D(histname + "Endcap", " Photons: PV Z_rec - Z_true from conversion tracks", 100, -10., 10.);
2924   h_dzPVFromTracks_[3] =
2925       iBooker.book1D(histname + "EndcapP", " Photons: PV Z_rec - Z_true from conversion tracks", 100, -10., 10.);
2926   h_dzPVFromTracks_[4] =
2927       iBooker.book1D(histname + "EndcapM", " Photons: PV Z_rec - Z_true from conversion tracks", 100, -10., 10.);
2928   p_dzPVVsR_ =
2929       iBooker.bookProfile("pdzPVVsR", "Photon Reco conversions: dz(PV) vs R", rBin, rMin, rMax, 100, -3., 3., "");
2930   p_dzPVVsEta_ = iBooker.bookProfile(
2931       "pdzPVVsEta", "Photon Reco conversions: dz(PV) vs Eta", etaBin, etaMin, etaMax, 100, -3., 3., "");
2932 
2933   if (!isRunCentrally_) {
2934     h2_dzPVVsR_ = iBooker.book2D("h2dzPVVsR", "Photon Reco conversions: dz(PV) vs R", rBin, rMin, rMax, 100, -3., 3.);
2935   }
2936 
2937   //////////////////// plots per track
2938   if (!isRunCentrally_) {
2939     histname = "nHitsVsEta";
2940     nHitsVsEta_[0] = iBooker.book2D(histname + "AllTracks",
2941                                     "Photons:Tracks from conversions: # of hits vs #eta all tracks",
2942                                     etaBin,
2943                                     etaMin,
2944                                     etaMax,
2945                                     25,
2946                                     0.,
2947                                     25.);
2948 
2949     histname = "nHitsVsEta";
2950     nHitsVsEta_[1] = iBooker.book2D(histname + "AssTracks",
2951                                     "Photons:Tracks from conversions: # of hits vs #eta associated tracks",
2952                                     etaBin,
2953                                     etaMin,
2954                                     etaMax,
2955                                     25,
2956                                     0.,
2957                                     25.);
2958 
2959     histname = "nHitsVsR";
2960     nHitsVsR_[0] = iBooker.book2D(histname + "AllTracks",
2961                                   "Photons:Tracks from conversions: # of hits vs radius all tracks",
2962                                   rBin,
2963                                   rMin,
2964                                   rMax,
2965                                   25,
2966                                   0.,
2967                                   25);
2968 
2969     histname = "nHitsVsR";
2970     nHitsVsR_[1] = iBooker.book2D(histname + "AssTracks",
2971                                   "Photons:Tracks from conversions: # of hits vs radius associated tracks",
2972                                   rBin,
2973                                   rMin,
2974                                   rMax,
2975                                   25,
2976                                   0.,
2977                                   25);
2978 
2979     histname = "h2Chi2VsEta";
2980     h2_Chi2VsEta_[0] = iBooker.book2D(
2981         histname + "All", " Reco Track  #chi^{2} vs #eta: All ", etaBin2, etaMin, etaMax, 100, chi2Min, chi2Max);
2982 
2983     histname = "h2Chi2VsR";
2984     h2_Chi2VsR_[0] =
2985         iBooker.book2D(histname + "All", " Reco Track  #chi^{2} vs R: All ", rBin, rMin, rMax, 100, chi2Min, chi2Max);
2986   }
2987 
2988   histname = "h_nHitsVsEta";
2989   p_nHitsVsEta_[0] = iBooker.bookProfile(histname + "AllTracks",
2990                                          "Photons:Tracks from conversions: # of hits vs #eta all tracks",
2991                                          etaBin,
2992                                          etaMin,
2993                                          etaMax,
2994                                          25,
2995                                          -0.5,
2996                                          24.5,
2997                                          "");
2998 
2999   histname = "h_nHitsVsEta";
3000   p_nHitsVsEta_[1] = iBooker.bookProfile(histname + "AssTracks",
3001                                          "Photons:Tracks from conversions: # of hits vs #eta associated tracks",
3002                                          etaBin,
3003                                          etaMin,
3004                                          etaMax,
3005                                          25,
3006                                          -0.5,
3007                                          24.5,
3008                                          "");
3009 
3010   histname = "p_nHitsVsEtaSL";
3011   p_nHitsVsEtaSL_[0] = iBooker.bookProfile(histname + "AllTracks",
3012                                            "Photons:Tracks from single leg conversions: # of hits vs #eta all tracks",
3013                                            etaBin,
3014                                            etaMin,
3015                                            etaMax,
3016                                            25,
3017                                            -0.5,
3018                                            24.5,
3019                                            "");
3020 
3021   histname = "h_nHitsVsR";
3022   p_nHitsVsR_[0] = iBooker.bookProfile(histname + "AllTracks",
3023                                        "Photons:Tracks from conversions: # of hits vs radius all tracks",
3024                                        rBin,
3025                                        rMin,
3026                                        rMax,
3027                                        25,
3028                                        -0.5,
3029                                        24.5,
3030                                        "");
3031   histname = "p_nHitsVsRSL";
3032   p_nHitsVsRSL_[0] = iBooker.bookProfile(histname + "AllTracks",
3033                                          "Photons:Tracks from single leg conversions: # of hits vs radius all tracks",
3034                                          rBin,
3035                                          rMin,
3036                                          rMax,
3037                                          25,
3038                                          -0.5,
3039                                          24.5,
3040                                          "");
3041 
3042   histname = "tkChi2";
3043   h_tkChi2_[0] = iBooker.book1D(
3044       histname + "AllTracks", "Photons:Tracks from conversions: #chi^{2} of all tracks", 100, chi2Min, chi2Max);
3045   histname = "tkChi2SL";
3046   h_tkChi2SL_[0] = iBooker.book1D(histname + "AllTracks",
3047                                   "Photons:Tracks from single leg conversions: #chi^{2} of associated  tracks",
3048                                   100,
3049                                   chi2Min,
3050                                   chi2Max);
3051   histname = "tkChi2Large";
3052   h_tkChi2Large_[0] = iBooker.book1D(
3053       histname + "AllTracks", "Photons:Tracks from conversions: #chi^{2} of all tracks", 1000, 0., 5000.0);
3054 
3055   histname = "h_nHitsVsR";
3056   p_nHitsVsR_[1] = iBooker.bookProfile(histname + "AssTracks",
3057                                        "Photons:Tracks from conversions: # of hits vs radius associated tracks",
3058                                        rBin,
3059                                        rMin,
3060                                        rMax,
3061                                        25,
3062                                        -0.5,
3063                                        24.5,
3064                                        "");
3065 
3066   histname = "tkChi2";
3067   h_tkChi2_[1] = iBooker.book1D(
3068       histname + "AssTracks", "Photons:Tracks from conversions: #chi^{2} of associated  tracks", 100, chi2Min, chi2Max);
3069   histname = "tkChi2Large";
3070   h_tkChi2Large_[1] = iBooker.book1D(
3071       histname + "AssTracks", "Photons:Tracks from conversions: #chi^{2} of associated  tracks", 1000, 0., 5000.0);
3072 
3073   histname = "pChi2VsEta";
3074   p_Chi2VsEta_[0] = iBooker.bookProfile(
3075       histname + "All", " Reco Track #chi^{2} vs #eta : All ", etaBin2, etaMin, etaMax, 100, chi2Min, chi2Max, "");
3076 
3077   histname = "pChi2VsR";
3078   p_Chi2VsR_[0] = iBooker.bookProfile(
3079       histname + "All", " Reco Track #chi^{2} vas R : All ", rBin, rMin, rMax, 100, chi2Min, chi2Max, "");
3080 
3081   histname = "hTkD0";
3082   h_TkD0_[0] = iBooker.book1D(histname + "All", " Reco Track D0*q: All ", 100, -0.1, 0.6);
3083   h_TkD0_[1] = iBooker.book1D(histname + "Barrel", " Reco Track D0*q: Barrel ", 100, -0.1, 0.6);
3084   h_TkD0_[2] = iBooker.book1D(histname + "Endcap", " Reco Track D0*q: Endcap ", 100, -0.1, 0.6);
3085 
3086   histname = "hTkPtPull";
3087   h_TkPtPull_[0] = iBooker.book1D(histname + "All", " Reco Track Pt pull: All ", 100, -10., 10.);
3088   histname = "hTkPtPull";
3089   h_TkPtPull_[1] = iBooker.book1D(histname + "Barrel", " Reco Track Pt pull: Barrel ", 100, -10., 10.);
3090   histname = "hTkPtPull";
3091   h_TkPtPull_[2] = iBooker.book1D(histname + "Endcap", " Reco Track Pt pull: Endcap ", 100, -10., 10.);
3092 
3093   histname = "pTkPtPullEta";
3094   p_TkPtPull_[0] =
3095       iBooker.bookProfile(histname + "All", " Reco Track Pt pull: All ", etaBin2, etaMin, etaMax, 100, -10., 10., " ");
3096 
3097   if (!isRunCentrally_) {
3098     histname = "h2TkPtPullEta";
3099     h2_TkPtPull_[0] =
3100         iBooker.book2D(histname + "All", " Reco Track Pt pull: All ", etaBin2, etaMin, etaMax, 100, -10., 10.);
3101 
3102     histname = "PtRecVsPtSim";
3103     h2_PtRecVsPtSim_[0] =
3104         iBooker.book2D(histname + "All", "Pt Rec vs Pt sim: All ", etBin, etMin, etMax, etBin, etMin, etMax);
3105     h2_PtRecVsPtSim_[1] =
3106         iBooker.book2D(histname + "Barrel", "Pt Rec vs Pt sim: Barrel ", etBin, etMin, etMax, etBin, etMin, etMax);
3107     h2_PtRecVsPtSim_[2] =
3108         iBooker.book2D(histname + "Endcap", "Pt Rec vs Pt sim: Endcap ", etBin, etMin, etMax, etBin, etMin, etMax);
3109     histname = "PtRecVsPtSimMixProv";
3110     h2_PtRecVsPtSimMixProv_ = iBooker.book2D(
3111         histname + "All", "Pt Rec vs Pt sim All for mix with general tracks ", etBin, etMin, etMax, etBin, etMin, etMax);
3112   }
3113 
3114   // if ( fName_ != "pfPhotonValidator" &&  fName_ != "oldpfPhotonValidator" ) {
3115   histname = "eBcOverTkPout";
3116   hBCEnergyOverTrackPout_[0] = iBooker.book1D(histname + "All", "Matrching BC E/P_out: all Ecal ", 100, 0., 5.);
3117   hBCEnergyOverTrackPout_[1] = iBooker.book1D(histname + "Barrel", "Matrching BC E/P_out: Barrel ", 100, 0., 5.);
3118   hBCEnergyOverTrackPout_[2] = iBooker.book1D(histname + "Endcap", "Matrching BC E/P_out: Endcap ", 100, 0., 5.);
3119   // }
3120 
3121   ////////////// test on OutIn tracks
3122   h_OIinnermostHitR_ = iBooker.book1D("OIinnermostHitR", " R innermost hit for OI tracks ", 50, 0., 25);
3123   h_IOinnermostHitR_ = iBooker.book1D("IOinnermostHitR", " R innermost hit for IO tracks ", 50, 0., 25);
3124 
3125   /// test track provenance
3126   h_trkProv_[0] = iBooker.book1D("allTrkProv", " Track pair provenance ", 4, 0., 4.);
3127   h_trkProv_[1] = iBooker.book1D("assTrkProv", " Track pair provenance ", 4, 0., 4.);
3128   //
3129   h_trkAlgo_ = iBooker.book1D("allTrackAlgo",
3130                               " Track Algo ",
3131                               reco::TrackBase::algoSize,
3132                               -0.5,
3133                               static_cast<double>(reco::TrackBase::algoSize) - 0.5);
3134   h_convAlgo_ = iBooker.book1D("allConvAlgo", " Conv Algo ", 5, -0.5, 4.5);
3135   h_convQuality_ = iBooker.book1D("allConvQuality", "Conv quality ", 11, -0.5, 11.);
3136 
3137   // histos for fake rate
3138   histname = "h_RecoConvTwoTracksEta";
3139   h_RecoConvTwoTracks_[0] =
3140       iBooker.book1D(histname, " All reco conversions with 2 reco  tracks: simulated #eta", etaBin2, etaMin, etaMax);
3141   histname = "h_RecoConvTwoTracksPhi";
3142   h_RecoConvTwoTracks_[1] =
3143       iBooker.book1D(histname, " All reco conversions with 2 reco tracks: simulated #phi", phiBin, phiMin, phiMax);
3144   histname = "h_RecoConvTwoTracksR";
3145   h_RecoConvTwoTracks_[2] =
3146       iBooker.book1D(histname, " All reco conversions with 2 reco tracks: simulated R", rBin, rMin, rMax);
3147   histname = "h_RecoConvTwoTracksZ";
3148   h_RecoConvTwoTracks_[3] =
3149       iBooker.book1D(histname, " All reco conversions with 2 reco tracks: simulated Z", zBin, zMin, zMax);
3150   histname = "h_RecoConvTwoTracksEt";
3151   h_RecoConvTwoTracks_[4] =
3152       iBooker.book1D(histname, " All reco conversions with 2 reco tracks: simulated Et", etBin, etMin, etMax);
3153   //
3154   histname = "h_RecoConvTwoMTracksEta";
3155   h_RecoConvTwoMTracks_[0] =
3156       iBooker.book1D(histname, " All reco conversions with 2 reco-ass tracks: simulated #eta", etaBin2, etaMin, etaMax);
3157   histname = "h_RecoConvTwoMTracksPhi";
3158   h_RecoConvTwoMTracks_[1] =
3159       iBooker.book1D(histname, " All reco conversions with 2 reco-ass tracks: simulated #phi", phiBin, phiMin, phiMax);
3160   histname = "h_RecoConvTwoMTracksR";
3161   h_RecoConvTwoMTracks_[2] =
3162       iBooker.book1D(histname, " All reco conversions with 2 reco-ass tracks: simulated R", rBin, rMin, rMax);
3163   histname = "h_RecoConvTwoMTracksZ";
3164   h_RecoConvTwoMTracks_[3] =
3165       iBooker.book1D(histname, " All reco conversions with 2 reco-ass tracks: simulated Z", zBin, zMin, zMax);
3166   histname = "h_RecoConvTwoMTracksEt";
3167   h_RecoConvTwoMTracks_[4] =
3168       iBooker.book1D(histname, " All reco conversions with 2 reco-ass tracks: simulated Et", etBin, etMin, etMax);
3169 }
3170 
3171 void PhotonValidator::dqmBeginRun(edm::Run const& r, edm::EventSetup const& theEventSetup) {
3172   //get magnetic field
3173   edm::LogInfo("ConvertedPhotonProducer") << " get magnetic field"
3174                                           << "\n";
3175   theMF_ = theEventSetup.getHandle(magneticFieldToken_);
3176 
3177   thePhotonMCTruthFinder_ = std::make_unique<PhotonMCTruthFinder>();
3178 }
3179 
3180 void PhotonValidator::dqmEndRun(edm::Run const& r, edm::EventSetup const&) { thePhotonMCTruthFinder_.reset(); }
3181 
3182 void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup) {
3183   thePhotonMCTruthFinder_->clear();
3184   using namespace edm;
3185   //  const float etaPhiDistance=0.01;
3186   // Fiducial region
3187   // const float TRK_BARL =0.9;
3188   const float BARL = 1.4442;  // DAQ TDR p.290
3189   //  const float END_LO = 1.566; // unused
3190   const float END_HI = 2.5;
3191   // Electron mass
3192   //const Float_t mElec= 0.000511;
3193 
3194   edm::Handle<reco::TrackToTrackingParticleAssociator> theHitsAssociator;
3195   e.getByLabel("trackAssociatorByHitsForPhotonValidation", theHitsAssociator);
3196   reco::TrackToTrackingParticleAssociator const* trackAssociator = theHitsAssociator.product();
3197 
3198   nEvt_++;
3199   LogInfo("PhotonValidator") << "PhotonValidator Analyzing event number: " << e.id() << " Global Counter " << nEvt_
3200                              << "\n";
3201 
3202   // get the geometry from the event setup:
3203   theCaloGeom_ = esup.getHandle(caloGeometryToken_);
3204 
3205   edm::Handle<reco::VertexCollection> vtxH;
3206   e.getByToken(offline_pvToken_, vtxH);
3207   h_nRecoVtx_->Fill(float(vtxH->size()));
3208 
3209   // Transform Track into TransientTrack (needed by the Vertex fitter)
3210   auto theTTB = esup.getHandle(transientTrackBuilderToken_);
3211 
3212   ///// Get the recontructed  photons
3213   Handle<reco::PhotonCollection> photonHandle;
3214   e.getByToken(photonCollectionToken_, photonHandle);
3215   const reco::PhotonCollection photonCollection = *(photonHandle.product());
3216   if (!photonHandle.isValid()) {
3217     edm::LogError("PhotonProducer") << "Error! Can't get the Photon collection " << std::endl;
3218     return;
3219   }
3220 
3221   // Get the  PF refined cluster  collection
3222   Handle<reco::PFCandidateCollection> pfCandidateHandle;
3223   e.getByToken(pfCandidates_, pfCandidateHandle);
3224   if (!pfCandidateHandle.isValid()) {
3225     edm::LogError("PhotonValidator") << "Error! Can't get the product pfCandidates " << std::endl;
3226   }
3227 
3228   edm::Handle<edm::ValueMap<std::vector<reco::PFCandidateRef> > > phoToParticleBasedIsoMapHandle;
3229   edm::ValueMap<std::vector<reco::PFCandidateRef> > phoToParticleBasedIsoMap;
3230   if (fName_ == "pfPhotonValidator") {
3231     e.getByToken(particleBasedIso_token, phoToParticleBasedIsoMapHandle);
3232     if (!phoToParticleBasedIsoMapHandle.isValid()) {
3233       edm::LogInfo("PhotonValidator") << "Error! Can't get the product: valueMap photons to particle based iso "
3234                                       << std::endl;
3235     }
3236     phoToParticleBasedIsoMap = *(phoToParticleBasedIsoMapHandle.product());
3237   }
3238 
3239   Handle<edm::View<reco::Track> > outInTrkHandle;
3240   Handle<edm::View<reco::Track> > inOutTrkHandle;
3241   if (!fastSim_) {
3242     //// Get the Out In CKF tracks from conversions
3243     e.getByToken(conversionOITrackPr_Token_, outInTrkHandle);
3244     //// Get the In Out  CKF tracks from conversions
3245     e.getByToken(conversionIOTrackPr_Token_, inOutTrkHandle);
3246 
3247   }  // if !fastSim
3248 
3249   //////////////////// Get the MC truth
3250   //get simtrack info
3251   std::vector<SimTrack> theSimTracks;
3252   std::vector<SimVertex> theSimVertices;
3253   edm::Handle<SimTrackContainer> SimTk;
3254   edm::Handle<SimVertexContainer> SimVtx;
3255 
3256   if (!fastSim_) {
3257     e.getByToken(g4_simTk_Token_, SimTk);
3258     e.getByToken(g4_simVtx_Token_, SimVtx);
3259   } else {
3260     e.getByToken(famos_simTk_Token_, SimTk);
3261     e.getByToken(famos_simVtx_Token_, SimVtx);
3262   }
3263 
3264   theSimTracks.insert(theSimTracks.end(), SimTk->begin(), SimTk->end());
3265   theSimVertices.insert(theSimVertices.end(), SimVtx->begin(), SimVtx->end());
3266   std::vector<PhotonMCTruth> mcPhotons = thePhotonMCTruthFinder_->find(theSimTracks, theSimVertices);
3267 
3268   edm::Handle<edm::HepMCProduct> hepMC;
3269   e.getByToken(hepMC_Token_, hepMC);
3270   const HepMC::GenEvent* myGenEvent = hepMC->GetEvent();
3271 
3272   Handle<reco::GenParticleCollection> genParticles;
3273   e.getByToken(genpartToken_, genParticles);
3274 
3275   // get generated jets
3276   Handle<reco::GenJetCollection> GenJetsHandle;
3277   e.getByToken(genjets_Token_, GenJetsHandle);
3278   reco::GenJetCollection genJetCollection = *(GenJetsHandle.product());
3279 
3280   // Get electron tracking truth
3281   bool useTP = parameters_.getParameter<bool>("useTP");
3282   TrackingParticleCollection trackingParticles;
3283   edm::Handle<TrackingParticleCollection> ElectronTPHandle;
3284   if (useTP) {
3285     if (!fastSim_) {
3286       e.getByToken(token_tp_, ElectronTPHandle);
3287       trackingParticles = *(ElectronTPHandle.product());
3288     }
3289   }
3290 
3291   //// Track association with TrackingParticles
3292   std::vector<reco::PhotonCollection::const_iterator> StoRMatchedConvertedPhotons;
3293   reco::SimToRecoCollection OISimToReco;
3294   reco::SimToRecoCollection IOSimToReco;
3295   // Reco to Sim
3296   reco::RecoToSimCollection OIRecoToSim;
3297   reco::RecoToSimCollection IORecoToSim;
3298 
3299   if (useTP) {
3300     if (!fastSim_) {
3301       // Sim to Reco
3302       OISimToReco = trackAssociator->associateSimToReco(outInTrkHandle, ElectronTPHandle);
3303       IOSimToReco = trackAssociator->associateSimToReco(inOutTrkHandle, ElectronTPHandle);
3304       // Reco to Sim
3305       OIRecoToSim = trackAssociator->associateRecoToSim(outInTrkHandle, ElectronTPHandle);
3306       IORecoToSim = trackAssociator->associateRecoToSim(inOutTrkHandle, ElectronTPHandle);
3307     }
3308   }
3309   //
3310   vector<reco::SimToRecoCollection*> StoRCollPtrs;
3311   StoRCollPtrs.push_back(&OISimToReco);
3312   StoRCollPtrs.push_back(&IOSimToReco);
3313   vector<reco::RecoToSimCollection*> RtoSCollPtrs;
3314   RtoSCollPtrs.push_back(&OIRecoToSim);
3315   RtoSCollPtrs.push_back(&IORecoToSim);
3316   //
3317   for (int i = 0; i < 2; i++)
3318     nSimPho_[i] = 0;
3319   for (int i = 0; i < 2; i++)
3320     nSimConv_[i] = 0;
3321 
3322   std::vector<reco::PhotonRef> myPhotons;
3323 
3324   for (unsigned int iPho = 0; iPho < photonHandle->size(); iPho++) {
3325     reco::PhotonRef phoRef(reco::PhotonRef(photonHandle, iPho));
3326     //  for( reco::PhotonCollection::const_iterator  iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
3327     if (fabs(phoRef->eta()) > 2.5)
3328       continue;
3329     myPhotons.push_back(phoRef);
3330   }
3331 
3332   std::sort(myPhotons.begin(), myPhotons.end(), sortPhotons());
3333   // if ( ! isRunCentrally_ ) {
3334   if (myPhotons.size() >= 2) {
3335     if (myPhotons[0]->et() > 40 && myPhotons[1]->et() > 25) {
3336       math::XYZTLorentzVector p12 = myPhotons[0]->p4() + myPhotons[1]->p4();
3337       math::XYZTLorentzVector p12_regr1 =
3338           myPhotons[0]->p4(reco::Photon::regression1) + myPhotons[1]->p4(reco::Photon::regression1);
3339       math::XYZTLorentzVector p12_regr2 =
3340           myPhotons[0]->p4(reco::Photon::regression2) + myPhotons[1]->p4(reco::Photon::regression2);
3341       float gamgamMass2 = p12.Dot(p12);
3342       float gamgamMass2_regr1 = p12_regr1.Dot(p12_regr1);
3343       float gamgamMass2_regr2 = p12_regr2.Dot(p12_regr2);
3344 
3345       //// standard ecal energy corrections
3346       if (gamgamMass2 > 0) {
3347         // total
3348         h_gamgamMass_[0][0]->Fill(sqrt(gamgamMass2));
3349         if (myPhotons[0]->isEB() && myPhotons[1]->isEB())
3350           h_gamgamMass_[0][1]->Fill(sqrt(gamgamMass2));
3351         if ((myPhotons[0]->isEE() && myPhotons[1]->isEE()) || (myPhotons[0]->isEE() && myPhotons[1]->isEB()) ||
3352             (myPhotons[0]->isEB() && myPhotons[1]->isEE()))
3353           h_gamgamMass_[0][2]->Fill(sqrt(gamgamMass2));
3354         // Golden photons
3355         if (myPhotons[0]->r9() > 0.94 && myPhotons[1]->r9() > 0.94) {
3356           h_gamgamMass_[1][0]->Fill(sqrt(gamgamMass2));
3357           if (myPhotons[0]->isEB() && myPhotons[1]->isEB())
3358             h_gamgamMass_[1][1]->Fill(sqrt(gamgamMass2));
3359           if ((myPhotons[0]->isEE() && myPhotons[1]->isEE()) || (myPhotons[0]->isEE() && myPhotons[1]->isEB()) ||
3360               (myPhotons[0]->isEB() && myPhotons[1]->isEE()))
3361             h_gamgamMass_[1][2]->Fill(sqrt(gamgamMass2));
3362         }
3363         // both photons converted
3364         if (!myPhotons[0]->conversions().empty() && !myPhotons[1]->conversions().empty()) {
3365           if (myPhotons[0]->conversions()[0]->nTracks() == 2 && myPhotons[1]->conversions()[0]->nTracks() == 2) {
3366             float chi2Prob1 = ChiSquaredProbability(myPhotons[0]->conversions()[0]->conversionVertex().chi2(),
3367                                                     myPhotons[0]->conversions()[0]->conversionVertex().ndof());
3368             float chi2Prob2 = ChiSquaredProbability(myPhotons[1]->conversions()[0]->conversionVertex().chi2(),
3369                                                     myPhotons[1]->conversions()[0]->conversionVertex().ndof());
3370             if (chi2Prob1 > 0.0005 && chi2Prob2 > 0.0005) {
3371               h_gamgamMass_[2][0]->Fill(sqrt(gamgamMass2));
3372               if (myPhotons[0]->isEB() && myPhotons[1]->isEB()) {
3373                 h_gamgamMass_[2][1]->Fill(sqrt(gamgamMass2));
3374               }
3375               if ((myPhotons[0]->isEE() && myPhotons[1]->isEE()) || (myPhotons[0]->isEE() && myPhotons[1]->isEB()) ||
3376                   (myPhotons[0]->isEB() && myPhotons[1]->isEE())) {
3377                 h_gamgamMass_[2][2]->Fill(sqrt(gamgamMass2));
3378               }
3379             }
3380           }
3381         } else if (!myPhotons[0]->conversions().empty() && myPhotons[1]->conversions().empty() &&
3382                    myPhotons[1]->r9() > 0.93) {  // one photon converted
3383           if (myPhotons[0]->conversions()[0]->nTracks() == 2) {
3384             float chi2Prob1 = ChiSquaredProbability(myPhotons[0]->conversions()[0]->conversionVertex().chi2(),
3385                                                     myPhotons[0]->conversions()[0]->conversionVertex().ndof());
3386             if (chi2Prob1 > 0.0005) {
3387               h_gamgamMass_[2][0]->Fill(sqrt(gamgamMass2));
3388               if (myPhotons[0]->isEB() && myPhotons[1]->isEB()) {
3389                 h_gamgamMass_[2][1]->Fill(sqrt(gamgamMass2));
3390               }
3391               if (myPhotons[0]->isEE() || myPhotons[1]->isEE()) {
3392                 h_gamgamMass_[2][2]->Fill(sqrt(gamgamMass2));
3393               }
3394             }
3395           }
3396         } else if (!myPhotons[1]->conversions().empty() && myPhotons[0]->conversions().empty() &&
3397                    myPhotons[0]->r9() > 0.93) {  // one photon converted
3398           if (myPhotons[1]->conversions()[0]->nTracks() == 2) {
3399             float chi2Prob1 = ChiSquaredProbability(myPhotons[1]->conversions()[0]->conversionVertex().chi2(),
3400                                                     myPhotons[1]->conversions()[0]->conversionVertex().ndof());
3401             if (chi2Prob1 > 0.0005) {
3402               h_gamgamMass_[2][0]->Fill(sqrt(gamgamMass2));
3403               if (myPhotons[0]->isEB() && myPhotons[1]->isEB()) {
3404                 h_gamgamMass_[2][1]->Fill(sqrt(gamgamMass2));
3405               }
3406               if (myPhotons[0]->isEE() || myPhotons[1]->isEE()) {
3407                 h_gamgamMass_[2][2]->Fill(sqrt(gamgamMass2));
3408               }
3409             }
3410           }
3411         }
3412       }  // gamgamMass2 > 0
3413 
3414       ////  energy from regression1
3415       if (gamgamMass2_regr1 > 0) {
3416         // total
3417         h_gamgamMassRegr1_[0][0]->Fill(sqrt(gamgamMass2_regr1));
3418         if (myPhotons[0]->isEB() && myPhotons[1]->isEB())
3419           h_gamgamMassRegr1_[0][1]->Fill(sqrt(gamgamMass2_regr1));
3420         if ((myPhotons[0]->isEE() && myPhotons[1]->isEE()) || (myPhotons[0]->isEE() && myPhotons[1]->isEB()) ||
3421             (myPhotons[0]->isEB() && myPhotons[1]->isEE()))
3422           h_gamgamMassRegr1_[0][2]->Fill(sqrt(gamgamMass2_regr1));
3423         // Golden photons
3424         if (myPhotons[0]->r9() > 0.94 && myPhotons[1]->r9() > 0.94) {
3425           h_gamgamMassRegr1_[1][0]->Fill(sqrt(gamgamMass2_regr1));
3426           if (myPhotons[0]->isEB() && myPhotons[1]->isEB())
3427             h_gamgamMassRegr1_[1][1]->Fill(sqrt(gamgamMass2_regr1));
3428           if ((myPhotons[0]->isEE() && myPhotons[1]->isEE()) || (myPhotons[0]->isEE() && myPhotons[1]->isEB()) ||
3429               (myPhotons[0]->isEB() && myPhotons[1]->isEE()))
3430             h_gamgamMassRegr1_[1][2]->Fill(sqrt(gamgamMass2_regr1));
3431         }
3432 
3433         // both photons converted
3434         if (!myPhotons[0]->conversions().empty() && !myPhotons[1]->conversions().empty()) {
3435           if (myPhotons[0]->conversions()[0]->nTracks() == 2 && myPhotons[1]->conversions()[0]->nTracks() == 2) {
3436             float chi2Prob1 = ChiSquaredProbability(myPhotons[0]->conversions()[0]->conversionVertex().chi2(),
3437                                                     myPhotons[0]->conversions()[0]->conversionVertex().ndof());
3438             float chi2Prob2 = ChiSquaredProbability(myPhotons[1]->conversions()[0]->conversionVertex().chi2(),
3439                                                     myPhotons[1]->conversions()[0]->conversionVertex().ndof());
3440             if (chi2Prob1 > 0.0005 && chi2Prob2 > 0.0005) {
3441               h_gamgamMassRegr1_[2][0]->Fill(sqrt(gamgamMass2_regr1));
3442               if (myPhotons[0]->isEB() && myPhotons[1]->isEB()) {
3443                 h_gamgamMassRegr1_[2][1]->Fill(sqrt(gamgamMass2_regr1));
3444               }
3445               if ((myPhotons[0]->isEE() && myPhotons[1]->isEE()) || (myPhotons[0]->isEE() && myPhotons[1]->isEB()) ||
3446                   (myPhotons[0]->isEB() && myPhotons[1]->isEE())) {
3447                 h_gamgamMassRegr1_[2][2]->Fill(sqrt(gamgamMass2_regr1));
3448               }
3449             }
3450           }
3451         } else if (!myPhotons[0]->conversions().empty() && myPhotons[1]->conversions().empty() &&
3452                    myPhotons[1]->r9() > 0.93) {  // one photon converted
3453           if (myPhotons[0]->conversions()[0]->nTracks() == 2) {
3454             float chi2Prob1 = ChiSquaredProbability(myPhotons[0]->conversions()[0]->conversionVertex().chi2(),
3455                                                     myPhotons[0]->conversions()[0]->conversionVertex().ndof());
3456             if (chi2Prob1 > 0.0005) {
3457               h_gamgamMassRegr1_[2][0]->Fill(sqrt(gamgamMass2_regr1));
3458               if (myPhotons[0]->isEB() && myPhotons[1]->isEB()) {
3459                 h_gamgamMassRegr1_[2][1]->Fill(sqrt(gamgamMass2_regr1));
3460               }
3461               if (myPhotons[0]->isEE() || myPhotons[1]->isEE()) {
3462                 h_gamgamMassRegr1_[2][2]->Fill(sqrt(gamgamMass2_regr1));
3463               }
3464             }
3465           }
3466         } else if (!myPhotons[1]->conversions().empty() && myPhotons[0]->conversions().empty() &&
3467                    myPhotons[0]->r9() > 0.93) {  // one photon converted
3468           if (myPhotons[1]->conversions()[0]->nTracks() == 2) {
3469             float chi2Prob1 = ChiSquaredProbability(myPhotons[1]->conversions()[0]->conversionVertex().chi2(),
3470                                                     myPhotons[1]->conversions()[0]->conversionVertex().ndof());
3471             if (chi2Prob1 > 0.0005) {
3472               h_gamgamMassRegr1_[2][0]->Fill(sqrt(gamgamMass2_regr1));
3473               if (myPhotons[0]->isEB() && myPhotons[1]->isEB()) {
3474                 h_gamgamMassRegr1_[2][1]->Fill(sqrt(gamgamMass2_regr1));
3475               }
3476               if (myPhotons[0]->isEE() || myPhotons[1]->isEE()) {
3477                 h_gamgamMassRegr1_[2][2]->Fill(sqrt(gamgamMass2_regr1));
3478               }
3479             }
3480           }
3481         }
3482       }  // gamgamMass2_regr1 > 0
3483 
3484       ////  energy from regression2
3485       if (gamgamMass2_regr2 > 0) {
3486         // total
3487         h_gamgamMassRegr2_[0][0]->Fill(sqrt(gamgamMass2_regr2));
3488         if (myPhotons[0]->isEB() && myPhotons[1]->isEB())
3489           h_gamgamMassRegr2_[0][1]->Fill(sqrt(gamgamMass2_regr2));
3490         if ((myPhotons[0]->isEE() && myPhotons[1]->isEE()) || (myPhotons[0]->isEE() && myPhotons[1]->isEB()) ||
3491             (myPhotons[0]->isEB() && myPhotons[1]->isEE()))
3492           h_gamgamMassRegr2_[0][2]->Fill(sqrt(gamgamMass2_regr2));
3493         // Golden photons
3494         if (myPhotons[0]->r9() > 0.94 && myPhotons[1]->r9() > 0.94) {
3495           h_gamgamMassRegr2_[1][0]->Fill(sqrt(gamgamMass2_regr2));
3496           if (myPhotons[0]->isEB() && myPhotons[1]->isEB())
3497             h_gamgamMassRegr2_[1][1]->Fill(sqrt(gamgamMass2_regr2));
3498           if ((myPhotons[0]->isEE() && myPhotons[1]->isEE()) || (myPhotons[0]->isEE() && myPhotons[1]->isEB()) ||
3499               (myPhotons[0]->isEB() && myPhotons[1]->isEE()))
3500             h_gamgamMassRegr2_[1][2]->Fill(sqrt(gamgamMass2_regr2));
3501         }
3502 
3503         // both photons converted
3504         if (!myPhotons[0]->conversions().empty() && !myPhotons[1]->conversions().empty()) {
3505           if (myPhotons[0]->conversions()[0]->nTracks() == 2 && myPhotons[1]->conversions()[0]->nTracks() == 2) {
3506             float chi2Prob1 = ChiSquaredProbability(myPhotons[0]->conversions()[0]->conversionVertex().chi2(),
3507                                                     myPhotons[0]->conversions()[0]->conversionVertex().ndof());
3508             float chi2Prob2 = ChiSquaredProbability(myPhotons[1]->conversions()[0]->conversionVertex().chi2(),
3509                                                     myPhotons[1]->conversions()[0]->conversionVertex().ndof());
3510             if (chi2Prob1 > 0.0005 && chi2Prob2 > 0.0005) {
3511               h_gamgamMassRegr2_[2][0]->Fill(sqrt(gamgamMass2_regr2));
3512               if (myPhotons[0]->isEB() && myPhotons[1]->isEB()) {
3513                 h_gamgamMassRegr2_[2][1]->Fill(sqrt(gamgamMass2_regr2));
3514               }
3515               if ((myPhotons[0]->isEE() && myPhotons[1]->isEE()) || (myPhotons[0]->isEE() && myPhotons[1]->isEB()) ||
3516                   (myPhotons[0]->isEB() && myPhotons[1]->isEE())) {
3517                 h_gamgamMassRegr2_[2][2]->Fill(sqrt(gamgamMass2_regr2));
3518               }
3519             }
3520           }
3521         } else if (!myPhotons[0]->conversions().empty() && myPhotons[1]->conversions().empty() &&
3522                    myPhotons[1]->r9() > 0.93) {  // one photon converted
3523           if (myPhotons[0]->conversions()[0]->nTracks() == 2) {
3524             float chi2Prob1 = ChiSquaredProbability(myPhotons[0]->conversions()[0]->conversionVertex().chi2(),
3525                                                     myPhotons[0]->conversions()[0]->conversionVertex().ndof());
3526             if (chi2Prob1 > 0.0005) {
3527               h_gamgamMassRegr2_[2][0]->Fill(sqrt(gamgamMass2_regr2));
3528               if (myPhotons[0]->isEB() && myPhotons[1]->isEB()) {
3529                 h_gamgamMassRegr2_[2][1]->Fill(sqrt(gamgamMass2_regr2));
3530               }
3531               if (myPhotons[0]->isEE() || myPhotons[1]->isEE()) {
3532                 h_gamgamMassRegr2_[2][2]->Fill(sqrt(gamgamMass2_regr2));
3533               }
3534             }
3535           }
3536         } else if (!myPhotons[1]->conversions().empty() && myPhotons[0]->conversions().empty() &&
3537                    myPhotons[0]->r9() > 0.93) {  // one photon converted
3538           if (myPhotons[1]->conversions()[0]->nTracks() == 2) {
3539             float chi2Prob1 = ChiSquaredProbability(myPhotons[1]->conversions()[0]->conversionVertex().chi2(),
3540                                                     myPhotons[1]->conversions()[0]->conversionVertex().ndof());
3541             if (chi2Prob1 > 0.0005) {
3542               h_gamgamMassRegr2_[2][0]->Fill(sqrt(gamgamMass2_regr2));
3543               if (myPhotons[0]->isEB() && myPhotons[1]->isEB()) {
3544                 h_gamgamMassRegr2_[2][1]->Fill(sqrt(gamgamMass2_regr2));
3545               }
3546               if (myPhotons[0]->isEE() || myPhotons[1]->isEE()) {
3547                 h_gamgamMassRegr2_[2][2]->Fill(sqrt(gamgamMass2_regr2));
3548               }
3549             }
3550           }
3551         }
3552       }  // gamgamMass2_regr2 > 0
3553     }
3554   }
3555   // }
3556 
3557   for (std::vector<PhotonMCTruth>::const_iterator mcPho = mcPhotons.begin(); mcPho != mcPhotons.end(); mcPho++) {
3558     if ((*mcPho).fourMomentum().et() < minPhoEtCut_)
3559       continue;
3560 
3561     for (HepMC::GenEvent::particle_const_iterator mcIter = myGenEvent->particles_begin();
3562          mcIter != myGenEvent->particles_end();
3563          mcIter++) {
3564       if ((*mcIter)->pdg_id() != 22)
3565         continue;
3566       bool isTheSame = false;
3567       HepMC::GenParticle* mother = nullptr;
3568       if ((*mcIter)->production_vertex()) {
3569         if ((*mcIter)->production_vertex()->particles_begin(HepMC::parents) !=
3570             (*mcIter)->production_vertex()->particles_end(HepMC::parents))
3571           mother = *((*mcIter)->production_vertex()->particles_begin(HepMC::parents));
3572       }
3573 
3574       float mcPhi = (*mcPho).fourMomentum().phi();
3575       mcPhi_ = phiNormalization(mcPhi);
3576       mcEta_ = (*mcPho).fourMomentum().pseudoRapidity();
3577       mcEta_ = etaTransformation(mcEta_, (*mcPho).primaryVertex().z());
3578 
3579       mcConvR_ = (*mcPho).vertex().perp();
3580       mcConvX_ = (*mcPho).vertex().x();
3581       mcConvY_ = (*mcPho).vertex().y();
3582       mcConvZ_ = (*mcPho).vertex().z();
3583       mcConvEta_ = (*mcPho).vertex().eta();
3584       mcConvPhi_ = (*mcPho).vertex().phi();
3585 
3586       if (fabs(mcEta_) > END_HI)
3587         continue;
3588 
3589       if (mother == nullptr || (mother != nullptr && mother->pdg_id() == 22) ||
3590           (mother != nullptr && mother->pdg_id() == 25) || (mother != nullptr && mother->pdg_id() == 35)) {
3591         double dPt = fabs((*mcIter)->momentum().perp() - (*mcPho).fourMomentum().et());
3592         float phiMother = (*mcIter)->momentum().phi();
3593         double dPhi = phiNormalization(phiMother) - mcPhi_;
3594         double dEta = fabs((*mcIter)->momentum().eta() - (*mcPho).fourMomentum().pseudoRapidity());
3595 
3596         if (dEta <= 0.0001 && dPhi <= 0.0001 && dPt <= 0.0001)
3597           isTheSame = true;
3598       }
3599       if (!isTheSame)
3600         continue;
3601 
3602       nSimPho_[0]++;
3603       if (!isRunCentrally_) {
3604         h_SimPhoMotherEt_[0]->Fill((*mcPho).motherMomentum().et());
3605         h_SimPhoMotherEta_[0]->Fill((*mcPho).motherMomentum().pseudoRapidity());
3606       }
3607 
3608       h_SimPho_[0]->Fill(mcEta_);
3609       h_SimPho_[1]->Fill(mcPhi_);
3610       h_SimPho_[2]->Fill((*mcPho).fourMomentum().et());
3611 
3612       ////////////////////////////////// extract info about simulated conversions
3613 
3614       bool goodSimConversion = false;
3615       bool visibleConversion = false;
3616       bool visibleConversionsWithTwoSimTracks = false;
3617       if ((*mcPho).isAConversion() == 1) {
3618         nSimConv_[0]++;
3619         h_AllSimConv_[0]->Fill(mcEta_);
3620         h_AllSimConv_[1]->Fill(mcPhi_);
3621         h_AllSimConv_[2]->Fill(mcConvR_);
3622         h_AllSimConv_[3]->Fill(mcConvZ_);
3623         h_AllSimConv_[4]->Fill((*mcPho).fourMomentum().et());
3624 
3625         if (!isRunCentrally_) {
3626           if (mcConvR_ < 51)
3627             h_SimConvEtaPix_[0]->Fill(mcEta_);
3628         }
3629 
3630         if ((fabs(mcEta_) <= BARL && mcConvR_ < 85) ||
3631             (fabs(mcEta_) > BARL && fabs(mcEta_) <= END_HI && fabs((*mcPho).vertex().z()) < 210))
3632           visibleConversion = true;
3633 
3634         theConvTP_.clear();
3635         for (size_t i = 0; i < trackingParticles.size(); ++i) {
3636           TrackingParticleRef tp(ElectronTPHandle, i);
3637           if (fabs(tp->vx() - (*mcPho).vertex().x()) < 0.001 && fabs(tp->vy() - (*mcPho).vertex().y()) < 0.001 &&
3638               fabs(tp->vz() - (*mcPho).vertex().z()) < 0.001) {
3639             theConvTP_.push_back(tp);
3640           }
3641         }
3642         if (theConvTP_.size() == 2)
3643           visibleConversionsWithTwoSimTracks = true;
3644         goodSimConversion = false;
3645 
3646         if (visibleConversion && visibleConversionsWithTwoSimTracks)
3647           goodSimConversion = true;
3648         if (goodSimConversion) {
3649           nSimConv_[1]++;
3650           h_VisSimConv_[0]->Fill(mcEta_);
3651           h_VisSimConv_[1]->Fill(mcPhi_);
3652           h_VisSimConv_[2]->Fill(mcConvR_);
3653           h_VisSimConv_[3]->Fill(mcConvZ_);
3654           h_VisSimConv_[4]->Fill((*mcPho).fourMomentum().et());
3655 
3656           if (useTP) {
3657             if (!isRunCentrally_) {
3658               for (edm::RefVector<TrackingParticleCollection>::iterator iTrk = theConvTP_.begin();
3659                    iTrk != theConvTP_.end();
3660                    ++iTrk) {
3661                 h_simTkPt_->Fill((*iTrk)->pt());
3662                 h_simTkEta_->Fill((*iTrk)->eta());
3663               }
3664             }
3665           }
3666         }
3667       }  ////////////// End of info from sim conversions //////////////////////////////////////////////////
3668 
3669       float minDelta = 10000.;
3670       std::vector<reco::PhotonRef> thePhotons;
3671       int index = 0;
3672       int iMatch = -1;
3673       bool matched = false;
3674 
3675       for (unsigned int iPho = 0; iPho < photonHandle->size(); iPho++) {
3676         reco::PhotonRef aPho(reco::PhotonRef(photonHandle, iPho));
3677         thePhotons.push_back(aPho);
3678         float phiPho = aPho->phi();
3679         float etaPho = aPho->eta();
3680         float deltaPhi = phiPho - mcPhi_;
3681         float deltaEta = etaPho - mcEta_;
3682         if (deltaPhi > pi)
3683           deltaPhi -= twopi;
3684         if (deltaPhi < -pi)
3685           deltaPhi += twopi;
3686         deltaPhi = pow(deltaPhi, 2);
3687         deltaEta = pow(deltaEta, 2);
3688         float delta = sqrt(deltaPhi + deltaEta);
3689         if (delta < 0.1 && delta < minDelta) {
3690           minDelta = delta;
3691           iMatch = index;
3692         }
3693         index++;
3694       }  // end loop over reco photons
3695       if (iMatch > -1)
3696         matched = true;
3697 
3698       if (matched) {
3699         nSimPho_[1]++;
3700         if (!isRunCentrally_) {
3701           h_SimPhoMotherEt_[1]->Fill((*mcPho).motherMomentum().et());
3702           h_SimPhoMotherEta_[1]->Fill((*mcPho).motherMomentum().pseudoRapidity());
3703         }
3704         h_MatchedSimPho_[0]->Fill(mcEta_);
3705         h_MatchedSimPho_[1]->Fill(mcPhi_);
3706         h_MatchedSimPho_[2]->Fill((*mcPho).fourMomentum().et());
3707       }
3708 
3709       if (!matched)
3710         continue;
3711 
3712       bool phoIsInBarrel = false;   // full barrel
3713       bool phoIsInBarrel1 = false;  // |eta| <=1
3714       bool phoIsInBarrel2 = false;  // |eta| >1
3715       bool phoIsInEndcap = false;
3716       bool phoIsInEndcapP = false;
3717       bool phoIsInEndcapM = false;
3718 
3719       reco::PhotonRef matchingPho = thePhotons[iMatch];
3720 
3721       if (fabs(matchingPho->superCluster()->position().eta()) < 1.479) {
3722         phoIsInBarrel = true;
3723       } else {
3724         phoIsInEndcap = true;
3725         if (matchingPho->superCluster()->position().eta() > 0)
3726           phoIsInEndcapP = true;
3727         if (matchingPho->superCluster()->position().eta() < 0)
3728           phoIsInEndcapM = true;
3729       }
3730       if (fabs(matchingPho->superCluster()->position().eta()) <= 1) {
3731         phoIsInBarrel1 = true;
3732       } else if (fabs(matchingPho->superCluster()->position().eta()) > 1) {
3733         phoIsInBarrel2 = true;
3734       }
3735 
3736       edm::Handle<EcalRecHitCollection> ecalRecHitHandle;
3737       if (phoIsInBarrel) {
3738         // Get handle to rec hits ecal barrel
3739         e.getByToken(barrelEcalHits_, ecalRecHitHandle);
3740         if (!ecalRecHitHandle.isValid()) {
3741           Labels l;
3742           labelsForToken(barrelEcalHits_, l);
3743           edm::LogError("PhotonProducer") << "Error! Can't get the product " << l.module;
3744           return;
3745         }
3746 
3747       } else if (phoIsInEndcap) {
3748         // Get handle to rec hits ecal encap
3749         e.getByToken(endcapEcalHits_, ecalRecHitHandle);
3750         if (!ecalRecHitHandle.isValid()) {
3751           Labels l;
3752           labelsForToken(barrelEcalHits_, l);
3753           edm::LogError("PhotonProducer") << "Error! Can't get the product " << l.module;
3754           return;
3755         }
3756       }
3757 
3758       int type = 0;
3759       const EcalRecHitCollection ecalRecHitCollection = *(ecalRecHitHandle.product());
3760       float photonE = matchingPho->energy();
3761       float sigmaEoE = matchingPho->getCorrectedEnergyError(matchingPho->getCandidateP4type()) / matchingPho->energy();
3762       //float photonEt= matchingPho->energy()/cosh( matchingPho->eta()) ;
3763       float photonEt = matchingPho->pt();
3764       float photonERegr1 = matchingPho->getCorrectedEnergy(reco::Photon::regression1);
3765       float photonERegr2 = matchingPho->getCorrectedEnergy(reco::Photon::regression2);
3766       float r9 = matchingPho->r9();
3767       //     float full5x5_r9 = matchingPho->full5x5_r9();
3768       float r1 = matchingPho->r1x5();
3769       float r2 = matchingPho->r2x5();
3770       float sigmaIetaIeta = matchingPho->sigmaIetaIeta();
3771       //float full5x5_sieie =  matchingPho->full5x5_sigmaIetaIeta();
3772       float hOverE = matchingPho->hadronicOverEm();
3773       float newhOverE = matchingPho->hadTowOverEm();
3774       float ecalIso = matchingPho->ecalRecHitSumEtConeDR04();
3775       float hcalIso = matchingPho->hcalTowerSumEtConeDR04();
3776       float newhcalIso = matchingPho->hcalTowerSumEtBcConeDR04();
3777       float trkIso = matchingPho->trkSumPtSolidConeDR04();
3778       float nIsoTrk = matchingPho->nTrkSolidConeDR04();
3779       // PF related quantities
3780       float chargedHadIso = matchingPho->chargedHadronIso();
3781       float neutralHadIso = matchingPho->neutralHadronIso();
3782       float photonIso = matchingPho->photonIso();
3783       float etOutsideMustache = matchingPho->etOutsideMustache();
3784       int nClusterOutsideMustache = matchingPho->nClusterOutsideMustache();
3785       float pfMVA = matchingPho->pfMVA();
3786 
3787       std::vector<std::pair<DetId, float> >::const_iterator rhIt;
3788       bool atLeastOneDeadChannel = false;
3789       for (reco::CaloCluster_iterator bcIt = matchingPho->superCluster()->clustersBegin();
3790            bcIt != matchingPho->superCluster()->clustersEnd();
3791            ++bcIt) {
3792         for (rhIt = (*bcIt)->hitsAndFractions().begin(); rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) {
3793           for (EcalRecHitCollection::const_iterator it = ecalRecHitCollection.begin(); it != ecalRecHitCollection.end();
3794                ++it) {
3795             if (rhIt->first == (*it).id()) {
3796               if ((*it).recoFlag() == 9) {
3797                 atLeastOneDeadChannel = true;
3798                 break;
3799               }
3800             }
3801           }
3802         }
3803       }
3804 
3805       if (atLeastOneDeadChannel) {
3806         h_MatchedSimPhoBadCh_[0]->Fill(mcEta_);
3807         h_MatchedSimPhoBadCh_[1]->Fill(mcPhi_);
3808         h_MatchedSimPhoBadCh_[2]->Fill((*mcPho).fourMomentum().et());
3809       }
3810 
3811       if (phoIsInBarrel)
3812         h_phoPixSeedSize_[0]->Fill(matchingPho->electronPixelSeeds().size());
3813       else
3814         h_phoPixSeedSize_[1]->Fill(matchingPho->electronPixelSeeds().size());
3815 
3816       h_scEta_[type]->Fill(matchingPho->superCluster()->eta());
3817       h_scPhi_[type]->Fill(matchingPho->superCluster()->phi());
3818       if (!isRunCentrally_) {
3819         h_scEtaWidth_[type]->Fill(matchingPho->superCluster()->etaWidth());
3820         h_scPhiWidth_[type]->Fill(matchingPho->superCluster()->phiWidth());
3821       }
3822       h_scE_[type][0]->Fill(matchingPho->superCluster()->energy());
3823       h_scEt_[type][0]->Fill(matchingPho->superCluster()->energy() / cosh(matchingPho->superCluster()->eta()));
3824       if (phoIsInEndcap)
3825         h_psE_->Fill(matchingPho->superCluster()->preshowerEnergy());
3826       //
3827       h_r9_[type][0]->Fill(r9);
3828       //
3829       h_r1_[type][0]->Fill(r1);
3830       //
3831       h_r2_[type][0]->Fill(r2);
3832       //
3833       h_sigmaIetaIeta_[type][0]->Fill(sigmaIetaIeta);
3834       //
3835       h_hOverE_[type][0]->Fill(hOverE);
3836       p_r9VsEta_[0]->Fill(mcEta_, r9);
3837 
3838       if (!isRunCentrally_) {
3839         h2_r9VsEt_[0]->Fill((*mcPho).fourMomentum().et(), r9);
3840         h2_r1VsEta_[0]->Fill(mcEta_, r1);
3841         h2_r1VsEt_[0]->Fill((*mcPho).fourMomentum().et(), r1);
3842         h2_r2VsEta_[0]->Fill(mcEta_, r2);
3843         h2_r2VsEt_[0]->Fill((*mcPho).fourMomentum().et(), r2);
3844         h2_sigmaIetaIetaVsEta_[0]->Fill(mcEta_, sigmaIetaIeta);
3845         h2_sigmaIetaIetaVsEt_[0]->Fill((*mcPho).fourMomentum().et(), sigmaIetaIeta);
3846         h2_hOverEVsEta_[0]->Fill(mcEta_, hOverE);
3847         h2_hOverEVsEt_[0]->Fill((*mcPho).fourMomentum().et(), hOverE);
3848       }
3849       p_hOverEVsEta_[0]->Fill(mcEta_, hOverE);
3850       p_hOverEVsEt_[0]->Fill((*mcPho).fourMomentum().et(), hOverE);
3851       //
3852       h_newhOverE_[type][0]->Fill(newhOverE);
3853       p_newhOverEVsEta_[0]->Fill(mcEta_, newhOverE);
3854       p_newhOverEVsEt_[0]->Fill((*mcPho).fourMomentum().et(), newhOverE);
3855 
3856       //
3857       h_ecalRecHitSumEtConeDR04_[type][0]->Fill(ecalIso);
3858       if (!isRunCentrally_) {
3859         h2_ecalRecHitSumEtConeDR04VsEta_[0]->Fill(mcEta_, ecalIso);
3860         h2_ecalRecHitSumEtConeDR04VsEt_[0]->Fill((*mcPho).fourMomentum().et(), ecalIso);
3861         h2_hcalTowerSumEtConeDR04VsEta_[0]->Fill(mcEta_, hcalIso);
3862         h2_hcalTowerSumEtConeDR04VsEt_[0]->Fill((*mcPho).fourMomentum().et(), hcalIso);
3863       }
3864       p_ecalRecHitSumEtConeDR04VsEta_[0]->Fill(mcEta_, ecalIso);
3865       if (!isRunCentrally_)
3866         p_ecalRecHitSumEtConeDR04VsEt_[0]->Fill((*mcPho).fourMomentum().et(), ecalIso);
3867       //
3868       h_hcalTowerSumEtConeDR04_[type][0]->Fill(hcalIso);
3869       p_hcalTowerSumEtConeDR04VsEta_[0]->Fill(mcEta_, hcalIso);
3870       if (!isRunCentrally_)
3871         p_hcalTowerSumEtConeDR04VsEt_[0]->Fill((*mcPho).fourMomentum().et(), hcalIso);
3872       //
3873       if (!isRunCentrally_)
3874         h_hcalTowerBcSumEtConeDR04_[type][0]->Fill(newhcalIso);
3875       p_hcalTowerBcSumEtConeDR04VsEta_[0]->Fill(mcEta_, newhcalIso);
3876       if (!isRunCentrally_)
3877         p_hcalTowerBcSumEtConeDR04VsEt_[0]->Fill((*mcPho).fourMomentum().et(), newhcalIso);
3878       //
3879       h_isoTrkSolidConeDR04_[type][0]->Fill(trkIso);
3880       h_nTrkSolidConeDR04_[type][0]->Fill(nIsoTrk);
3881 
3882       if (!isRunCentrally_) {
3883         h2_isoTrkSolidConeDR04VsEta_[0]->Fill(mcEta_, trkIso);
3884         h2_isoTrkSolidConeDR04VsEt_[0]->Fill((*mcPho).fourMomentum().et(), trkIso);
3885         h2_nTrkSolidConeDR04VsEta_[0]->Fill(mcEta_, nIsoTrk);
3886         h2_nTrkSolidConeDR04VsEt_[0]->Fill((*mcPho).fourMomentum().et(), nIsoTrk);
3887       }
3888 
3889       h_chHadIso_[0]->Fill(chargedHadIso);
3890       h_nHadIso_[0]->Fill(neutralHadIso);
3891       h_phoIso_[0]->Fill(photonIso);
3892       h_nCluOutsideMustache_[0]->Fill(float(nClusterOutsideMustache));
3893       h_etOutsideMustache_[0]->Fill(etOutsideMustache);
3894       h_pfMva_[0]->Fill(pfMVA);
3895       //
3896       h_phoEta_[type]->Fill(matchingPho->eta());
3897       h_phoPhi_[type]->Fill(matchingPho->phi());
3898       h_phoDEta_[0]->Fill(matchingPho->eta() - (*mcPho).fourMomentum().eta());
3899       h_phoDPhi_[0]->Fill(matchingPho->phi() - mcPhi_);
3900       h_phoE_[type][0]->Fill(photonE);
3901       h_phoEt_[type][0]->Fill(photonEt);
3902       h_nConv_[0][0]->Fill(float(matchingPho->conversions().size()));
3903       h_nConv_[1][0]->Fill(float(matchingPho->conversionsOneLeg().size()));
3904 
3905       //
3906       h_phoERes_[0][0]->Fill(photonE / (*mcPho).fourMomentum().e());
3907       h_phoSigmaEoE_[0][0]->Fill(sigmaEoE);
3908       h_phoEResRegr1_[0][0]->Fill(photonERegr1 / (*mcPho).fourMomentum().e());
3909       h_phoEResRegr2_[0][0]->Fill(photonERegr2 / (*mcPho).fourMomentum().e());
3910 
3911       p_eResVsEta_[0]->Fill(mcEta_, photonE / (*mcPho).fourMomentum().e());
3912       p_sigmaEoEVsEta_[0]->Fill(mcEta_, sigmaEoE);
3913       p_eResVsEt_[0][0]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
3914 
3915       if (!isRunCentrally_)
3916         h2_eResVsEta_[0]->Fill(mcEta_, photonE / (*mcPho).fourMomentum().e());
3917       if (!isRunCentrally_)
3918         h2_eResVsEt_[0][0]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
3919       if (!isRunCentrally_)
3920         h2_eResVsR9_[0]->Fill(r9, photonE / (*mcPho).fourMomentum().e());
3921       if (!isRunCentrally_)
3922         h2_sceResVsR9_[0]->Fill(r9, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
3923       if (!isRunCentrally_)
3924         p_eResVsR9_[0]->Fill(r9, photonE / (*mcPho).fourMomentum().e());
3925       if (!isRunCentrally_)
3926         p_sceResVsR9_[0]->Fill(r9, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
3927       //
3928       if ((*mcPho).isAConversion() == 0) {
3929         if (!isRunCentrally_) {
3930           h2_eResVsEta_[1]->Fill(mcEta_, photonE / (*mcPho).fourMomentum().e());
3931           h2_r9VsEt_[1]->Fill((*mcPho).fourMomentum().et(), r9);
3932           //
3933           h2_r1VsEta_[1]->Fill(mcEta_, r1);
3934           h2_r1VsEt_[1]->Fill((*mcPho).fourMomentum().et(), r1);
3935           //
3936           h2_r2VsEta_[1]->Fill(mcEta_, r2);
3937           h2_r2VsEt_[1]->Fill((*mcPho).fourMomentum().et(), r2);
3938           //
3939           h2_sigmaIetaIetaVsEta_[1]->Fill(mcEta_, sigmaIetaIeta);
3940           h2_sigmaIetaIetaVsEt_[1]->Fill((*mcPho).fourMomentum().et(), sigmaIetaIeta);
3941           //
3942           h2_hOverEVsEta_[1]->Fill(mcEta_, hOverE);
3943           h2_hOverEVsEt_[1]->Fill((*mcPho).fourMomentum().et(), hOverE);
3944         }
3945 
3946         if (!isRunCentrally_) {
3947           h2_ecalRecHitSumEtConeDR04VsEta_[1]->Fill(mcEta_, ecalIso);
3948           h2_hcalTowerSumEtConeDR04VsEta_[1]->Fill(mcEta_, hcalIso);
3949           h2_isoTrkSolidConeDR04VsEta_[1]->Fill(mcEta_, trkIso);
3950           h2_isoTrkSolidConeDR04VsEt_[1]->Fill((*mcPho).fourMomentum().et(), trkIso);
3951           h2_nTrkSolidConeDR04VsEta_[1]->Fill(mcEta_, nIsoTrk);
3952           h2_nTrkSolidConeDR04VsEt_[1]->Fill((*mcPho).fourMomentum().et(), nIsoTrk);
3953         }
3954         p_ecalRecHitSumEtConeDR04VsEta_[1]->Fill(mcEta_, ecalIso);
3955         if (!isRunCentrally_)
3956           p_hcalTowerSumEtConeDR04VsEta_[1]->Fill(mcEta_, hcalIso);
3957       }
3958 
3959       if (photonE / (*mcPho).fourMomentum().e() < 0.3 && photonE / (*mcPho).fourMomentum().e() > 0.1) {
3960       }
3961 
3962       if ((r9 > 0.94 && phoIsInBarrel) || (r9 > 0.95 && phoIsInEndcap)) {
3963         h_phoERes_[1][0]->Fill(photonE / (*mcPho).fourMomentum().e());
3964         h_phoSigmaEoE_[1][0]->Fill(sigmaEoE);
3965         h_phoEResRegr1_[1][0]->Fill(photonERegr1 / (*mcPho).fourMomentum().e());
3966         h_phoEResRegr2_[1][0]->Fill(photonERegr2 / (*mcPho).fourMomentum().e());
3967         if (!isRunCentrally_)
3968           h2_eResVsEt_[0][1]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
3969         p_eResVsEt_[0][1]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
3970         p_eResVsEta_[1]->Fill(mcEta_, photonE / (*mcPho).fourMomentum().e());
3971         p_r9VsEta_[1]->Fill(mcEta_, r9);
3972         p_sigmaEoEVsEta_[1]->Fill(mcEta_, sigmaEoE);
3973 
3974       } else if ((r9 <= 0.94 && phoIsInBarrel) || (r9 <= 0.95 && phoIsInEndcap)) {
3975         h_phoERes_[2][0]->Fill(photonE / (*mcPho).fourMomentum().e());
3976         h_phoSigmaEoE_[2][0]->Fill(sigmaEoE);
3977         h_phoEResRegr1_[2][0]->Fill(photonERegr1 / (*mcPho).fourMomentum().e());
3978         h_phoEResRegr2_[2][0]->Fill(photonERegr2 / (*mcPho).fourMomentum().e());
3979         p_eResVsEt_[0][2]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
3980         p_eResVsEta_[2]->Fill(mcEta_, photonE / (*mcPho).fourMomentum().e());
3981         p_r9VsEta_[2]->Fill(mcEta_, r9);
3982         p_sigmaEoEVsEta_[2]->Fill(mcEta_, sigmaEoE);
3983 
3984         if (!isRunCentrally_) {
3985           h2_eResVsEt_[0][2]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
3986           h_EtR9Less093_[0][0]->Fill(photonEt);
3987         }
3988       }
3989 
3990       if (phoIsInBarrel) {
3991         h_scE_[type][1]->Fill(matchingPho->superCluster()->energy());
3992         h_scEt_[type][1]->Fill(matchingPho->superCluster()->energy() / cosh(matchingPho->superCluster()->eta()));
3993         h_r9_[type][1]->Fill(r9);
3994         h_r1_[type][1]->Fill(r1);
3995         h_r2_[type][1]->Fill(r2);
3996         h_sigmaIetaIeta_[type][1]->Fill(sigmaIetaIeta);
3997         h_hOverE_[type][1]->Fill(hOverE);
3998         h_newhOverE_[type][1]->Fill(newhOverE);
3999         h_ecalRecHitSumEtConeDR04_[type][1]->Fill(ecalIso);
4000         p_ecalRecHitSumEtConeDR04VsEt_[1]->Fill((*mcPho).fourMomentum().et(), ecalIso);
4001         h_hcalTowerSumEtConeDR04_[type][1]->Fill(hcalIso);
4002         p_hcalTowerSumEtConeDR04VsEt_[1]->Fill((*mcPho).fourMomentum().et(), hcalIso);
4003         h_hcalTowerBcSumEtConeDR04_[type][1]->Fill(newhcalIso);
4004         p_hcalTowerBcSumEtConeDR04VsEt_[1]->Fill((*mcPho).fourMomentum().et(), newhcalIso);
4005         h_isoTrkSolidConeDR04_[type][1]->Fill(trkIso);
4006         h_nTrkSolidConeDR04_[type][1]->Fill(nIsoTrk);
4007         h_chHadIso_[1]->Fill(chargedHadIso);
4008         h_nHadIso_[1]->Fill(neutralHadIso);
4009         h_phoIso_[1]->Fill(photonIso);
4010         h_nCluOutsideMustache_[1]->Fill(float(nClusterOutsideMustache));
4011         h_etOutsideMustache_[1]->Fill(etOutsideMustache);
4012         h_pfMva_[1]->Fill(pfMVA);
4013         h_phoE_[type][1]->Fill(photonE);
4014         h_phoEt_[type][1]->Fill(photonEt);
4015         h_nConv_[type][1]->Fill(float(matchingPho->conversions().size()));
4016         h_nConv_[1][1]->Fill(float(matchingPho->conversionsOneLeg().size()));
4017         h_phoERes_[0][1]->Fill(photonE / (*mcPho).fourMomentum().e());
4018         h_phoSigmaEoE_[0][1]->Fill(sigmaEoE);
4019         h_phoEResRegr1_[0][1]->Fill(photonERegr1 / (*mcPho).fourMomentum().e());
4020         h_phoEResRegr2_[0][1]->Fill(photonERegr2 / (*mcPho).fourMomentum().e());
4021         p_eResVsR9_[1]->Fill(r9, photonE / (*mcPho).fourMomentum().e());
4022         p_sceResVsR9_[1]->Fill(r9, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4023         if (!isRunCentrally_) {
4024           h2_eResVsR9_[1]->Fill(r9, photonE / (*mcPho).fourMomentum().e());
4025           h2_sceResVsR9_[1]->Fill(r9, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4026           h2_ecalRecHitSumEtConeDR04VsEt_[1]->Fill((*mcPho).fourMomentum().et(), ecalIso);
4027           h2_hcalTowerSumEtConeDR04VsEt_[1]->Fill((*mcPho).fourMomentum().et(), hcalIso);
4028           h2_eResVsEt_[1][0]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4029         }
4030         p_eResVsEt_[1][0]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4031         p_eResVsNVtx_[1][0]->Fill(float(vtxH->size()), photonE / (*mcPho).fourMomentum().e());
4032         p_sigmaEoEVsEt_[1][0]->Fill((*mcPho).fourMomentum().et(), sigmaEoE);
4033         p_sigmaEoEVsNVtx_[1][0]->Fill(float(vtxH->size()), sigmaEoE);
4034 
4035         if (r9 > 0.94) {
4036           h_phoERes_[1][1]->Fill(photonE / (*mcPho).fourMomentum().e());
4037           h_phoSigmaEoE_[1][1]->Fill(sigmaEoE);
4038           h_phoEResRegr1_[1][1]->Fill(photonERegr1 / (*mcPho).fourMomentum().e());
4039           h_phoEResRegr2_[1][1]->Fill(photonERegr2 / (*mcPho).fourMomentum().e());
4040           if (!isRunCentrally_)
4041             h2_eResVsEt_[1][1]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4042           p_eResVsEt_[1][1]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4043           p_eResVsNVtx_[1][1]->Fill(float(vtxH->size()), photonE / (*mcPho).fourMomentum().e());
4044           p_sigmaEoEVsEt_[1][1]->Fill((*mcPho).fourMomentum().et(), sigmaEoE);
4045           p_sigmaEoEVsNVtx_[1][1]->Fill(float(vtxH->size()), sigmaEoE);
4046         }
4047         if (r9 <= 0.94) {
4048           h_phoERes_[2][1]->Fill(photonE / (*mcPho).fourMomentum().e());
4049           h_phoSigmaEoE_[2][1]->Fill(sigmaEoE);
4050           h_phoEResRegr1_[2][1]->Fill(photonERegr1 / (*mcPho).fourMomentum().e());
4051           h_phoEResRegr2_[2][1]->Fill(photonERegr2 / (*mcPho).fourMomentum().e());
4052           p_eResVsEt_[1][2]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4053           p_eResVsNVtx_[1][2]->Fill(float(vtxH->size()), photonE / (*mcPho).fourMomentum().e());
4054           p_sigmaEoEVsEt_[1][2]->Fill((*mcPho).fourMomentum().et(), sigmaEoE);
4055           p_sigmaEoEVsNVtx_[1][2]->Fill(float(vtxH->size()), sigmaEoE);
4056           if (!isRunCentrally_) {
4057             h2_eResVsEt_[1][2]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4058             h_EtR9Less093_[0][1]->Fill(photonEt);
4059           }
4060         }
4061       }
4062       if (phoIsInEndcap) {
4063         h_scE_[type][2]->Fill(matchingPho->superCluster()->energy());
4064         h_scEt_[type][2]->Fill(matchingPho->superCluster()->energy() / cosh(matchingPho->superCluster()->eta()));
4065         h_r9_[type][2]->Fill(r9);
4066         h_r1_[type][2]->Fill(r1);
4067         h_r2_[type][2]->Fill(r2);
4068         h_sigmaIetaIeta_[type][2]->Fill(sigmaIetaIeta);
4069         h_hOverE_[type][2]->Fill(hOverE);
4070         h_newhOverE_[type][2]->Fill(newhOverE);
4071         h_ecalRecHitSumEtConeDR04_[type][2]->Fill(ecalIso);
4072         p_ecalRecHitSumEtConeDR04VsEt_[2]->Fill((*mcPho).fourMomentum().et(), ecalIso);
4073         h_hcalTowerSumEtConeDR04_[type][2]->Fill(hcalIso);
4074         p_hcalTowerSumEtConeDR04VsEt_[2]->Fill((*mcPho).fourMomentum().et(), hcalIso);
4075         h_hcalTowerBcSumEtConeDR04_[type][2]->Fill(newhcalIso);
4076         p_hcalTowerBcSumEtConeDR04VsEt_[2]->Fill((*mcPho).fourMomentum().et(), newhcalIso);
4077         h_isoTrkSolidConeDR04_[type][2]->Fill(trkIso);
4078         h_nTrkSolidConeDR04_[type][2]->Fill(nIsoTrk);
4079         h_chHadIso_[2]->Fill(chargedHadIso);
4080         h_nHadIso_[2]->Fill(neutralHadIso);
4081         h_phoIso_[2]->Fill(photonIso);
4082         h_nCluOutsideMustache_[2]->Fill(float(nClusterOutsideMustache));
4083         h_etOutsideMustache_[2]->Fill(etOutsideMustache);
4084         h_pfMva_[2]->Fill(pfMVA);
4085         h_phoE_[type][2]->Fill(photonE);
4086         h_phoEt_[type][2]->Fill(photonEt);
4087         h_nConv_[type][2]->Fill(float(matchingPho->conversions().size()));
4088         h_nConv_[1][2]->Fill(float(matchingPho->conversionsOneLeg().size()));
4089         h_phoERes_[0][2]->Fill(photonE / (*mcPho).fourMomentum().e());
4090         h_phoSigmaEoE_[0][2]->Fill(sigmaEoE);
4091         h_phoEResRegr1_[0][2]->Fill(photonERegr1 / (*mcPho).fourMomentum().e());
4092         h_phoEResRegr2_[0][2]->Fill(photonERegr2 / (*mcPho).fourMomentum().e());
4093         p_eResVsR9_[2]->Fill(r9, photonE / (*mcPho).fourMomentum().e());
4094         p_sceResVsR9_[2]->Fill(r9, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4095         if (!isRunCentrally_) {
4096           h2_eResVsR9_[2]->Fill(r9, photonE / (*mcPho).fourMomentum().e());
4097           h2_sceResVsR9_[2]->Fill(r9, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4098           h2_ecalRecHitSumEtConeDR04VsEt_[2]->Fill((*mcPho).fourMomentum().et(), ecalIso);
4099           h2_hcalTowerSumEtConeDR04VsEt_[2]->Fill((*mcPho).fourMomentum().et(), hcalIso);
4100           h2_eResVsEt_[2][0]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4101         }
4102 
4103         p_eResVsEt_[2][0]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4104         p_eResVsNVtx_[2][0]->Fill(float(vtxH->size()), photonE / (*mcPho).fourMomentum().e());
4105         p_sigmaEoEVsEt_[2][0]->Fill((*mcPho).fourMomentum().et(), sigmaEoE);
4106         p_sigmaEoEVsNVtx_[2][0]->Fill(float(vtxH->size()), sigmaEoE);
4107 
4108         if (r9 > 0.95) {
4109           h_phoERes_[1][2]->Fill(photonE / (*mcPho).fourMomentum().e());
4110           h_phoSigmaEoE_[1][2]->Fill(sigmaEoE);
4111           h_phoEResRegr1_[1][2]->Fill(photonERegr1 / (*mcPho).fourMomentum().e());
4112           h_phoEResRegr2_[1][2]->Fill(photonERegr2 / (*mcPho).fourMomentum().e());
4113           if (!isRunCentrally_)
4114             h2_eResVsEt_[2][1]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4115           p_eResVsEt_[2][1]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4116           p_eResVsNVtx_[2][1]->Fill(float(vtxH->size()), photonE / (*mcPho).fourMomentum().e());
4117           p_sigmaEoEVsEt_[2][1]->Fill((*mcPho).fourMomentum().et(), sigmaEoE);
4118           p_sigmaEoEVsNVtx_[2][1]->Fill(float(vtxH->size()), sigmaEoE);
4119         }
4120         if (r9 <= 0.95) {
4121           h_phoERes_[2][2]->Fill(photonE / (*mcPho).fourMomentum().e());
4122           h_phoSigmaEoE_[2][2]->Fill(sigmaEoE);
4123           h_phoEResRegr1_[2][2]->Fill(photonERegr1 / (*mcPho).fourMomentum().e());
4124           h_phoEResRegr2_[2][2]->Fill(photonERegr2 / (*mcPho).fourMomentum().e());
4125           p_eResVsEt_[2][2]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4126           p_eResVsNVtx_[2][2]->Fill(float(vtxH->size()), photonE / (*mcPho).fourMomentum().e());
4127           p_sigmaEoEVsEt_[2][2]->Fill((*mcPho).fourMomentum().et(), sigmaEoE);
4128           p_sigmaEoEVsNVtx_[2][2]->Fill(float(vtxH->size()), sigmaEoE);
4129 
4130           if (!isRunCentrally_) {
4131             h2_eResVsEt_[2][2]->Fill((*mcPho).fourMomentum().et(), photonE / (*mcPho).fourMomentum().e());
4132             h_EtR9Less093_[0][2]->Fill(photonEt);
4133           }
4134         }
4135       }
4136 
4137       ///////////////////////   Particle based isolation
4138       if (fName_ == "pfPhotonValidator") {
4139         float SumPtIsoValCh = 0.;
4140         float SumPtIsoValNh = 0.;
4141         float SumPtIsoValPh = 0.;
4142 
4143         float SumPtIsoValCleanCh = 0.;
4144         float SumPtIsoValCleanNh = 0.;
4145         float SumPtIsoValCleanPh = 0.;
4146 
4147         for (unsigned int lCand = 0; lCand < pfCandidateHandle->size(); lCand++) {
4148           reco::PFCandidateRef pfCandRef(reco::PFCandidateRef(pfCandidateHandle, lCand));
4149           float dR = deltaR(matchingPho->eta(), matchingPho->phi(), pfCandRef->eta(), pfCandRef->phi());
4150           if (dR < 0.4) {
4151             /// uncleaned
4152             reco::PFCandidate::ParticleType type = pfCandRef->particleId();
4153             if (type == reco::PFCandidate::e)
4154               continue;
4155             if (type == reco::PFCandidate::gamma && pfCandRef->mva_nothing_gamma() > 0.)
4156               continue;
4157 
4158             if (type == reco::PFCandidate::h) {
4159               SumPtIsoValCh += pfCandRef->pt();
4160               h_dRPhoPFcand_ChHad_unCleaned_[0]->Fill(dR);
4161               if (phoIsInBarrel)
4162                 h_dRPhoPFcand_ChHad_unCleaned_[1]->Fill(dR);
4163               else
4164                 h_dRPhoPFcand_ChHad_unCleaned_[2]->Fill(dR);
4165             }
4166             if (type == reco::PFCandidate::h0) {
4167               SumPtIsoValNh += pfCandRef->pt();
4168               h_dRPhoPFcand_NeuHad_unCleaned_[0]->Fill(dR);
4169               if (phoIsInBarrel) {
4170                 h_dRPhoPFcand_NeuHad_unCleaned_[1]->Fill(dR);
4171                 if (phoIsInBarrel1) {
4172                   h_dRPhoPFcand_NeuHad_unCleaned_[3]->Fill(dR);
4173                 }
4174                 if (phoIsInBarrel2) {
4175                   h_dRPhoPFcand_NeuHad_unCleaned_[4]->Fill(dR);
4176                 }
4177               } else {
4178                 h_dRPhoPFcand_NeuHad_Cleaned_[2]->Fill(dR);
4179               }
4180             }
4181 
4182             if (type == reco::PFCandidate::gamma) {
4183               SumPtIsoValPh += pfCandRef->pt();
4184               h_dRPhoPFcand_Pho_unCleaned_[0]->Fill(dR);
4185               if (phoIsInBarrel)
4186                 h_dRPhoPFcand_Pho_unCleaned_[1]->Fill(dR);
4187               else
4188                 h_dRPhoPFcand_Pho_unCleaned_[2]->Fill(dR);
4189             }
4190 
4191             ////////// acces the value map to access the PFCandidates in overlap with the photon which need to be excluded from the isolation
4192             bool skip = false;
4193             for (std::vector<reco::PFCandidateRef>::const_iterator i = phoToParticleBasedIsoMap[matchingPho].begin();
4194                  i != phoToParticleBasedIsoMap[matchingPho].end();
4195                  ++i) {
4196               if ((*i) == pfCandRef) {
4197                 skip = true;
4198               }
4199             }  // loop over the PFCandidates flagged as overlapping with the photon
4200 
4201             if (skip)
4202               continue;
4203             if (type == reco::PFCandidate::h) {
4204               SumPtIsoValCleanCh += pfCandRef->pt();
4205               h_dRPhoPFcand_ChHad_Cleaned_[0]->Fill(dR);
4206               if (phoIsInBarrel)
4207                 h_dRPhoPFcand_ChHad_Cleaned_[1]->Fill(dR);
4208               else
4209                 h_dRPhoPFcand_ChHad_Cleaned_[2]->Fill(dR);
4210             }
4211             if (type == reco::PFCandidate::h0) {
4212               SumPtIsoValCleanNh += pfCandRef->pt();
4213               h_dRPhoPFcand_NeuHad_Cleaned_[0]->Fill(dR);
4214               if (phoIsInBarrel) {
4215                 h_dRPhoPFcand_NeuHad_Cleaned_[1]->Fill(dR);
4216                 if (phoIsInBarrel1) {
4217                   h_dRPhoPFcand_NeuHad_Cleaned_[3]->Fill(dR);
4218                 }
4219                 if (phoIsInBarrel2) {
4220                   h_dRPhoPFcand_NeuHad_Cleaned_[4]->Fill(dR);
4221                 }
4222               } else {
4223                 h_dRPhoPFcand_NeuHad_Cleaned_[2]->Fill(dR);
4224               }
4225             }
4226             if (type == reco::PFCandidate::gamma) {
4227               SumPtIsoValCleanPh += pfCandRef->pt();
4228               h_dRPhoPFcand_Pho_Cleaned_[0]->Fill(dR);
4229               if (phoIsInBarrel)
4230                 h_dRPhoPFcand_Pho_Cleaned_[1]->Fill(dR);
4231               else
4232                 h_dRPhoPFcand_Pho_Cleaned_[2]->Fill(dR);
4233             }
4234 
4235           }  // dr=0.4
4236         }  // loop over all PF Candidates
4237 
4238         h_SumPtOverPhoPt_ChHad_Cleaned_[0]->Fill(SumPtIsoValCleanCh / matchingPho->pt());
4239         h_SumPtOverPhoPt_NeuHad_Cleaned_[0]->Fill(SumPtIsoValCleanNh / matchingPho->pt());
4240         h_SumPtOverPhoPt_Pho_Cleaned_[0]->Fill(SumPtIsoValCleanPh / matchingPho->pt());
4241         h_SumPtOverPhoPt_ChHad_unCleaned_[0]->Fill(SumPtIsoValCh / matchingPho->pt());
4242         h_SumPtOverPhoPt_NeuHad_unCleaned_[0]->Fill(SumPtIsoValNh / matchingPho->pt());
4243         h_SumPtOverPhoPt_Pho_unCleaned_[0]->Fill(SumPtIsoValPh / matchingPho->pt());
4244         if (phoIsInBarrel) {
4245           h_SumPtOverPhoPt_ChHad_Cleaned_[1]->Fill(SumPtIsoValCleanCh / matchingPho->pt());
4246           h_SumPtOverPhoPt_NeuHad_Cleaned_[1]->Fill(SumPtIsoValCleanNh / matchingPho->pt());
4247           h_SumPtOverPhoPt_Pho_Cleaned_[1]->Fill(SumPtIsoValCleanPh / matchingPho->pt());
4248           h_SumPtOverPhoPt_ChHad_unCleaned_[1]->Fill(SumPtIsoValCh / matchingPho->pt());
4249           h_SumPtOverPhoPt_NeuHad_unCleaned_[1]->Fill(SumPtIsoValNh / matchingPho->pt());
4250           h_SumPtOverPhoPt_Pho_unCleaned_[1]->Fill(SumPtIsoValPh / matchingPho->pt());
4251         } else {
4252           h_SumPtOverPhoPt_ChHad_Cleaned_[2]->Fill(SumPtIsoValCleanCh / matchingPho->pt());
4253           h_SumPtOverPhoPt_NeuHad_Cleaned_[2]->Fill(SumPtIsoValCleanNh / matchingPho->pt());
4254           h_SumPtOverPhoPt_Pho_Cleaned_[2]->Fill(SumPtIsoValCleanPh / matchingPho->pt());
4255           h_SumPtOverPhoPt_ChHad_unCleaned_[2]->Fill(SumPtIsoValCh / matchingPho->pt());
4256           h_SumPtOverPhoPt_NeuHad_unCleaned_[2]->Fill(SumPtIsoValNh / matchingPho->pt());
4257           h_SumPtOverPhoPt_Pho_unCleaned_[2]->Fill(SumPtIsoValPh / matchingPho->pt());
4258         }
4259 
4260       }  // only for pfPhotonValidator
4261 
4262       if (!(visibleConversion && visibleConversionsWithTwoSimTracks))
4263         continue;
4264 
4265       if (!isRunCentrally_) {
4266         h_r9_[1][0]->Fill(r9);
4267         if (phoIsInBarrel)
4268           h_r9_[1][1]->Fill(r9);
4269         if (phoIsInEndcap)
4270           h_r9_[1][2]->Fill(r9);
4271 
4272         h_simConvVtxRvsZ_[0]->Fill(fabs(mcConvZ_), mcConvR_);
4273         if (fabs(mcEta_) <= 1.) {
4274           h_simConvVtxRvsZ_[1]->Fill(fabs(mcConvZ_), mcConvR_);
4275           h_simConvVtxYvsX_->Fill(mcConvX_, mcConvY_);
4276         } else
4277           h_simConvVtxRvsZ_[2]->Fill(fabs(mcConvZ_), mcConvR_);
4278       }
4279 
4280       if (!fastSim_) {
4281         ////////////////// plot quantities related to conversions
4282         reco::ConversionRefVector conversions = matchingPho->conversions();
4283         bool atLeastOneRecoTwoTrackConversion = false;
4284         for (unsigned int iConv = 0; iConv < conversions.size(); iConv++) {
4285           reco::ConversionRef aConv = conversions[iConv];
4286           double like = aConv->MVAout();
4287           if (like < likelihoodCut_)
4288             continue;
4289 
4290           if (!isRunCentrally_)
4291             h2_EoverEtrueVsEta_[1]->Fill(mcEta_, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4292           p_EoverEtrueVsEta_[1]->Fill(mcEta_, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4293 
4294           //std::vector<reco::TrackRef> tracks = aConv->tracks();
4295           const std::vector<edm::RefToBase<reco::Track> > tracks = aConv->tracks();
4296           if (tracks.size() < 2)
4297             continue;
4298           atLeastOneRecoTwoTrackConversion = true;
4299 
4300           h_mvaOut_[0]->Fill(like);
4301 
4302           if (tracks.size() == 2) {
4303             if (sqrt(aConv->tracksPin()[0].Perp2()) < convTrackMinPtCut_ ||
4304                 sqrt(aConv->tracksPin()[1].Perp2()) < convTrackMinPtCut_)
4305               continue;
4306           }
4307 
4308           if (dCotCutOn_) {
4309             if ((fabs(mcEta_) > 1.1 && fabs(mcEta_) < 1.4) && fabs(aConv->pairCotThetaSeparation()) > dCotHardCutValue_)
4310               continue;
4311             if (fabs(aConv->pairCotThetaSeparation()) > dCotCutValue_)
4312               continue;
4313           }
4314 
4315           nRecConv_++;
4316 
4317           std::map<const reco::Track*, TrackingParticleRef> myAss;
4318           std::map<const reco::Track*, TrackingParticleRef>::const_iterator itAss;
4319           std::map<reco::TrackRef, TrackingParticleRef>::const_iterator itAssMin;
4320           std::map<reco::TrackRef, TrackingParticleRef>::const_iterator itAssMax;
4321           //
4322 
4323           int nAssT2 = 0;
4324           for (unsigned int i = 0; i < tracks.size(); i++) {
4325             //      reco::TrackRef track = tracks[i].castTo<reco::TrackRef>();
4326 
4327             type = 0;
4328             if (!isRunCentrally_)
4329               nHitsVsEta_[type]->Fill(mcEta_, float(tracks[i]->numberOfValidHits()) - 0.0001);
4330             if (!isRunCentrally_)
4331               nHitsVsR_[type]->Fill(mcConvR_, float(tracks[i]->numberOfValidHits()) - 0.0001);
4332             p_nHitsVsEta_[type]->Fill(mcEta_, float(tracks[i]->numberOfValidHits() - 0.0001));
4333             p_nHitsVsR_[type]->Fill(mcConvR_, float(tracks[i]->numberOfValidHits() - 0.0001));
4334             h_tkChi2_[type]->Fill(tracks[i]->normalizedChi2());
4335 
4336             const RefToBase<reco::Track>& tfrb = tracks[i];
4337             RefToBaseVector<reco::Track> tc;
4338             tc.push_back(tfrb);
4339             // reco::RecoToSimCollection q = trackAssociator->associateRecoToSim(tc,theConvTP_);
4340             reco::SimToRecoCollection q = trackAssociator->associateSimToReco(tc, theConvTP_);
4341             std::vector<std::pair<RefToBase<reco::Track>, double> > trackV;
4342             int tpI = 0;
4343 
4344             if (q.find(theConvTP_[0]) != q.end()) {
4345               trackV = (std::vector<std::pair<RefToBase<reco::Track>, double> >)q[theConvTP_[0]];
4346             } else if (q.find(theConvTP_[1]) != q.end()) {
4347               trackV = (std::vector<std::pair<RefToBase<reco::Track>, double> >)q[theConvTP_[1]];
4348               tpI = 1;
4349             }
4350 
4351             if (trackV.empty())
4352               continue;
4353             edm::RefToBase<reco::Track> tr = trackV.front().first;
4354             myAss.insert(std::make_pair(tr.get(), theConvTP_[tpI]));
4355             nAssT2++;
4356           }
4357 
4358           type = 0;
4359 
4360           //      float totP = sqrt(aConv->pairMomentum().Mag2());
4361           float refP = -99999.;
4362           float refPt = -99999.;
4363           if (aConv->conversionVertex().isValid()) {
4364             refP = sqrt(aConv->refittedPairMomentum().Mag2());
4365             refPt = sqrt(aConv->refittedPairMomentum().perp2());
4366           }
4367           float invM = aConv->pairInvariantMass();
4368 
4369           h_invMass_[type][0]->Fill(invM);
4370           if (phoIsInBarrel)
4371             h_invMass_[type][1]->Fill(invM);
4372           if (phoIsInEndcap)
4373             h_invMass_[type][2]->Fill(invM);
4374 
4375           ////////// Numerators for conversion absolute efficiency
4376           if (tracks.size() == 2) {
4377             h_SimConvTwoTracks_[0]->Fill(mcEta_);
4378             h_SimConvTwoTracks_[1]->Fill(mcPhi_);
4379             h_SimConvTwoTracks_[2]->Fill(mcConvR_);
4380             h_SimConvTwoTracks_[3]->Fill(mcConvZ_);
4381             h_SimConvTwoTracks_[4]->Fill((*mcPho).fourMomentum().et());
4382 
4383             if (!aConv->caloCluster().empty())
4384               h_convEta_[1]->Fill(aConv->caloCluster()[0]->eta());
4385 
4386             float trkProvenance = 3;
4387             if (tracks[0]->algoName() == "outInEcalSeededConv" && tracks[1]->algoName() == "outInEcalSeededConv")
4388               trkProvenance = 0;
4389             if (tracks[0]->algoName() == "inOutEcalSeededConv" && tracks[1]->algoName() == "inOutEcalSeededConv")
4390               trkProvenance = 1;
4391             if ((tracks[0]->algoName() == "outInEcalSeededConv" && tracks[1]->algoName() == "inOutEcalSeededConv") ||
4392                 (tracks[1]->algoName() == "outInEcalSeededConv" && tracks[0]->algoName() == "inOutEcalSeededConv"))
4393               trkProvenance = 2;
4394             if (trkProvenance == 3) {
4395             }
4396             h_trkProv_[0]->Fill(trkProvenance);
4397             h_trkAlgo_->Fill(tracks[0]->algo());
4398             h_trkAlgo_->Fill(tracks[1]->algo());
4399             h_convAlgo_->Fill(aConv->algo());
4400 
4401             ////////// Numerators for conversion efficiencies: both tracks are associated
4402             if (nAssT2 == 2) {
4403               if (!isRunCentrally_) {
4404                 h_r9_[2][0]->Fill(r9);
4405                 if (phoIsInBarrel)
4406                   h_r9_[2][1]->Fill(r9);
4407                 if (phoIsInEndcap)
4408                   h_r9_[2][2]->Fill(r9);
4409               }
4410 
4411               if (!aConv->caloCluster().empty())
4412                 h_convEta_[2]->Fill(aConv->caloCluster()[0]->eta());
4413               nRecConvAss_++;
4414 
4415               h_SimConvTwoMTracks_[0]->Fill(mcEta_);
4416               h_SimConvTwoMTracks_[1]->Fill(mcPhi_);
4417               h_SimConvTwoMTracks_[2]->Fill(mcConvR_);
4418               h_SimConvTwoMTracks_[3]->Fill(mcConvZ_);
4419               h_SimConvTwoMTracks_[4]->Fill((*mcPho).fourMomentum().et());
4420 
4421               if (aConv->conversionVertex().isValid()) {
4422                 float chi2Prob =
4423                     ChiSquaredProbability(aConv->conversionVertex().chi2(), aConv->conversionVertex().ndof());
4424                 if (chi2Prob > 0) {
4425                   h_SimConvTwoMTracksAndVtxPGT0_[0]->Fill(mcEta_);
4426                   h_SimConvTwoMTracksAndVtxPGT0_[1]->Fill(mcPhi_);
4427                   h_SimConvTwoMTracksAndVtxPGT0_[2]->Fill(mcConvR_);
4428                   h_SimConvTwoMTracksAndVtxPGT0_[3]->Fill(mcConvZ_);
4429                   h_SimConvTwoMTracksAndVtxPGT0_[4]->Fill((*mcPho).fourMomentum().et());
4430                 }
4431                 if (chi2Prob > 0.0005) {
4432                   h_SimConvTwoMTracksAndVtxPGT0005_[0]->Fill(mcEta_);
4433                   h_SimConvTwoMTracksAndVtxPGT0005_[1]->Fill(mcPhi_);
4434                   h_SimConvTwoMTracksAndVtxPGT0005_[2]->Fill(mcConvR_);
4435                   h_SimConvTwoMTracksAndVtxPGT0005_[3]->Fill(mcConvZ_);
4436                   h_SimConvTwoMTracksAndVtxPGT0005_[4]->Fill((*mcPho).fourMomentum().et());
4437                 }
4438 
4439                 if (chi2Prob > 0.0005) {
4440                   if (!aConv->caloCluster().empty()) {
4441                     h_convEta_[0]->Fill(aConv->caloCluster()[0]->eta());
4442                     h_convPhi_[0]->Fill(aConv->caloCluster()[0]->phi());
4443                     h_convERes_[0][0]->Fill(aConv->caloCluster()[0]->energy() / (*mcPho).fourMomentum().e());
4444                   }
4445                   if (!isRunCentrally_) {
4446                     h_r9VsNofTracks_[0][0]->Fill(r9, aConv->nTracks());
4447                     h_EtR9Less093_[1][0]->Fill(photonEt);
4448                     if (phoIsInBarrel)
4449                       h_EtR9Less093_[1][1]->Fill(photonEt);
4450                     if (phoIsInEndcap)
4451                       h_EtR9Less093_[1][2]->Fill(photonEt);
4452                   }
4453                   if (phoIsInBarrel) {
4454                     if (!aConv->caloCluster().empty())
4455                       h_convERes_[0][1]->Fill(aConv->caloCluster()[0]->energy() / (*mcPho).fourMomentum().e());
4456                     if (!isRunCentrally_)
4457                       h_r9VsNofTracks_[0][1]->Fill(r9, aConv->nTracks());
4458                     h_mvaOut_[1]->Fill(like);
4459                   }
4460                   if (phoIsInEndcap) {
4461                     if (!aConv->caloCluster().empty())
4462                       h_convERes_[0][2]->Fill(aConv->caloCluster()[0]->energy() / (*mcPho).fourMomentum().e());
4463                     if (!isRunCentrally_)
4464                       h_r9VsNofTracks_[0][2]->Fill(r9, aConv->nTracks());
4465                     h_mvaOut_[2]->Fill(like);
4466                   }
4467                 }
4468               }
4469 
4470               ///////////  Quantities per conversion
4471               type = 1;
4472 
4473               h_trkProv_[1]->Fill(trkProvenance);
4474               h_invMass_[type][0]->Fill(invM);
4475 
4476               float eoverp = -99999.;
4477 
4478               if (aConv->conversionVertex().isValid()) {
4479                 eoverp = photonE / sqrt(aConv->refittedPairMomentum().Mag2());
4480                 //eoverp= aConv->EoverPrefittedTracks();
4481                 h_convPtRes_[type][0]->Fill(refPt / (*mcPho).fourMomentum().et());
4482                 h_EoverPTracks_[type][0]->Fill(eoverp);
4483                 h_PoverETracks_[type][0]->Fill(1. / eoverp);
4484                 if (!isRunCentrally_)
4485                   h2_EoverEtrueVsEoverP_[0]->Fill(eoverp,
4486                                                   matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4487                 if (!isRunCentrally_)
4488                   h2_PoverPtrueVsEoverP_[0]->Fill(eoverp, refP / (*mcPho).fourMomentum().e());
4489                 if (!isRunCentrally_)
4490                   h2_EoverPVsEta_[0]->Fill(mcEta_, eoverp);
4491                 if (!isRunCentrally_)
4492                   h2_EoverPVsR_[0]->Fill(mcConvR_, eoverp);
4493                 p_EoverPVsEta_[0]->Fill(mcEta_, eoverp);
4494                 p_EoverPVsR_[0]->Fill(mcConvR_, eoverp);
4495                 p_eResVsR_->Fill(mcConvR_, photonE / (*mcPho).fourMomentum().e());
4496                 if (!isRunCentrally_)
4497                   h2_PoverPtrueVsEta_[0]->Fill(mcEta_, refP / (*mcPho).fourMomentum().e());
4498                 p_PoverPtrueVsEta_[0]->Fill(mcEta_, refP / (*mcPho).fourMomentum().e());
4499               }
4500 
4501               if (!isRunCentrally_)
4502                 h2_EoverEtrueVsEta_[0]->Fill(mcEta_,
4503                                              matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4504               if (!isRunCentrally_)
4505                 h2_EoverEtrueVsR_[0]->Fill(mcConvR_,
4506                                            matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4507               p_EoverEtrueVsEta_[0]->Fill(mcEta_, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4508               p_EoverEtrueVsR_[0]->Fill(mcConvR_, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4509 
4510               if (!isRunCentrally_)
4511                 h2_etaVsRsim_[0]->Fill(mcEta_, mcConvR_);
4512 
4513               //  here original tracks and their inner momentum is considered
4514               float dPhiTracksAtVtx = aConv->dPhiTracksAtVtx();
4515               h_DPhiTracksAtVtx_[type][0]->Fill(dPhiTracksAtVtx);
4516               if (!isRunCentrally_)
4517                 h2_DPhiTracksAtVtxVsEta_->Fill(mcEta_, dPhiTracksAtVtx);
4518               if (!isRunCentrally_)
4519                 h2_DPhiTracksAtVtxVsR_->Fill(mcConvR_, dPhiTracksAtVtx);
4520               p_DPhiTracksAtVtxVsEta_->Fill(mcEta_, dPhiTracksAtVtx);
4521               p_DPhiTracksAtVtxVsR_->Fill(mcConvR_, dPhiTracksAtVtx);
4522 
4523               h_DCotTracks_[type][0]->Fill(aConv->pairCotThetaSeparation());
4524               if (!isRunCentrally_)
4525                 h2_DCotTracksVsEta_->Fill(mcEta_, aConv->pairCotThetaSeparation());
4526               if (!isRunCentrally_)
4527                 h2_DCotTracksVsR_->Fill(mcConvR_, aConv->pairCotThetaSeparation());
4528               p_DCotTracksVsEta_->Fill(mcEta_, aConv->pairCotThetaSeparation());
4529               p_DCotTracksVsR_->Fill(mcConvR_, aConv->pairCotThetaSeparation());
4530 
4531               if (phoIsInBarrel) {
4532                 h_invMass_[type][1]->Fill(invM);
4533                 if (aConv->conversionVertex().isValid()) {
4534                   h_convPtRes_[type][1]->Fill(refPt / (*mcPho).fourMomentum().et());
4535                   h_EoverPTracks_[type][1]->Fill(eoverp);
4536                   if (mcConvR_ < 15)
4537                     h_EoverPTracks_[0][0]->Fill(eoverp);
4538                   if (mcConvR_ > 15 && mcConvR_ < 58)
4539                     h_EoverPTracks_[0][1]->Fill(eoverp);
4540                   if (mcConvR_ > 58)
4541                     h_EoverPTracks_[0][2]->Fill(eoverp);
4542                   h_PoverETracks_[type][1]->Fill(1. / eoverp);
4543                   if (!isRunCentrally_)
4544                     h2_EoverEtrueVsEoverP_[1]->Fill(
4545                         eoverp, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4546                   if (!isRunCentrally_)
4547                     h2_PoverPtrueVsEoverP_[1]->Fill(eoverp, refP / (*mcPho).fourMomentum().e());
4548                 }
4549                 h_DPhiTracksAtVtx_[type][1]->Fill(dPhiTracksAtVtx);
4550                 h_DCotTracks_[type][1]->Fill(aConv->pairCotThetaSeparation());
4551               }
4552 
4553               if (phoIsInEndcap) {
4554                 h_invMass_[type][2]->Fill(invM);
4555                 if (aConv->conversionVertex().isValid()) {
4556                   h_convPtRes_[type][2]->Fill(refPt / (*mcPho).fourMomentum().et());
4557                   h_EoverPTracks_[type][2]->Fill(eoverp);
4558                   h_PoverETracks_[type][2]->Fill(1. / eoverp);
4559                   if (!isRunCentrally_)
4560                     h2_EoverEtrueVsEoverP_[2]->Fill(
4561                         eoverp, matchingPho->superCluster()->energy() / (*mcPho).fourMomentum().e());
4562                   if (!isRunCentrally_)
4563                     h2_PoverPtrueVsEoverP_[2]->Fill(eoverp, refP / (*mcPho).fourMomentum().e());
4564                 }
4565                 h_DPhiTracksAtVtx_[type][2]->Fill(dPhiTracksAtVtx);
4566                 h_DCotTracks_[type][2]->Fill(aConv->pairCotThetaSeparation());
4567               }
4568 
4569               if (aConv->conversionVertex().isValid()) {
4570                 h_convVtxdX_->Fill(aConv->conversionVertex().position().x() - mcConvX_);
4571                 h_convVtxdY_->Fill(aConv->conversionVertex().position().y() - mcConvY_);
4572                 h_convVtxdZ_->Fill(aConv->conversionVertex().position().z() - mcConvZ_);
4573                 h_convVtxdR_->Fill(sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
4574 
4575                 if (fabs(mcConvEta_) <= 1.2) {
4576                   h_convVtxdX_barrel_->Fill(aConv->conversionVertex().position().x() - mcConvX_);
4577                   h_convVtxdY_barrel_->Fill(aConv->conversionVertex().position().y() - mcConvY_);
4578                   h_convVtxdZ_barrel_->Fill(aConv->conversionVertex().position().z() - mcConvZ_);
4579                   h_convVtxdR_barrel_->Fill(sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
4580                 } else {
4581                   h_convVtxdX_endcap_->Fill(aConv->conversionVertex().position().x() - mcConvX_);
4582                   h_convVtxdY_endcap_->Fill(aConv->conversionVertex().position().y() - mcConvY_);
4583                   h_convVtxdZ_endcap_->Fill(aConv->conversionVertex().position().z() - mcConvZ_);
4584                   h_convVtxdR_endcap_->Fill(sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
4585                 }
4586 
4587                 h_convVtxdPhi_->Fill(aConv->conversionVertex().position().phi() - mcConvPhi_);
4588                 h_convVtxdEta_->Fill(aConv->conversionVertex().position().eta() - mcConvEta_);
4589                 if (!isRunCentrally_)
4590                   h2_convVtxdRVsR_->Fill(mcConvR_, sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
4591                 if (!isRunCentrally_)
4592                   h2_convVtxdRVsEta_->Fill(mcEta_, sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
4593                 p_convVtxdRVsR_->Fill(mcConvR_, sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
4594                 p_convVtxdRVsEta_->Fill(mcEta_, sqrt(aConv->conversionVertex().position().perp2()) - mcConvR_);
4595                 float signX = aConv->refittedPairMomentum().x() / fabs(aConv->refittedPairMomentum().x());
4596                 float signY = aConv->refittedPairMomentum().y() / fabs(aConv->refittedPairMomentum().y());
4597                 float signZ = aConv->refittedPairMomentum().z() / fabs(aConv->refittedPairMomentum().z());
4598                 p_convVtxdXVsX_->Fill(mcConvX_, (aConv->conversionVertex().position().x() - mcConvX_) * signX);
4599                 p_convVtxdYVsY_->Fill(mcConvY_, (aConv->conversionVertex().position().y() - mcConvY_) * signY);
4600                 p_convVtxdZVsZ_->Fill(mcConvZ_, (aConv->conversionVertex().position().z() - mcConvZ_) * signZ);
4601 
4602                 if (!isRunCentrally_)
4603                   h2_convVtxRrecVsTrue_->Fill(mcConvR_, sqrt(aConv->conversionVertex().position().perp2()));
4604 
4605                 //float zPV = aConv->zOfPrimaryVertexFromTracks();
4606                 float thetaConv = aConv->refittedPairMomentum().Theta();
4607                 float thetaSC = matchingPho->superCluster()->position().theta();
4608                 float rSC =
4609                     sqrt(matchingPho->superCluster()->position().x() * matchingPho->superCluster()->position().x() +
4610                          matchingPho->superCluster()->position().y() * matchingPho->superCluster()->position().y());
4611                 float zSC = matchingPho->superCluster()->position().z();
4612                 float zPV = sqrt(rSC * rSC + zSC * zSC) * sin(thetaConv - thetaSC) / sin(thetaConv);
4613 
4614                 h_zPVFromTracks_[0]->Fill(zPV);
4615                 h_dzPVFromTracks_[0]->Fill(zPV - (*mcPho).primaryVertex().z());
4616 
4617                 if (phoIsInBarrel) {
4618                   h_zPVFromTracks_[1]->Fill(zPV);
4619                   h_dzPVFromTracks_[1]->Fill(zPV - (*mcPho).primaryVertex().z());
4620                 } else if (phoIsInEndcap) {
4621                   h_zPVFromTracks_[2]->Fill(zPV);
4622                   h_dzPVFromTracks_[2]->Fill(zPV - (*mcPho).primaryVertex().z());
4623                 } else if (phoIsInEndcapP) {
4624                   h_zPVFromTracks_[3]->Fill(zPV);
4625                   h_dzPVFromTracks_[3]->Fill(zPV - (*mcPho).primaryVertex().z());
4626                 } else if (phoIsInEndcapM) {
4627                   h_zPVFromTracks_[4]->Fill(zPV);
4628                   h_dzPVFromTracks_[4]->Fill(zPV - (*mcPho).primaryVertex().z());
4629                 }
4630 
4631                 p_dzPVVsR_->Fill(mcConvR_, zPV - (*mcPho).primaryVertex().z());
4632                 p_dzPVVsEta_->Fill(mcConvEta_, zPV - (*mcPho).primaryVertex().z());
4633                 if (!isRunCentrally_)
4634                   h2_dzPVVsR_->Fill(mcConvR_, zPV - (*mcPho).primaryVertex().z());
4635               }
4636 
4637               float dPhiTracksAtEcal = -99;
4638               float dEtaTracksAtEcal = -99;
4639               if (!aConv->bcMatchingWithTracks().empty() && aConv->bcMatchingWithTracks()[0].isNonnull() &&
4640                   aConv->bcMatchingWithTracks()[1].isNonnull()) {
4641                 nRecConvAssWithEcal_++;
4642                 float recoPhi1 = aConv->ecalImpactPosition()[0].phi();
4643                 float recoPhi2 = aConv->ecalImpactPosition()[1].phi();
4644                 float recoEta1 = aConv->ecalImpactPosition()[0].eta();
4645                 float recoEta2 = aConv->ecalImpactPosition()[1].eta();
4646                 // unused   float bcPhi1 = aConv->bcMatchingWithTracks()[0]->phi();
4647                 // unused   float bcPhi2 = aConv->bcMatchingWithTracks()[1]->phi();
4648                 // unused   float bcEta1 = aConv->bcMatchingWithTracks()[0]->eta();
4649                 // unused   float bcEta2 = aConv->bcMatchingWithTracks()[1]->eta();
4650                 recoPhi1 = phiNormalization(recoPhi1);
4651                 recoPhi2 = phiNormalization(recoPhi2);
4652                 dPhiTracksAtEcal = recoPhi1 - recoPhi2;
4653                 dPhiTracksAtEcal = phiNormalization(dPhiTracksAtEcal);
4654                 dEtaTracksAtEcal = recoEta1 - recoEta2;
4655 
4656                 h_DPhiTracksAtEcal_[type][0]->Fill(fabs(dPhiTracksAtEcal));
4657                 if (!isRunCentrally_)
4658                   h2_DPhiTracksAtEcalVsR_->Fill(mcConvR_, fabs(dPhiTracksAtEcal));
4659                 if (!isRunCentrally_)
4660                   h2_DPhiTracksAtEcalVsEta_->Fill(mcEta_, fabs(dPhiTracksAtEcal));
4661                 p_DPhiTracksAtEcalVsR_->Fill(mcConvR_, fabs(dPhiTracksAtEcal));
4662                 p_DPhiTracksAtEcalVsEta_->Fill(mcEta_, fabs(dPhiTracksAtEcal));
4663 
4664                 h_DEtaTracksAtEcal_[type][0]->Fill(dEtaTracksAtEcal);
4665 
4666                 if (phoIsInBarrel) {
4667                   h_DPhiTracksAtEcal_[type][1]->Fill(fabs(dPhiTracksAtEcal));
4668                   h_DEtaTracksAtEcal_[type][1]->Fill(dEtaTracksAtEcal);
4669                 }
4670                 if (phoIsInEndcap) {
4671                   h_DPhiTracksAtEcal_[type][2]->Fill(fabs(dPhiTracksAtEcal));
4672                   h_DEtaTracksAtEcal_[type][2]->Fill(dEtaTracksAtEcal);
4673                 }
4674               }
4675               ///////////  Quantities per track
4676               for (unsigned int i = 0; i < tracks.size(); i++) {
4677                 const RefToBase<reco::Track>& tfrb(tracks[i]);
4678                 itAss = myAss.find(tfrb.get());
4679                 if (itAss == myAss.end())
4680                   continue;
4681 
4682                 float trkProvenance = 3;
4683                 if (tracks[0]->algoName() == "outInEcalSeededConv" && tracks[1]->algoName() == "outInEcalSeededConv")
4684                   trkProvenance = 0;
4685                 if (tracks[0]->algoName() == "inOutEcalSeededConv" && tracks[1]->algoName() == "inOutEcalSeededConv")
4686                   trkProvenance = 1;
4687                 if ((tracks[0]->algoName() == "outInEcalSeededConv" &&
4688                      tracks[1]->algoName() == "inOutEcalSeededConv") ||
4689                     (tracks[1]->algoName() == "outInEcalSeededConv" && tracks[0]->algoName() == "inOutEcalSeededConv"))
4690                   trkProvenance = 2;
4691 
4692                 if (!isRunCentrally_)
4693                   nHitsVsEta_[type]->Fill(mcEta_, float(tracks[i]->numberOfValidHits()));
4694                 if (!isRunCentrally_)
4695                   nHitsVsR_[type]->Fill(mcConvR_, float(tracks[i]->numberOfValidHits()));
4696                 p_nHitsVsEta_[type]->Fill(mcEta_, float(tracks[i]->numberOfValidHits()) - 0.0001);
4697                 p_nHitsVsR_[type]->Fill(mcConvR_, float(tracks[i]->numberOfValidHits()) - 0.0001);
4698                 h_tkChi2_[type]->Fill(tracks[i]->normalizedChi2());