Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-08-21 04:46:55

0001 
0002 // user include files
0003 #include "Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h"
0004 
0005 #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronUtilities.h"
0006 
0007 #include "DQMServices/Core/interface/DQMStore.h"
0008 
0009 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
0010 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0011 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
0012 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0013 #include "DataFormats/EgammaReco/interface/ElectronSeed.h"
0014 #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
0015 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0016 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0017 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0018 
0019 #include "DataFormats/Common/interface/Handle.h"
0020 #include "DataFormats/Common/interface/ValueMap.h"
0021 
0022 #include "DataFormats/VertexReco/interface/Vertex.h"
0023 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0024 
0025 #include "RecoEcal/EgammaCoreTools/interface/EcalTools.h"
0026 
0027 #include "FWCore/ServiceRegistry/interface/Service.h"
0028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0029 #include "FWCore/Framework/interface/Event.h"
0030 #include "FWCore/Framework/interface/EventSetup.h"
0031 #include "FWCore/Framework/interface/MakerMacros.h"
0032 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0033 
0034 #include "FWCore/Utilities/interface/InputTag.h"
0035 #include "FWCore/Utilities/interface/ESInputTag.h"
0036 #include "FWCore/Utilities/interface/ESGetToken.h"
0037 #include "FWCore/Framework/interface/ESHandle.h"
0038 #include "FWCore/Framework/interface/ConsumesCollector.h"
0039 
0040 #include "CLHEP/Units/GlobalPhysicalConstants.h"
0041 #include "TMath.h"
0042 #include "TFile.h"
0043 #include "TH1F.h"
0044 #include "TH1I.h"
0045 #include "TH2F.h"
0046 #include "TProfile.h"
0047 #include "TTree.h"
0048 #include <vector>
0049 #include <iostream>
0050 #include <typeinfo>
0051 
0052 using namespace reco;
0053 
0054 ElectronMcSignalValidator::ElectronMcSignalValidator(const edm::ParameterSet &conf) : ElectronDqmAnalyzerBase(conf) {
0055   mcTruthCollection_ = consumes<reco::GenParticleCollection>(conf.getParameter<edm::InputTag>("mcTruthCollection"));
0056   electronCollection_ = consumes<reco::GsfElectronCollection>(conf.getParameter<edm::InputTag>("electronCollection"));
0057   electronCollectionEndcaps_ =
0058       consumes<reco::GsfElectronCollection>(conf.getParameter<edm::InputTag>("electronCollectionEndcaps"));
0059   electronCoreCollection_ =
0060       consumes<reco::GsfElectronCoreCollection>(conf.getParameter<edm::InputTag>("electronCoreCollection"));
0061   electronCoreCollectionEndcaps_ =
0062       consumes<reco::GsfElectronCoreCollection>(conf.getParameter<edm::InputTag>("electronCoreCollectionEndcaps"));
0063   electronTrackCollection_ =
0064       consumes<reco::GsfTrackCollection>(conf.getParameter<edm::InputTag>("electronTrackCollection"));
0065   electronSeedCollection_ =
0066       consumes<reco::ElectronSeedCollection>(conf.getParameter<edm::InputTag>("electronSeedCollection"));
0067   offlineVerticesCollection_ =
0068       consumes<reco::VertexCollection>(conf.getParameter<edm::InputTag>("offlinePrimaryVertices"));
0069   beamSpotTag_ = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("beamSpot"));
0070 
0071   readAOD_ = conf.getParameter<bool>("readAOD");
0072 
0073   isoFromDepsTk03Tag_ = consumes<edm::ValueMap<double> >(conf.getParameter<edm::InputTag>("isoFromDepsTk03"));
0074   isoFromDepsTk04Tag_ = consumes<edm::ValueMap<double> >(conf.getParameter<edm::InputTag>("isoFromDepsTk04"));
0075   isoFromDepsEcalFull03Tag_ =
0076       consumes<edm::ValueMap<double> >(conf.getParameter<edm::InputTag>("isoFromDepsEcalFull03"));
0077   isoFromDepsEcalFull04Tag_ =
0078       consumes<edm::ValueMap<double> >(conf.getParameter<edm::InputTag>("isoFromDepsEcalFull04"));
0079   isoFromDepsEcalReduced03Tag_ =
0080       consumes<edm::ValueMap<double> >(conf.getParameter<edm::InputTag>("isoFromDepsEcalReduced03"));
0081   isoFromDepsEcalReduced04Tag_ =
0082       consumes<edm::ValueMap<double> >(conf.getParameter<edm::InputTag>("isoFromDepsEcalReduced04"));
0083   isoFromDepsHcal03Tag_ = consumes<edm::ValueMap<double> >(conf.getParameter<edm::InputTag>("isoFromDepsHcal03"));
0084   isoFromDepsHcal04Tag_ = consumes<edm::ValueMap<double> >(conf.getParameter<edm::InputTag>("isoFromDepsHcal04"));
0085 
0086   maxPt_ = conf.getParameter<double>("MaxPt");
0087   maxAbsEta_ = conf.getParameter<double>("MaxAbsEta");
0088   maxAbsEtaExtended_ = conf.getParameter<double>("MaxAbsEtaExtended");
0089   deltaR2_ = conf.getParameter<double>("DeltaR") * conf.getParameter<double>("DeltaR");
0090   matchingIDs_ = conf.getParameter<std::vector<int> >("MatchingID");
0091   matchingMotherIDs_ = conf.getParameter<std::vector<int> >("MatchingMotherID");
0092   inputFile_ = conf.getParameter<std::string>("InputFile");
0093   outputFile_ = conf.getParameter<std::string>("OutputFile");
0094   inputInternalPath_ = conf.getParameter<std::string>("InputFolderName");
0095   outputInternalPath_ = conf.getParameter<std::string>("OutputFolderName");
0096 
0097   // histos bining and limits
0098 
0099   edm::ParameterSet histosSet = conf.getParameter<edm::ParameterSet>("histosCfg");
0100 
0101   xyz_nbin = histosSet.getParameter<int>("Nbinxyz");
0102 
0103   p_nbin = histosSet.getParameter<int>("Nbinp");
0104   p2D_nbin = histosSet.getParameter<int>("Nbinp2D");
0105   p_max = histosSet.getParameter<double>("Pmax");
0106 
0107   pt_nbin = histosSet.getParameter<int>("Nbinpt");
0108   pt2D_nbin = histosSet.getParameter<int>("Nbinpt2D");
0109   pteff_nbin = histosSet.getParameter<int>("Nbinpteff");
0110   pt_max = histosSet.getParameter<double>("Ptmax");
0111 
0112   fhits_nbin = histosSet.getParameter<int>("Nbinfhits");
0113   fhits_max = histosSet.getParameter<double>("Fhitsmax");
0114 
0115   lhits_nbin = histosSet.getParameter<int>("Nbinlhits");
0116   lhits_max = histosSet.getParameter<double>("Lhitsmax");
0117 
0118   eop_nbin = histosSet.getParameter<int>("Nbineop");
0119   eop2D_nbin = histosSet.getParameter<int>("Nbineop2D");
0120   eop_max = histosSet.getParameter<double>("Eopmax");
0121   eopmaxsht = histosSet.getParameter<double>("Eopmaxsht");
0122 
0123   eta_nbin = histosSet.getParameter<int>("Nbineta");
0124   eta2D_nbin = histosSet.getParameter<int>("Nbineta2D");
0125   eta_min = histosSet.getParameter<double>("Etamin");
0126   eta_max = histosSet.getParameter<double>("Etamax");
0127 
0128   eta_nbin_extended = histosSet.getParameter<int>("NbinetaExtended");
0129   eta2D_nbin_extended = histosSet.getParameter<int>("Nbineta2DExtended");
0130   eta_min_extended = histosSet.getParameter<double>("EtaminExtended");
0131   eta_max_extended = histosSet.getParameter<double>("EtamaxExtended");
0132 
0133   deta_nbin = histosSet.getParameter<int>("Nbindeta");
0134   deta_min = histosSet.getParameter<double>("Detamin");
0135   deta_max = histosSet.getParameter<double>("Detamax");
0136 
0137   phi_nbin = histosSet.getParameter<int>("Nbinphi");
0138   phi2D_nbin = histosSet.getParameter<int>("Nbinphi2D");
0139   phi_min = histosSet.getParameter<double>("Phimin");
0140   phi_max = histosSet.getParameter<double>("Phimax");
0141 
0142   detamatch_nbin = histosSet.getParameter<int>("Nbindetamatch");
0143   detamatch2D_nbin = histosSet.getParameter<int>("Nbindetamatch2D");
0144   detamatch_min = histosSet.getParameter<double>("Detamatchmin");
0145   detamatch_max = histosSet.getParameter<double>("Detamatchmax");
0146 
0147   dphi_nbin = histosSet.getParameter<int>("Nbindphi");
0148   dphi_min = histosSet.getParameter<double>("Dphimin");
0149   dphi_max = histosSet.getParameter<double>("Dphimax");
0150 
0151   dphimatch_nbin = histosSet.getParameter<int>("Nbindphimatch");
0152   dphimatch2D_nbin = histosSet.getParameter<int>("Nbindphimatch2D");
0153   dphimatch_min = histosSet.getParameter<double>("Dphimatchmin");
0154   dphimatch_max = histosSet.getParameter<double>("Dphimatchmax");
0155 
0156   poptrue_nbin = histosSet.getParameter<int>("Nbinpoptrue");
0157   poptrue_min = histosSet.getParameter<double>("Poptruemin");
0158   poptrue_max = histosSet.getParameter<double>("Poptruemax");
0159 
0160   mee_nbin = histosSet.getParameter<int>("Nbinmee");
0161   mee_min = histosSet.getParameter<double>("Meemin");
0162   mee_max = histosSet.getParameter<double>("Meemax");
0163 
0164   hoe_nbin = histosSet.getParameter<int>("Nbinhoe");
0165   hoe_min = histosSet.getParameter<double>("Hoemin");
0166   hoe_max = histosSet.getParameter<double>("Hoemax");
0167 
0168   error_nbin = histosSet.getParameter<int>("Nbinerror");
0169   enerror_max = histosSet.getParameter<double>("Energyerrormax");
0170 
0171   set_EfficiencyFlag = histosSet.getParameter<bool>("EfficiencyFlag");
0172   set_StatOverflowFlag = histosSet.getParameter<bool>("StatOverflowFlag");
0173 
0174   opv_nbin = histosSet.getParameter<int>("NbinOPV");
0175   opv_min = histosSet.getParameter<double>("OPV_min");
0176   opv_max = histosSet.getParameter<double>("OPV_max");
0177 
0178   ele_nbin = histosSet.getParameter<int>("NbinELE");
0179   ele_min = histosSet.getParameter<double>("ELE_min");
0180   ele_max = histosSet.getParameter<double>("ELE_max");
0181 
0182   core_nbin = histosSet.getParameter<int>("NbinCORE");
0183   core_min = histosSet.getParameter<double>("CORE_min");
0184   core_max = histosSet.getParameter<double>("CORE_max");
0185 
0186   track_nbin = histosSet.getParameter<int>("NbinTRACK");
0187   track_min = histosSet.getParameter<double>("TRACK_min");
0188   track_max = histosSet.getParameter<double>("TRACK_max");
0189 
0190   seed_nbin = histosSet.getParameter<int>("NbinSEED");
0191   seed_min = histosSet.getParameter<double>("SEED_min");
0192   seed_max = histosSet.getParameter<double>("SEED_max");
0193 
0194   // so to please coverity...
0195   h1_mcNum = nullptr;
0196   h1_eleNum = nullptr;
0197   h1_gamNum = nullptr;
0198 
0199   h1_recEleNum = nullptr;
0200   h1_recCoreNum = nullptr;
0201   h1_recTrackNum = nullptr;
0202   h1_recSeedNum = nullptr;
0203   h1_recOfflineVertices = nullptr;
0204 
0205   h1_mc_Eta = nullptr;
0206   h1_mc_Eta_Extended = nullptr;
0207   h1_mc_AbsEta = nullptr;
0208   h1_mc_AbsEta_Extended = nullptr;
0209   h1_mc_P = nullptr;
0210   h1_mc_Pt = nullptr;
0211   h1_mc_Phi = nullptr;
0212   h1_mc_Z = nullptr;
0213   h2_mc_PtEta = nullptr;
0214 
0215   h1_mc_Eta_Extended_matched = nullptr;
0216   h1_mc_AbsEta_matched = nullptr;
0217   h1_mc_AbsEta_Extended_matched = nullptr;
0218   h1_mc_Pt_matched = nullptr;
0219   h1_mc_Phi_matched = nullptr;
0220   h1_mc_Z_matched = nullptr;
0221   h2_mc_PtEta_matched = nullptr;
0222 
0223   h1_mc_Eta_matched_qmisid = nullptr;
0224   h1_mc_AbsEta_matched_qmisid = nullptr;
0225   h1_mc_Pt_matched_qmisid = nullptr;
0226   h1_mc_Phi_matched_qmisid = nullptr;
0227   h1_mc_Z_matched_qmisid = nullptr;
0228 
0229   h1_ele_EoverP_all = nullptr;
0230   h1_ele_EoverP_all_barrel = nullptr;
0231   h1_ele_EoverP_all_endcaps = nullptr;
0232   h1_ele_EseedOP_all = nullptr;
0233   h1_ele_EseedOP_all_barrel = nullptr;
0234   h1_ele_EseedOP_all_endcaps = nullptr;
0235   h1_ele_EoPout_all = nullptr;
0236   h1_ele_EeleOPout_all = nullptr;
0237   h1_ele_dEtaSc_propVtx_all = nullptr;
0238   h1_ele_dEtaSc_propVtx_all_barrel = nullptr;
0239   h1_ele_dEtaSc_propVtx_all_endcaps = nullptr;
0240   h1_ele_dPhiSc_propVtx_all = nullptr;
0241   h1_ele_dPhiSc_propVtx_all_barrel = nullptr;
0242   h1_ele_dPhiSc_propVtx_all_endcaps = nullptr;
0243   h1_ele_dEtaCl_propOut_all = nullptr;
0244   h1_ele_dEtaCl_propOut_all_barrel = nullptr;
0245   h1_ele_dEtaCl_propOut_all_endcaps = nullptr;
0246   h1_ele_dPhiCl_propOut_all = nullptr;
0247   h1_ele_dPhiCl_propOut_all_barrel = nullptr;
0248   h1_ele_dPhiCl_propOut_all_endcaps = nullptr;
0249   h1_ele_TIP_all = nullptr;
0250   h1_ele_TIP_all_barrel = nullptr;
0251   h1_ele_TIP_all_endcaps = nullptr;
0252   h1_ele_HoE_all = nullptr;
0253   h1_ele_HoE_all_barrel = nullptr;
0254   h1_ele_HoE_all_endcaps = nullptr;
0255   h1_ele_vertexEta_all = nullptr;
0256   h1_ele_vertexPt_all = nullptr;
0257   h1_ele_Et_all = nullptr;
0258   h1_ele_mee_all = nullptr;
0259   h1_ele_mee_os = nullptr;
0260   h1_ele_mee_os_ebeb = nullptr;
0261   h1_ele_mee_os_ebee = nullptr;
0262   h1_ele_mee_os_eeee = nullptr;
0263   h1_ele_mee_os_gg = nullptr;
0264   h1_ele_mee_os_gb = nullptr;
0265   h1_ele_mee_os_bb = nullptr;
0266 
0267   h2_ele_E2mnE1vsMee_all = nullptr;
0268   h2_ele_E2mnE1vsMee_egeg_all = nullptr;
0269 
0270   h1_ele_charge = nullptr;
0271   h2_ele_chargeVsEta = nullptr;
0272   h2_ele_chargeVsPhi = nullptr;
0273   h2_ele_chargeVsPt = nullptr;
0274   h1_ele_vertexP = nullptr;
0275   h1_ele_vertexPt = nullptr;
0276   h1_ele_vertexPt_EB = nullptr;
0277   h1_ele_vertexPt_EE = nullptr;
0278   h1_ele_vertexPt_nocut = nullptr;
0279   h1_ele_Et = nullptr;
0280   h2_ele_vertexPtVsEta = nullptr;
0281   h2_ele_vertexPtVsPhi = nullptr;
0282   h1_ele_vertexPt_5100 = nullptr;
0283   h1_ele_vertexEta = nullptr;
0284   h2_ele_vertexEtaVsPhi = nullptr;
0285   h1_ele_vertexAbsEta = nullptr;
0286   h1_ele_vertexPhi = nullptr;
0287   h1_ele_vertexX = nullptr;
0288   h1_ele_vertexY = nullptr;
0289   h1_ele_vertexZ = nullptr;
0290   h1_ele_vertexTIP = nullptr;
0291   h2_ele_vertexTIPVsEta = nullptr;
0292   h2_ele_vertexTIPVsPhi = nullptr;
0293   h2_ele_vertexTIPVsPt = nullptr;
0294 
0295   h1_scl_En = nullptr;
0296   h1_scl_EoEtrue_barrel = nullptr;
0297   h1_scl_EoEtrue_endcaps = nullptr;
0298   h1_scl_EoEtrue_barrel_etagap = nullptr;
0299   h1_scl_EoEtrue_barrel_phigap = nullptr;
0300   h1_scl_EoEtrue_ebeegap = nullptr;
0301   h1_scl_EoEtrue_endcaps_deegap = nullptr;
0302   h1_scl_EoEtrue_endcaps_ringgap = nullptr;
0303   h1_scl_EoEtrue_barrel_new = nullptr;
0304   h1_scl_EoEtrue_endcaps_new = nullptr;
0305   h1_scl_EoEtrue_endcaps_new_Extended = nullptr;
0306   h1_scl_EoEtrue_barrel_new_etagap = nullptr;
0307   h1_scl_EoEtrue_barrel_new_phigap = nullptr;
0308   h1_scl_EoEtrue_ebeegap_new = nullptr;
0309   h1_scl_EoEtrue_endcaps_new_deegap = nullptr;
0310   h2_scl_EoEtrueVsrecOfflineVertices = nullptr;
0311   h2_scl_EoEtrueVsrecOfflineVertices_Extended = nullptr;
0312   h2_scl_EoEtrueVsrecOfflineVertices_barrel = nullptr;
0313   h2_scl_EoEtrueVsrecOfflineVertices_endcaps = nullptr;
0314   h1_scl_EoEtrue_endcaps_new_ringgap = nullptr;
0315   h1_scl_Et = nullptr;
0316   h2_scl_EtVsEta = nullptr;
0317   h2_scl_EtVsPhi = nullptr;
0318   h2_scl_EtaVsPhi = nullptr;
0319   h1_scl_Eta = nullptr;
0320   h1_scl_Phi = nullptr;
0321   h1_scl_ESFrac_endcaps = nullptr;
0322 
0323   h2_scl_EoEtruePfVsEg = nullptr;
0324 
0325   h1_scl_SigEtaEta = nullptr;
0326   h1_scl_SigEtaEta_barrel = nullptr;
0327   h1_scl_SigEtaEta_endcaps = nullptr;
0328   h1_scl_SigIEtaIEta = nullptr;
0329   h1_scl_SigIEtaIEta_barrel = nullptr;
0330   h1_scl_SigIEtaIEta_endcaps = nullptr;
0331   h1_scl_SigIEtaIEta_mAOD = nullptr;
0332   h1_scl_SigIEtaIEta_mAOD_barrel = nullptr;
0333   h1_scl_SigIEtaIEta_mAOD_endcaps = nullptr;
0334   h1_scl_full5x5_sigmaIetaIeta = nullptr;
0335   h1_scl_full5x5_sigmaIetaIeta_Extended = nullptr;
0336   h1_scl_full5x5_sigmaIetaIeta_barrel = nullptr;
0337   h1_scl_full5x5_sigmaIetaIeta_endcaps = nullptr;
0338   h1_scl_E1x5 = nullptr;
0339   h1_scl_E1x5_barrel = nullptr;
0340   h1_scl_E1x5_endcaps = nullptr;
0341   h1_scl_E2x5max = nullptr;
0342   h1_scl_E2x5max_barrel = nullptr;
0343   h1_scl_E2x5max_endcaps = nullptr;
0344   h1_scl_E5x5 = nullptr;
0345   h1_scl_E5x5_barrel = nullptr;
0346   h1_scl_E5x5_endcaps = nullptr;
0347   h1_scl_bcl_EtotoEtrue = nullptr;
0348   h1_scl_bcl_EtotoEtrue_Extended = nullptr;
0349   h1_scl_bcl_EtotoEtrue_barrel = nullptr;
0350   h1_scl_bcl_EtotoEtrue_endcaps = nullptr;
0351 
0352   h1_ele_ambiguousTracks = nullptr;
0353   h2_ele_ambiguousTracksVsEta = nullptr;
0354   h2_ele_ambiguousTracksVsPhi = nullptr;
0355   h2_ele_ambiguousTracksVsPt = nullptr;
0356   h1_ele_foundHits = nullptr;
0357   h1_ele_foundHits_barrel = nullptr;
0358   h1_ele_foundHits_endcaps = nullptr;
0359   h2_ele_foundHitsVsEta_Extended = nullptr;
0360   h2_ele_foundHitsVsEta_mAOD = nullptr;
0361   h2_ele_foundHitsVsPhi = nullptr;
0362   h2_ele_foundHitsVsPt = nullptr;
0363   h1_ele_lostHits = nullptr;
0364   h1_ele_lostHits_barrel = nullptr;
0365   h1_ele_lostHits_endcaps = nullptr;
0366   h2_ele_lostHitsVsEta = nullptr;
0367   h2_ele_lostHitsVsPhi = nullptr;
0368   h2_ele_lostHitsVsPt = nullptr;
0369   h1_ele_chi2 = nullptr;
0370   h1_ele_chi2_barrel = nullptr;
0371   h1_ele_chi2_endcaps = nullptr;
0372   h2_ele_chi2VsEta = nullptr;
0373   h2_ele_chi2VsPhi = nullptr;
0374   h2_ele_chi2VsPt = nullptr;
0375 
0376   h1_ele_PoPtrue = nullptr;
0377   h1_ele_PoPtrue_barrel = nullptr;
0378   h1_ele_PoPtrue_endcaps = nullptr;
0379 
0380   h2_ele_PoPtrueVsEta_Extended = nullptr;
0381   h2_ele_PoPtrueVsPhi = nullptr;
0382   h2_ele_PoPtrueVsPt = nullptr;
0383   h2_ele_sigmaIetaIetaVsPt = nullptr;
0384 
0385   h1_ele_PoPtrue_golden_barrel = nullptr;
0386   h1_ele_PoPtrue_golden_endcaps = nullptr;
0387   h1_ele_PoPtrue_showering_barrel = nullptr;
0388   h1_ele_PoPtrue_showering_endcaps = nullptr;
0389   h1_ele_PtoPttrue = nullptr;
0390   h1_ele_PtoPttrue_barrel = nullptr;
0391   h1_ele_PtoPttrue_endcaps = nullptr;
0392   h1_ele_ChargeMnChargeTrue = nullptr;
0393   h1_ele_EtaMnEtaTrue = nullptr;
0394   h1_ele_EtaMnEtaTrue_barrel = nullptr;
0395   h1_ele_EtaMnEtaTrue_endcaps = nullptr;
0396   h2_ele_EtaMnEtaTrueVsEta = nullptr;
0397   h2_ele_EtaMnEtaTrueVsPhi = nullptr;
0398   h2_ele_EtaMnEtaTrueVsPt = nullptr;
0399   h1_ele_PhiMnPhiTrue = nullptr;
0400   h1_ele_PhiMnPhiTrue_barrel = nullptr;
0401   h1_ele_PhiMnPhiTrue_endcaps = nullptr;
0402   h1_ele_PhiMnPhiTrue2 = nullptr;
0403   h2_ele_PhiMnPhiTrueVsEta = nullptr;
0404   h2_ele_PhiMnPhiTrueVsPhi = nullptr;
0405   h2_ele_PhiMnPhiTrueVsPt = nullptr;
0406   h1_ele_PinMnPout = nullptr;
0407   h1_ele_PinMnPout_mode = nullptr;
0408   h2_ele_PinMnPoutVsEta_mode = nullptr;
0409   h2_ele_PinMnPoutVsPhi_mode = nullptr;
0410   h2_ele_PinMnPoutVsPt_mode = nullptr;
0411   h2_ele_PinMnPoutVsE_mode = nullptr;
0412   h2_ele_PinMnPoutVsChi2_mode = nullptr;
0413 
0414   h1_ele_outerP = nullptr;
0415   h1_ele_outerP_mode = nullptr;
0416   h2_ele_outerPVsEta_mode = nullptr;
0417   h1_ele_outerPt = nullptr;
0418   h1_ele_outerPt_mode = nullptr;
0419   h2_ele_outerPtVsEta_mode = nullptr;
0420   h2_ele_outerPtVsPhi_mode = nullptr;
0421   h2_ele_outerPtVsPt_mode = nullptr;
0422   h1_ele_EoP = nullptr;
0423   h1_ele_EoP_barrel = nullptr;
0424   h1_ele_EoP_endcaps = nullptr;
0425   h2_ele_EoPVsEta_Extended = nullptr;
0426   h2_ele_EoPVsPhi = nullptr;
0427   h2_ele_EoPVsE = nullptr;
0428   h1_ele_EseedOP = nullptr;
0429   h1_ele_EseedOP_barrel = nullptr;
0430   h1_ele_EseedOP_endcaps = nullptr;
0431   h2_ele_EseedOPVsEta = nullptr;
0432   h2_ele_EseedOPVsPhi = nullptr;
0433   h2_ele_EseedOPVsE = nullptr;
0434   h1_ele_EoPout = nullptr;
0435   h1_ele_EoPout_barrel = nullptr;
0436   h1_ele_EoPout_endcaps = nullptr;
0437   h2_ele_EoPoutVsEta = nullptr;
0438   h2_ele_EoPoutVsPhi = nullptr;
0439   h2_ele_EoPoutVsE = nullptr;
0440   h1_ele_EeleOPout = nullptr;
0441   h1_ele_EeleOPout_barrel = nullptr;
0442   h1_ele_EeleOPout_endcaps = nullptr;
0443   h2_ele_EeleOPoutVsEta = nullptr;
0444   h2_ele_EeleOPoutVsPhi = nullptr;
0445   h2_ele_EeleOPoutVsE = nullptr;
0446 
0447   h1_ele_dEtaSc_propVtx = nullptr;
0448   h1_ele_dEtaSc_propVtx_Extended = nullptr;
0449   h1_ele_dEtaSc_propVtx_barrel = nullptr;
0450   h1_ele_dEtaSc_propVtx_endcaps = nullptr;
0451   h1_ele_dEtaSc_propVtx_mAOD = nullptr;
0452   h1_ele_dEtaSc_propVtx_mAOD_barrel = nullptr;
0453   h1_ele_dEtaSc_propVtx_mAOD_endcaps = nullptr;
0454   h2_ele_dEtaScVsEta_propVtx = nullptr;
0455   h2_ele_dEtaScVsPhi_propVtx = nullptr;
0456   h2_ele_dEtaScVsPt_propVtx = nullptr;
0457   h1_ele_dPhiSc_propVtx = nullptr;
0458   h1_ele_dPhiSc_propVtx_Extended = nullptr;
0459   h1_ele_dPhiSc_propVtx_barrel = nullptr;
0460   h1_ele_dPhiSc_propVtx_endcaps = nullptr;
0461   h2_ele_dPhiScVsEta_propVtx = nullptr;
0462   h2_ele_dPhiScVsPhi_propVtx = nullptr;
0463   h2_ele_dPhiScVsPt_propVtx = nullptr;
0464   h1_ele_dEtaCl_propOut = nullptr;
0465   h1_ele_dEtaCl_propOut_barrel = nullptr;
0466   h1_ele_dEtaCl_propOut_endcaps = nullptr;
0467   h2_ele_dEtaClVsEta_propOut = nullptr;
0468   h2_ele_dEtaClVsPhi_propOut = nullptr;
0469   h2_ele_dEtaClVsPt_propOut = nullptr;
0470   h1_ele_dPhiCl_propOut = nullptr;
0471   h1_ele_dPhiCl_propOut_barrel = nullptr;
0472   h1_ele_dPhiCl_propOut_endcaps = nullptr;
0473   h1_ele_dPhiCl_propOut_mAOD = nullptr;
0474   h1_ele_dPhiCl_propOut_mAOD_barrel = nullptr;
0475   h1_ele_dPhiCl_propOut_mAOD_endcaps = nullptr;
0476   h2_ele_dPhiClVsEta_propOut = nullptr;
0477   h2_ele_dPhiClVsPhi_propOut = nullptr;
0478   h2_ele_dPhiClVsPt_propOut = nullptr;
0479   h1_ele_dEtaEleCl_propOut = nullptr;
0480   h1_ele_dEtaEleCl_propOut_barrel = nullptr;
0481   h1_ele_dEtaEleCl_propOut_endcaps = nullptr;
0482   h2_ele_dEtaEleClVsEta_propOut = nullptr;
0483   h2_ele_dEtaEleClVsPhi_propOut = nullptr;
0484   h2_ele_dEtaEleClVsPt_propOut = nullptr;
0485   h1_ele_dPhiEleCl_propOut = nullptr;
0486   h1_ele_dPhiEleCl_propOut_barrel = nullptr;
0487   h1_ele_dPhiEleCl_propOut_endcaps = nullptr;
0488   h2_ele_dPhiEleClVsEta_propOut = nullptr;
0489   h2_ele_dPhiEleClVsPhi_propOut = nullptr;
0490   h2_ele_dPhiEleClVsPt_propOut = nullptr;
0491 
0492   h1_ele_seed_subdet2 = nullptr;
0493   h1_ele_seed_mask = nullptr;
0494   h1_ele_seed_mask_bpix = nullptr;
0495   h1_ele_seed_mask_fpix = nullptr;
0496   h1_ele_seed_mask_tec = nullptr;
0497   h1_ele_seed_dphi2 = nullptr;
0498   h2_ele_seed_dphi2VsEta = nullptr;
0499   h2_ele_seed_dphi2VsPt = nullptr;
0500   h1_ele_seed_dphi2pos = nullptr;
0501   h2_ele_seed_dphi2posVsEta = nullptr;
0502   h2_ele_seed_dphi2posVsPt = nullptr;
0503   h1_ele_seed_drz2 = nullptr;
0504   h2_ele_seed_drz2VsEta = nullptr;
0505   h2_ele_seed_drz2VsPt = nullptr;
0506   h1_ele_seed_drz2pos = nullptr;
0507   h2_ele_seed_drz2posVsEta = nullptr;
0508   h2_ele_seed_drz2posVsPt = nullptr;
0509 
0510   h1_ele_classes = nullptr;
0511   h1_ele_eta = nullptr;
0512   h1_ele_eta_golden = nullptr;
0513   h1_ele_eta_bbrem = nullptr;
0514   h1_ele_eta_shower = nullptr;
0515 
0516   h1_ele_HoE = nullptr;
0517   h1_ele_HoE_Extended = nullptr;
0518   h1_ele_HoE_barrel = nullptr;
0519   h1_ele_HoE_endcaps = nullptr;
0520   h1_ele_HoE_fiducial = nullptr;
0521   h2_ele_HoEVsEta = nullptr;
0522   h2_ele_HoEVsPhi = nullptr;
0523   h2_ele_HoEVsE = nullptr;
0524   h1_ele_HoE_mAOD = nullptr;
0525   h1_ele_HoE_mAOD_barrel = nullptr;
0526   h1_ele_HoE_mAOD_endcaps = nullptr;
0527 
0528   h1_ele_fbrem = nullptr;
0529   h1_ele_fbrem_Extended = nullptr;
0530   h1_ele_fbrem_barrel = nullptr;
0531   h1_ele_fbrem_endcaps = nullptr;
0532   p1_ele_fbremVsEta_mode = nullptr;
0533   p1_ele_fbremVsEta_mean = nullptr;
0534   h1_ele_fbrem_mAOD = nullptr;
0535   h1_ele_fbrem_mAOD_barrel = nullptr;
0536   h1_ele_fbrem_mAOD_endcaps = nullptr;
0537   h1_ele_superclusterfbrem = nullptr;
0538 
0539   h1_ele_superclusterfbrem_barrel = nullptr;
0540   h1_ele_superclusterfbrem_endcaps = nullptr;
0541   h2_ele_PinVsPoutGolden_mode = nullptr;
0542   h2_ele_PinVsPoutShowering_mode = nullptr;
0543   h2_ele_PinVsPoutGolden_mean = nullptr;
0544   h2_ele_PinVsPoutShowering_mean = nullptr;
0545   h2_ele_PtinVsPtoutGolden_mode = nullptr;
0546   h2_ele_PtinVsPtoutShowering_mode = nullptr;
0547   h2_ele_PtinVsPtoutGolden_mean = nullptr;
0548   h2_ele_PtinVsPtoutShowering_mean = nullptr;
0549   h1_scl_EoEtrueGolden_barrel = nullptr;
0550   h1_scl_EoEtrueGolden_endcaps = nullptr;
0551   h1_scl_EoEtrueShowering_barrel = nullptr;
0552   h1_scl_EoEtrueShowering_endcaps = nullptr;
0553 
0554   h1_ele_mva = nullptr;
0555   h1_ele_mva_isolated = nullptr;
0556   h1_ele_provenance = nullptr;
0557   h1_ele_provenance_Extended = nullptr;
0558 
0559   // isolation
0560   h1_ele_tkSumPt_dr03 = nullptr;
0561   h1_ele_tkSumPt_dr03_barrel = nullptr;
0562   h1_ele_tkSumPt_dr03_endcaps = nullptr;
0563   h1_ele_ecalRecHitSumEt_dr03 = nullptr;
0564   h1_ele_ecalRecHitSumEt_dr03_barrel = nullptr;
0565   h1_ele_ecalRecHitSumEt_dr03_endcaps = nullptr;
0566   h1_ele_hcalTowerSumEt_dr03_depth1 = nullptr;
0567   h1_ele_hcalTowerSumEt_dr03_depth1_barrel = nullptr;
0568   h1_ele_hcalTowerSumEt_dr03_depth1_endcaps = nullptr;
0569   h1_ele_hcalTowerSumEt_dr03_depth2 = nullptr;
0570 
0571   h1_ele_ecalPFClusterIso = nullptr;
0572   h1_ele_hcalPFClusterIso = nullptr;
0573   h1_ele_ecalPFClusterIso_Extended = nullptr;
0574   h1_ele_hcalPFClusterIso_Extended = nullptr;
0575   h1_ele_ecalPFClusterIso_barrel = nullptr;
0576   h1_ele_hcalPFClusterIso_barrel = nullptr;
0577   h1_ele_ecalPFClusterIso_endcaps = nullptr;
0578   h1_ele_hcalPFClusterIso_endcaps = nullptr;
0579 
0580   // conversions
0581   h1_ele_convFlags = nullptr;
0582   h1_ele_convFlags_all = nullptr;
0583   h1_ele_convDist = nullptr;
0584   h1_ele_convDist_all = nullptr;
0585   h1_ele_convDcot = nullptr;
0586   h1_ele_convDcot_all = nullptr;
0587   h1_ele_convRadius = nullptr;
0588   h1_ele_convRadius_all = nullptr;
0589 
0590   // PF
0591   h1_ele_chargedHadronRelativeIso = nullptr;
0592   h1_ele_chargedHadronRelativeIso_Extended = nullptr;
0593   h1_ele_chargedHadronRelativeIso_barrel = nullptr;
0594   h1_ele_chargedHadronRelativeIso_endcaps = nullptr;
0595   h1_ele_neutralHadronRelativeIso = nullptr;
0596   h1_ele_neutralHadronRelativeIso_Extended = nullptr;
0597   h1_ele_neutralHadronRelativeIso_barrel = nullptr;
0598   h1_ele_neutralHadronRelativeIso_endcaps = nullptr;
0599   h1_ele_photonRelativeIso = nullptr;
0600   h1_ele_photonRelativeIso_Extended = nullptr;
0601   h1_ele_photonRelativeIso_barrel = nullptr;
0602   h1_ele_photonRelativeIso_endcaps = nullptr;
0603   h1_ele_chargedHadronRelativeIso_mAOD = nullptr;
0604   h1_ele_chargedHadronRelativeIso_mAOD_barrel = nullptr;
0605   h1_ele_chargedHadronRelativeIso_mAOD_endcaps = nullptr;
0606   h1_ele_neutralHadronRelativeIso_mAOD = nullptr;
0607   h1_ele_neutralHadronRelativeIso_mAOD_barrel = nullptr;
0608   h1_ele_neutralHadronRelativeIso_mAOD_endcaps = nullptr;
0609   h1_ele_photonRelativeIso_mAOD = nullptr;
0610   h1_ele_photonRelativeIso_mAOD_barrel = nullptr;
0611   h1_ele_photonRelativeIso_mAOD_endcaps = nullptr;
0612 }
0613 
0614 void ElectronMcSignalValidator::bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &, edm::EventSetup const &) {
0615   iBooker.setCurrentFolder(outputInternalPath_);
0616 
0617   //  prepareStore() ;
0618   setBookIndex(-1);
0619   setBookPrefix("h");
0620   setBookEfficiencyFlag(set_EfficiencyFlag);
0621   setBookStatOverflowFlag(set_StatOverflowFlag);
0622 
0623   // mc truth collections sizes
0624   h1_mcNum = bookH1withSumw2(iBooker, "mcNum", "# mc particles", fhits_nbin, 0., fhits_max, "N_{gen}");
0625   h1_eleNum = bookH1withSumw2(iBooker, "mcNum_ele", "# mc electrons", fhits_nbin, 0., fhits_max, "N_{gen ele}");
0626   h1_gamNum = bookH1withSumw2(iBooker, "mcNum_gam", "# mc gammas", fhits_nbin, 0., fhits_max, "N_{gen #gamma}");
0627 
0628   // rec event collections sizes
0629   h1_recEleNum = bookH1(iBooker, "recEleNum", "# rec electrons", ele_nbin, ele_min, ele_max, "N_{ele}");
0630   h1_recCoreNum = bookH1(iBooker, "recCoreNum", "# rec electron cores", core_nbin, core_min, core_max, "N_{core}");
0631   h1_recTrackNum = bookH1(iBooker, "recTrackNum", "# rec gsf tracks", track_nbin, track_min, track_max, "N_{track}");
0632   h1_recSeedNum = bookH1(iBooker, "recSeedNum", "# rec electron seeds", seed_nbin, seed_min, seed_max, "N_{seed}");
0633   h1_recOfflineVertices = bookH1(
0634       iBooker, "recOfflineVertices", "# rec Offline Primary Vertices", opv_nbin, opv_min, opv_max, "N_{Vertices}");
0635 
0636   h2_scl_EoEtrueVsrecOfflineVertices = bookH2(iBooker,
0637                                               "scl_EoEtrueVsrecOfflineVertices",
0638                                               "E/Etrue vs number of primary vertices",
0639                                               opv_nbin,  // 10,
0640                                               opv_min,   // 0.,
0641                                               opv_max,   // 50.,
0642                                               50,
0643                                               0.,
0644                                               2.5,
0645                                               "N_{primary vertices}",
0646                                               "E/E_{true}");
0647   h2_scl_EoEtrueVsrecOfflineVertices_Extended = bookH2(iBooker,
0648                                                        "scl_EoEtrueVsrecOfflineVertices_Extended",
0649                                                        "E/Etrue vs number of primary vertices, 2.5<|eta|<3",
0650                                                        opv_nbin,  // 10,
0651                                                        opv_min,   // 0.,
0652                                                        opv_max,   // 50.,
0653                                                        50,
0654                                                        0.,
0655                                                        2.5,
0656                                                        "N_{primary vertices}",
0657                                                        "E/E_{true}");
0658   h2_scl_EoEtrueVsrecOfflineVertices_barrel = bookH2(iBooker,
0659                                                      "scl_EoEtrueVsrecOfflineVertices_barrel",
0660                                                      "E/Etrue vs number of primary , barrel",
0661                                                      opv_nbin,  // 10,
0662                                                      opv_min,   // 0.,
0663                                                      opv_max,   // 50.,
0664                                                      50,
0665                                                      0.,
0666                                                      2.5,
0667                                                      "N_{primary vertices}",
0668                                                      "E/E_{true}");
0669   h2_scl_EoEtrueVsrecOfflineVertices_endcaps = bookH2(iBooker,
0670                                                       "scl_EoEtrueVsrecOfflineVertices_endcaps",
0671                                                       "E/Etrue vs number of primary , endcaps",
0672                                                       opv_nbin,  // 10,
0673                                                       opv_min,   // 0.,
0674                                                       opv_max,   // 50.,
0675                                                       50,
0676                                                       0.,
0677                                                       2.5,
0678                                                       "N_{primary vertices}",
0679                                                       "E/E_{true}");
0680 
0681   // mc
0682   setBookPrefix("h_mc");
0683   h1_mc_Eta = bookH1withSumw2(iBooker, "Eta", "gen #eta", eta_nbin, eta_min, eta_max, "#eta");
0684   h1_mc_Eta_Extended = bookH1withSumw2(
0685       iBooker, "Eta_Extended", "gen #eta", eta_nbin_extended, eta_min_extended, eta_max_extended, "#eta");
0686   h1_mc_AbsEta = bookH1withSumw2(iBooker, "AbsEta", "gen |#eta|", eta_nbin / 2, 0., eta_max);
0687   h1_mc_AbsEta_Extended =
0688       bookH1withSumw2(iBooker, "AbsEta_Extended", "gen |#eta|", eta_nbin_extended / 2, 0., eta_max_extended);
0689   h1_mc_P = bookH1withSumw2(iBooker, "P", "gen p", p_nbin, 0., p_max, "p (GeV/c)");
0690   h1_mc_Pt = bookH1withSumw2(iBooker, "Pt", "gen pt", pteff_nbin, 5., pt_max);
0691   h1_mc_Phi = bookH1withSumw2(iBooker, "Phi", "gen phi", phi_nbin, phi_min, phi_max);
0692   h1_mc_Z = bookH1withSumw2(iBooker, "Z", "gen z ", xyz_nbin, -25, 25);
0693   h2_mc_PtEta =
0694       bookH2withSumw2(iBooker, "PtEta", "gen pt vs #eta", eta2D_nbin, eta_min, eta_max, pt2D_nbin, 5., pt_max);
0695 
0696   // all electrons
0697   setBookPrefix("h_ele");
0698   h1_ele_EoverP_all = bookH1withSumw2(iBooker,
0699                                       "EoverP_all",
0700                                       "ele E/P_{vertex}, all reco electrons",
0701                                       eop_nbin,
0702                                       0.,
0703                                       eop_max,
0704                                       "E/P_{vertex}",
0705                                       "Events",
0706                                       "ELE_LOGY E1 P");
0707   h1_ele_EoverP_all_barrel = bookH1withSumw2(iBooker,
0708                                              "EoverP_all_barrel",
0709                                              "ele E/P_{vertex}, all reco electrons, barrel",
0710                                              eop_nbin,
0711                                              0.,
0712                                              eop_max,
0713                                              "E/P_{vertex}",
0714                                              "Events",
0715                                              "ELE_LOGY E1 P");
0716   h1_ele_EoverP_all_endcaps = bookH1withSumw2(iBooker,
0717                                               "EoverP_all_endcaps",
0718                                               "ele E/P_{vertex}, all reco electrons, endcaps",
0719                                               eop_nbin,
0720                                               0.,
0721                                               eop_max,
0722                                               "E/P_{vertex}",
0723                                               "Events",
0724                                               "ELE_LOGY E1 P");
0725   h1_ele_EseedOP_all = bookH1withSumw2(iBooker,
0726                                        "EseedOP_all",
0727                                        "ele E_{seed}/P_{vertex}, all reco electrons",
0728                                        eop_nbin,
0729                                        0.,
0730                                        eop_max,
0731                                        "E_{seed}/P_{vertex}",
0732                                        "Events",
0733                                        "ELE_LOGY E1 P");
0734   h1_ele_EseedOP_all_barrel = bookH1withSumw2(iBooker,
0735                                               "EseedOP_all_barrel",
0736                                               "ele E_{seed}/P_{vertex}, all reco electrons, barrel",
0737                                               eop_nbin,
0738                                               0.,
0739                                               eop_max,
0740                                               "E_{seed}/P_{vertex}",
0741                                               "Events",
0742                                               "ELE_LOGY E1 P");
0743   h1_ele_EseedOP_all_endcaps = bookH1withSumw2(iBooker,
0744                                                "EseedOP_all_endcaps",
0745                                                "ele E_{seed}/P_{vertex}, all reco electrons, endcaps",
0746                                                eop_nbin,
0747                                                0.,
0748                                                eop_max,
0749                                                "E_{seed}/P_{vertex}",
0750                                                "Events",
0751                                                "ELE_LOGY E1 P");
0752   h1_ele_EoPout_all = bookH1withSumw2(iBooker,
0753                                       "EoPout_all",
0754                                       "ele E_{seed}/P_{out}, all reco electrons",
0755                                       eop_nbin,
0756                                       0.,
0757                                       eop_max,
0758                                       "E_{seed}/P_{out}",
0759                                       "Events",
0760                                       "ELE_LOGY E1 P");
0761   h1_ele_EeleOPout_all = bookH1withSumw2(iBooker,
0762                                          "EeleOPout_all",
0763                                          "ele E_{ele}/P_{out}, all reco electrons",
0764                                          eop_nbin,
0765                                          0.,
0766                                          eop_max,
0767                                          "E_{ele}/P_{out}",
0768                                          "Events",
0769                                          "ELE_LOGY E1 P");
0770   h1_ele_dEtaSc_propVtx_all = bookH1withSumw2(iBooker,
0771                                               "dEtaSc_propVtx_all",
0772                                               "ele #eta_{sc} - #eta_{tr}, prop from vertex, all reco electrons",
0773                                               detamatch_nbin,
0774                                               detamatch_min,
0775                                               detamatch_max,
0776                                               "#eta_{sc} - #eta_{tr}",
0777                                               "Events",
0778                                               "ELE_LOGY E1 P");
0779   h1_ele_dEtaSc_propVtx_all_barrel =
0780       bookH1withSumw2(iBooker,
0781                       "dEtaSc_propVtx_all_barrel",
0782                       "ele #eta_{sc} - #eta_{tr}, prop from vertex, all reco electrons barrel",
0783                       detamatch_nbin,
0784                       detamatch_min,
0785                       detamatch_max,
0786                       "#eta_{sc} - #eta_{tr}",
0787                       "Events",
0788                       "ELE_LOGY E1 P");
0789   h1_ele_dEtaSc_propVtx_all_endcaps =
0790       bookH1withSumw2(iBooker,
0791                       "dEtaSc_propVtx_all_endcaps",
0792                       "ele #eta_{sc} - #eta_{tr}, prop from vertex, all reco electrons endcaps",
0793                       detamatch_nbin,
0794                       detamatch_min,
0795                       detamatch_max,
0796                       "#eta_{sc} - #eta_{tr}",
0797                       "Events",
0798                       "ELE_LOGY E1 P");
0799   h1_ele_dPhiSc_propVtx_all = bookH1withSumw2(iBooker,
0800                                               "dPhiSc_propVtx_all",
0801                                               "ele #phi_{sc} - #phi_{tr}, prop from vertex, all reco electrons",
0802                                               dphimatch_nbin,
0803                                               dphimatch_min,
0804                                               dphimatch_max,
0805                                               "#phi_{sc} - #phi_{tr} (rad)",
0806                                               "Events",
0807                                               "ELE_LOGY E1 P");
0808   h1_ele_dPhiSc_propVtx_all_barrel =
0809       bookH1withSumw2(iBooker,
0810                       "dPhiSc_propVtx_all_barrel",
0811                       "ele #phi_{sc} - #phi_{tr}, prop from vertex, all reco electrons barrel",
0812                       dphimatch_nbin,
0813                       dphimatch_min,
0814                       dphimatch_max,
0815                       "#phi_{sc} - #phi_{tr} (rad)",
0816                       "Events",
0817                       "ELE_LOGY E1 P");
0818   h1_ele_dPhiSc_propVtx_all_endcaps =
0819       bookH1withSumw2(iBooker,
0820                       "dPhiSc_propVtx_all_endcaps",
0821                       "ele #phi_{sc} - #phi_{tr}, prop from vertex, all reco electrons endcaps",
0822                       dphimatch_nbin,
0823                       dphimatch_min,
0824                       dphimatch_max,
0825                       "#phi_{sc} - #phi_{tr} (rad)",
0826                       "Events",
0827                       "ELE_LOGY E1 P");
0828   h1_ele_dEtaCl_propOut_all = bookH1withSumw2(iBooker,
0829                                               "dEtaCl_propOut_all",
0830                                               "ele #eta_{cl} - #eta_{tr}, prop from outermost, all reco electrons",
0831                                               detamatch_nbin,
0832                                               detamatch_min,
0833                                               detamatch_max,
0834                                               "#eta_{sc} - #eta_{tr}",
0835                                               "Events",
0836                                               "ELE_LOGY E1 P");
0837   h1_ele_dEtaCl_propOut_all_barrel =
0838       bookH1withSumw2(iBooker,
0839                       "dEtaCl_propOut_all_barrel",
0840                       "ele #eta_{cl} - #eta_{tr}, prop from outermost, all reco electrons barrel",
0841                       detamatch_nbin,
0842                       detamatch_min,
0843                       detamatch_max,
0844                       "#eta_{sc} - #eta_{tr}",
0845                       "Events",
0846                       "ELE_LOGY E1 P");
0847   h1_ele_dEtaCl_propOut_all_endcaps =
0848       bookH1withSumw2(iBooker,
0849                       "dEtaCl_propOut_all_endcaps",
0850                       "ele #eta_{cl} - #eta_{tr}, prop from outermost, all reco electrons endcaps",
0851                       detamatch_nbin,
0852                       detamatch_min,
0853                       detamatch_max,
0854                       "#eta_{sc} - #eta_{tr}",
0855                       "Events",
0856                       "ELE_LOGY E1 P");
0857   h1_ele_dPhiCl_propOut_all = bookH1withSumw2(iBooker,
0858                                               "dPhiCl_propOut_all",
0859                                               "ele #phi_{cl} - #phi_{tr}, prop from outermost, all reco electrons",
0860                                               dphimatch_nbin,
0861                                               dphimatch_min,
0862                                               dphimatch_max,
0863                                               "#phi_{sc} - #phi_{tr} (rad)",
0864                                               "Events",
0865                                               "ELE_LOGY E1 P");
0866   h1_ele_dPhiCl_propOut_all_barrel =
0867       bookH1withSumw2(iBooker,
0868                       "dPhiCl_propOut_all_barrel",
0869                       "ele #phi_{cl} - #phi_{tr}, prop from outermost, all reco electrons barrel",
0870                       dphimatch_nbin,
0871                       dphimatch_min,
0872                       dphimatch_max,
0873                       "#phi_{sc} - #phi_{tr} (rad)",
0874                       "Events",
0875                       "ELE_LOGY E1 P");
0876   h1_ele_dPhiCl_propOut_all_endcaps =
0877       bookH1withSumw2(iBooker,
0878                       "dPhiCl_propOut_all_endcaps",
0879                       "ele #phi_{cl} - #phi_{tr}, prop from outermost, all reco electrons endcaps",
0880                       dphimatch_nbin,
0881                       dphimatch_min,
0882                       dphimatch_max,
0883                       "#phi_{sc} - #phi_{tr} (rad)",
0884                       "Events",
0885                       "ELE_LOGY E1 P");
0886   h1_ele_HoE_all = bookH1withSumw2(iBooker,
0887                                    "HoE_all",
0888                                    "ele hadronic energy / em energy, all reco electrons",
0889                                    hoe_nbin,
0890                                    hoe_min,
0891                                    hoe_max,
0892                                    "H/E",
0893                                    "Events",
0894                                    "ELE_LOGY E1 P");
0895   h1_ele_HoE_all_barrel = bookH1withSumw2(iBooker,
0896                                           "HoE_all_barrel",
0897                                           "ele hadronic energy / em energy, all reco electrons barrel",
0898                                           hoe_nbin,
0899                                           hoe_min,
0900                                           hoe_max,
0901                                           "H/E",
0902                                           "Events",
0903                                           "ELE_LOGY E1 P");
0904   h1_ele_HoE_all_endcaps = bookH1withSumw2(iBooker,
0905                                            "HoE_all_endcaps",
0906                                            "ele hadronic energy / em energy, all reco electrons endcaps",
0907                                            hoe_nbin,
0908                                            hoe_min,
0909                                            hoe_max,
0910                                            "H/E",
0911                                            "Events",
0912                                            "ELE_LOGY E1 P");
0913   h1_ele_HoE_bc_all = bookH1withSumw2(iBooker,
0914                                       "HoE_bc_all",
0915                                       "ele hadronic energy / em energy, all reco electrons, behind cluster",
0916                                       hoe_nbin,
0917                                       hoe_min,
0918                                       hoe_max,
0919                                       "H/E",
0920                                       "Events",
0921                                       "ELE_LOGY E1 P");
0922   h1_ele_vertexPt_all =
0923       bookH1withSumw2(iBooker, "vertexPt_all", "ele p_{T}, all reco electrons", pteff_nbin, 5., pt_max, "", "Events");
0924   h1_ele_Et_all = bookH1withSumw2(iBooker,
0925                                   "Et_all",
0926                                   "ele ecal E_{T}, all reco electrons",
0927                                   pteff_nbin,
0928                                   5.,
0929                                   pt_max,
0930                                   "E_{T} (GeV)",
0931                                   "Events",
0932                                   "ELE_LOGY E1 P");
0933   h1_ele_vertexEta_all = bookH1withSumw2(
0934       iBooker, "vertexEta_all", "ele eta, all reco electrons", eta_nbin, eta_min, eta_max, "", "Events");
0935   h1_ele_TIP_all = bookH1withSumw2(iBooker,
0936                                    "TIP_all",
0937                                    "ele vertex transverse radius, all reco electrons",
0938                                    100,
0939                                    0.,
0940                                    0.2,
0941                                    "r_{T} (cm)",
0942                                    "Events",
0943                                    "ELE_LOGY E1 P");
0944   h1_ele_TIP_all_barrel = bookH1withSumw2(iBooker,
0945                                           "TIP_all_barrel",
0946                                           "ele vertex transverse radius, all reco electrons barrel",
0947                                           100,
0948                                           0.,
0949                                           0.2,
0950                                           "r_{T} (cm)",
0951                                           "Events",
0952                                           "ELE_LOGY E1 P");
0953   h1_ele_TIP_all_endcaps = bookH1withSumw2(iBooker,
0954                                            "TIP_all_endcaps",
0955                                            "ele vertex transverse radius, all reco electrons endcaps",
0956                                            100,
0957                                            0.,
0958                                            0.2,
0959                                            "r_{T} (cm)",
0960                                            "Events",
0961                                            "ELE_LOGY E1 P");
0962   h1_ele_mee_all = bookH1withSumw2(iBooker,
0963                                    "mee_all",
0964                                    "ele pairs invariant mass, all reco electrons",
0965                                    mee_nbin,
0966                                    mee_min,
0967                                    mee_max,
0968                                    "m_{ee} (GeV/c^{2})",
0969                                    "Events",
0970                                    "ELE_LOGY E1 P");
0971   h1_ele_mee_os = bookH1withSumw2(iBooker,
0972                                   "mee_os",
0973                                   "ele pairs invariant mass, opp. sign",
0974                                   mee_nbin,
0975                                   mee_min,
0976                                   mee_max,
0977                                   "m_{e^{+}e^{-}} (GeV/c^{2})",
0978                                   "Events",
0979                                   "ELE_LOGY E1 P");
0980   h1_ele_mee_os_ebeb = bookH1withSumw2(iBooker,
0981                                        "mee_os_ebeb",
0982                                        "ele pairs invariant mass, opp. sign, EB-EB",
0983                                        mee_nbin,
0984                                        mee_min,
0985                                        mee_max,
0986                                        "m_{e^{+}e^{-}} (GeV/c^{2})",
0987                                        "Events",
0988                                        "ELE_LOGY E1 P");
0989   h1_ele_mee_os_ebee = bookH1withSumw2(iBooker,
0990                                        "mee_os_ebee",
0991                                        "ele pairs invariant mass, opp. sign, EB-EE",
0992                                        mee_nbin,
0993                                        mee_min,
0994                                        mee_max,
0995                                        "m_{e^{+}e^{-}} (GeV/c^{2})",
0996                                        "Events",
0997                                        "ELE_LOGY E1 P");
0998   h1_ele_mee_os_eeee = bookH1withSumw2(iBooker,
0999                                        "mee_os_eeee",
1000                                        "ele pairs invariant mass, opp. sign, EE-EE",
1001                                        mee_nbin,
1002                                        mee_min,
1003                                        mee_max,
1004                                        "m_{e^{+}e^{-}} (GeV/c^{2})",
1005                                        "Events",
1006                                        "ELE_LOGY E1 P");
1007   h1_ele_mee_os_gg = bookH1withSumw2(iBooker,
1008                                      "mee_os_gg",
1009                                      "ele pairs invariant mass, opp. sign, good-good",
1010                                      mee_nbin,
1011                                      mee_min,
1012                                      mee_max,
1013                                      "m_{e^{+}e^{-}} (GeV/c^{2})",
1014                                      "Events",
1015                                      "ELE_LOGY E1 P");
1016   h1_ele_mee_os_gb = bookH1withSumw2(iBooker,
1017                                      "mee_os_gb",
1018                                      "ele pairs invariant mass, opp. sign, good-bad",
1019                                      mee_nbin,
1020                                      mee_min,
1021                                      mee_max,
1022                                      "m_{e^{+}e^{-}} (GeV/c^{2})",
1023                                      "Events",
1024                                      "ELE_LOGY E1 P");
1025   h1_ele_mee_os_bb = bookH1withSumw2(iBooker,
1026                                      "mee_os_bb",
1027                                      "ele pairs invariant mass, opp. sign, bad-bad",
1028                                      mee_nbin,
1029                                      mee_min,
1030                                      mee_max,
1031                                      "m_{e^{+}e^{-}} (GeV/c^{2})",
1032                                      "Events",
1033                                      "ELE_LOGY E1 P");
1034 
1035   // duplicates
1036   h2_ele_E2mnE1vsMee_all = bookH2(iBooker,
1037                                   "E2mnE1vsMee_all",
1038                                   "E2 - E1 vs ele pairs invariant mass, all electrons",
1039                                   mee_nbin,
1040                                   mee_min,
1041                                   mee_max,
1042                                   100,
1043                                   -50.,
1044                                   50.,
1045                                   "m_{e^{+}e^{-}} (GeV/c^{2})",
1046                                   "E2 - E1 (GeV)");
1047   h2_ele_E2mnE1vsMee_egeg_all = bookH2(iBooker,
1048                                        "E2mnE1vsMee_egeg_all",
1049                                        "E2 - E1 vs ele pairs invariant mass, ecal driven pairs, all electrons",
1050                                        mee_nbin,
1051                                        mee_min,
1052                                        mee_max,
1053                                        100,
1054                                        -50.,
1055                                        50.,
1056                                        "m_{e^{+}e^{-}} (GeV/c^{2})",
1057                                        "E2 - E1 (GeV)");
1058 
1059   // charge ID
1060   h1_ele_ChargeMnChargeTrue =
1061       bookH1withSumw2(iBooker, "ChargeMnChargeTrue", "ele charge - gen charge ", 5, -1., 4., "q_{rec} - q_{gen}");
1062   setBookPrefix("h_mc");
1063   h1_mc_Eta_matched_qmisid =
1064       bookH1withSumw2(iBooker, "Eta_matched_qmisid", "charge misid vs gen eta", eta_nbin, eta_min, eta_max);
1065   h1_mc_AbsEta_matched_qmisid =
1066       bookH1withSumw2(iBooker, "AbsEta_matched_qmisid", "charge misid vs gen |eta|", eta_nbin / 2, 0., eta_max);
1067   h1_mc_Pt_matched_qmisid =
1068       bookH1withSumw2(iBooker, "Pt_matched_qmisid", "charge misid vs gen transverse momentum", pteff_nbin, 5., pt_max);
1069   h1_mc_Phi_matched_qmisid =
1070       bookH1withSumw2(iBooker, "Phi_matched_qmisid", "charge misid vs gen phi", phi_nbin, phi_min, phi_max);
1071   h1_mc_Z_matched_qmisid = bookH1withSumw2(iBooker, "Z_matched_qmisid", "charge misid vs gen z", xyz_nbin, -25, 25);
1072 
1073   // matched electrons
1074   setBookPrefix("h_mc");
1075   h1_mc_Eta_Extended_matched = bookH1withSumw2(iBooker,
1076                                                "Eta_Extended_matched",
1077                                                "Eta of matched electrons",
1078                                                eta_nbin_extended,
1079                                                eta_min_extended,
1080                                                eta_max_extended);
1081   h1_mc_AbsEta_matched =
1082       bookH1withSumw2(iBooker, "AbsEta_matched", "Efficiency vs gen |eta|", eta_nbin / 2, 0., eta_max);
1083   h1_mc_AbsEta_Extended_matched = bookH1withSumw2(
1084       iBooker, "AbsEta_Extended_matched", "Efficiency vs gen |eta|", eta_nbin_extended / 2, 0., eta_max_extended);
1085   h1_mc_Pt_matched = bookH1(iBooker, "Pt_matched", "Efficiency vs gen transverse momentum", pteff_nbin, 5., pt_max);
1086   h1_mc_Phi_matched = bookH1withSumw2(iBooker, "Phi_matched", "Efficiency vs gen phi", phi_nbin, phi_min, phi_max);
1087   h1_mc_Z_matched = bookH1withSumw2(iBooker, "Z_matched", "Efficiency vs gen vertex z", xyz_nbin, -25, 25);
1088   h2_mc_PtEta_matched = bookH2withSumw2(
1089       iBooker, "PtEta_matched", "Efficiency vs pt #eta", eta2D_nbin, eta_min, eta_max, pt2D_nbin, 5., pt_max);
1090   setBookPrefix("h_ele");
1091   h1_ele_charge = bookH1withSumw2(iBooker, "charge", "ele charge", 5, -2.5, 2.5, "charge");
1092   h2_ele_chargeVsEta = bookH2(iBooker, "chargeVsEta", "ele charge vs eta", eta2D_nbin, eta_min, eta_max, 5, -2., 2.);
1093   h2_ele_chargeVsPhi = bookH2(iBooker, "chargeVsPhi", "ele charge vs phi", phi2D_nbin, phi_min, phi_max, 5, -2., 2.);
1094   h2_ele_chargeVsPt = bookH2(iBooker, "chargeVsPt", "ele charge vs pt", pt_nbin, 0., 100., 5, -2., 2.);
1095   h1_ele_vertexP = bookH1withSumw2(iBooker, "vertexP", "ele momentum", p_nbin, 0., p_max, "p_{vertex} (GeV/c)");
1096   h1_ele_vertexPt =
1097       bookH1withSumw2(iBooker, "vertexPt", "ele transverse momentum", pt_nbin, 0., pt_max, "p_{T vertex} (GeV/c)");
1098   h1_ele_vertexPt_EB = bookH1withSumw2(
1099       iBooker, "vertexPt_EB", "ele transverse momentum barrel", pt_nbin, 0., pt_max, "p_{T vertex} (GeV/c)");
1100   h1_ele_vertexPt_EE = bookH1withSumw2(
1101       iBooker, "vertexPt_EE", "ele transverse momentum endcaps", pt_nbin, 0., pt_max, "p_{T vertex} (GeV/c)");
1102   h1_ele_vertexPt_nocut = bookH1withSumw2(
1103       iBooker, "vertexPt_nocut", "pT of prunned electrons", pt_nbin, 0., pt_max, "p_{T vertex} (GeV/c)");
1104   h1_ele_Et = bookH1withSumw2(iBooker, "Et", "ele ecal E_{T}", pt_nbin, 0., pt_max, "E_{T} (GeV)");
1105   h2_ele_vertexPtVsEta = bookH2(
1106       iBooker, "vertexPtVsEta", "ele transverse momentum vs eta", eta2D_nbin, eta_min, eta_max, pt2D_nbin, 0., pt_max);
1107   h2_ele_vertexPtVsPhi = bookH2(
1108       iBooker, "vertexPtVsPhi", "ele transverse momentum vs phi", phi2D_nbin, phi_min, phi_max, pt2D_nbin, 0., pt_max);
1109   h1_ele_vertexEta = bookH1withSumw2(iBooker, "vertexEta", "ele momentum eta", eta_nbin, eta_min, eta_max, "#eta");
1110   h2_ele_vertexEtaVsPhi = bookH2(
1111       iBooker, "vertexEtaVsPhi", "ele momentum eta vs phi", eta2D_nbin, eta_min, eta_max, phi2D_nbin, phi_min, phi_max);
1112   h1_ele_vertexPhi =
1113       bookH1withSumw2(iBooker, "vertexPhi", "ele  momentum #phi", phi_nbin, phi_min, phi_max, "#phi (rad)");
1114   h1_ele_vertexX = bookH1withSumw2(iBooker, "vertexX", "ele vertex x", xyz_nbin, -0.6, 0.6, "x (cm)");
1115   h1_ele_vertexY = bookH1withSumw2(iBooker, "vertexY", "ele vertex y", xyz_nbin, -0.6, 0.6, "y (cm)");
1116   h1_ele_vertexZ = bookH1withSumw2(iBooker, "vertexZ", "ele vertex z", xyz_nbin, -25, 25, "z (cm)");
1117   h1_ele_vertexTIP =
1118       bookH1withSumw2(iBooker, "vertexTIP", "ele transverse impact parameter (wrt gen vtx)", 90, 0., 0.15, "TIP (cm)");
1119   h2_ele_vertexTIPVsEta = bookH2(iBooker,
1120                                  "vertexTIPVsEta",
1121                                  "ele transverse impact parameter (wrt gen vtx) vs eta",
1122                                  eta2D_nbin,
1123                                  eta_min,
1124                                  eta_max,
1125                                  45,
1126                                  0.,
1127                                  0.15,
1128                                  "#eta",
1129                                  "TIP (cm)");
1130   h2_ele_vertexTIPVsPhi = bookH2(iBooker,
1131                                  "vertexTIPVsPhi",
1132                                  "ele transverse impact parameter (wrt gen vtx) vs phi",
1133                                  phi2D_nbin,
1134                                  phi_min,
1135                                  phi_max,
1136                                  45,
1137                                  0.,
1138                                  0.15,
1139                                  "#phi (rad)",
1140                                  "TIP (cm)");
1141   h2_ele_vertexTIPVsPt = bookH2(iBooker,
1142                                 "vertexTIPVsPt",
1143                                 "ele transverse impact parameter (wrt gen vtx) vs transverse momentum",
1144                                 pt2D_nbin,
1145                                 0.,
1146                                 pt_max,
1147                                 45,
1148                                 0.,
1149                                 0.15,
1150                                 "p_{T} (GeV/c)",
1151                                 "TIP (cm)");
1152   h1_ele_PoPtrue = bookH1withSumw2(
1153       iBooker, "PoPtrue", "ele momentum / gen momentum", poptrue_nbin, poptrue_min, poptrue_max, "P/P_{gen}");
1154   h1_ele_PoPtrue_barrel = bookH1withSumw2(iBooker,
1155                                           "PoPtrue_barrel",
1156                                           "ele momentum / gen momentum, barrel",
1157                                           poptrue_nbin,
1158                                           poptrue_min,
1159                                           poptrue_max,
1160                                           "P/P_{gen}");
1161   h1_ele_PoPtrue_endcaps = bookH1withSumw2(iBooker,
1162                                            "PoPtrue_endcaps",
1163                                            "ele momentum / gen momentum, endcaps",
1164                                            poptrue_nbin,
1165                                            poptrue_min,
1166                                            poptrue_max,
1167                                            "P/P_{gen}");
1168   h2_ele_PoPtrueVsEta_Extended = bookH2withSumw2(iBooker,
1169                                                  "PoPtrueVsEta_Extended",
1170                                                  "ele momentum / gen momentum vs eta",
1171                                                  eta2D_nbin_extended,
1172                                                  eta_min_extended,
1173                                                  eta_max_extended,
1174                                                  50,
1175                                                  poptrue_min,
1176                                                  poptrue_max);
1177   h2_ele_PoPtrueVsPhi = bookH2(iBooker,
1178                                "PoPtrueVsPhi",
1179                                "ele momentum / gen momentum vs phi",
1180                                phi2D_nbin,
1181                                phi_min,
1182                                phi_max,
1183                                50,
1184                                poptrue_min,
1185                                poptrue_max);
1186   h2_ele_PoPtrueVsPt = bookH2(
1187       iBooker, "PoPtrueVsPt", "ele momentum / gen momentum vs eta", pt2D_nbin, 0., pt_max, 50, poptrue_min, poptrue_max);
1188   h2_ele_sigmaIetaIetaVsPt =
1189       bookH2(iBooker, "sigmaIetaIetaVsPt", "SigmaIetaIeta vs pt", 100, 0., pt_max, 100, 0., 0.05);
1190   h1_ele_PoPtrue_golden_barrel = bookH1withSumw2(iBooker,
1191                                                  "PoPtrue_golden_barrel",
1192                                                  "ele momentum / gen momentum, golden, barrel",
1193                                                  poptrue_nbin,
1194                                                  poptrue_min,
1195                                                  poptrue_max,
1196                                                  "P/P_{gen}");
1197   h1_ele_PoPtrue_golden_endcaps = bookH1withSumw2(iBooker,
1198                                                   "PoPtrue_golden_endcaps",
1199                                                   "ele momentum / gen momentum, golden, endcaps",
1200                                                   poptrue_nbin,
1201                                                   poptrue_min,
1202                                                   poptrue_max,
1203                                                   "P/P_{gen}");
1204   h1_ele_PoPtrue_showering_barrel = bookH1withSumw2(iBooker,
1205                                                     "PoPtrue_showering_barrel",
1206                                                     "ele momentum / gen momentum, showering, barrel",
1207                                                     poptrue_nbin,
1208                                                     poptrue_min,
1209                                                     poptrue_max,
1210                                                     "P/P_{gen}");
1211   h1_ele_PoPtrue_showering_endcaps = bookH1withSumw2(iBooker,
1212                                                      "PoPtrue_showering_endcaps",
1213                                                      "ele momentum / gen momentum, showering, endcaps",
1214                                                      poptrue_nbin,
1215                                                      poptrue_min,
1216                                                      poptrue_max,
1217                                                      "P/P_{gen}");
1218   h1_ele_PtoPttrue = bookH1withSumw2(iBooker,
1219                                      "PtoPttrue",
1220                                      "ele transverse momentum / gen transverse momentum",
1221                                      poptrue_nbin,
1222                                      poptrue_min,
1223                                      poptrue_max,
1224                                      "P_{T}/P_{T}^{gen}");
1225   h1_ele_PtoPttrue_barrel = bookH1withSumw2(iBooker,
1226                                             "PtoPttrue_barrel",
1227                                             "ele transverse momentum / gen transverse momentum, barrel",
1228                                             poptrue_nbin,
1229                                             poptrue_min,
1230                                             poptrue_max,
1231                                             "P_{T}/P_{T}^{gen}");
1232   h1_ele_PtoPttrue_endcaps = bookH1withSumw2(iBooker,
1233                                              "PtoPttrue_endcaps",
1234                                              "ele transverse momentum / gen transverse momentum, endcaps",
1235                                              poptrue_nbin,
1236                                              poptrue_min,
1237                                              poptrue_max,
1238                                              "P_{T}/P_{T}^{gen}");
1239   h1_ele_EtaMnEtaTrue = bookH1withSumw2(
1240       iBooker, "EtaMnEtaTrue", "ele momentum  eta - gen  eta", deta_nbin, deta_min, deta_max, "#eta_{rec} - #eta_{gen}");
1241   h1_ele_EtaMnEtaTrue_barrel = bookH1withSumw2(iBooker,
1242                                                "EtaMnEtaTrue_barrel",
1243                                                "ele momentum  eta - gen  eta barrel",
1244                                                deta_nbin,
1245                                                deta_min,
1246                                                deta_max,
1247                                                "#eta_{rec} - #eta_{gen}");
1248   h1_ele_EtaMnEtaTrue_endcaps = bookH1withSumw2(iBooker,
1249                                                 "EtaMnEtaTrue_endcaps",
1250                                                 "ele momentum  eta - gen  eta endcaps",
1251                                                 deta_nbin,
1252                                                 deta_min,
1253                                                 deta_max,
1254                                                 "#eta_{rec} - #eta_{gen}");
1255   h2_ele_EtaMnEtaTrueVsEta = bookH2(iBooker,
1256                                     "EtaMnEtaTrueVsEta",
1257                                     "ele momentum  eta - gen  eta vs eta",
1258                                     eta2D_nbin,
1259                                     eta_min,
1260                                     eta_max,
1261                                     deta_nbin / 2,
1262                                     deta_min,
1263                                     deta_max);
1264   h2_ele_EtaMnEtaTrueVsPhi = bookH2(iBooker,
1265                                     "EtaMnEtaTrueVsPhi",
1266                                     "ele momentum  eta - gen  eta vs phi",
1267                                     phi2D_nbin,
1268                                     phi_min,
1269                                     phi_max,
1270                                     deta_nbin / 2,
1271                                     deta_min,
1272                                     deta_max);
1273   h2_ele_EtaMnEtaTrueVsPt = bookH2(iBooker,
1274                                    "EtaMnEtaTrueVsPt",
1275                                    "ele momentum  eta - gen  eta vs pt",
1276                                    pt_nbin,
1277                                    0.,
1278                                    pt_max,
1279                                    deta_nbin / 2,
1280                                    deta_min,
1281                                    deta_max);
1282   h1_ele_PhiMnPhiTrue = bookH1withSumw2(iBooker,
1283                                         "PhiMnPhiTrue",
1284                                         "ele momentum  phi - gen  phi",
1285                                         dphi_nbin,
1286                                         dphi_min,
1287                                         dphi_max,
1288                                         "#phi_{rec} - #phi_{gen} (rad)");
1289   h1_ele_PhiMnPhiTrue_barrel = bookH1withSumw2(iBooker,
1290                                                "PhiMnPhiTrue_barrel",
1291                                                "ele momentum  phi - gen  phi barrel",
1292                                                dphi_nbin,
1293                                                dphi_min,
1294                                                dphi_max,
1295                                                "#phi_{rec} - #phi_{gen} (rad)");
1296   h1_ele_PhiMnPhiTrue_endcaps = bookH1withSumw2(iBooker,
1297                                                 "PhiMnPhiTrue_endcaps",
1298                                                 "ele momentum  phi - gen  phi endcaps",
1299                                                 dphi_nbin,
1300                                                 dphi_min,
1301                                                 dphi_max,
1302                                                 "#phi_{rec} - #phi_{gen} (rad)");
1303   h1_ele_PhiMnPhiTrue2 =
1304       bookH1(iBooker, "PhiMnPhiTrue2", "ele momentum  phi - gen  phi", dphimatch2D_nbin, dphimatch_min, dphimatch_max);
1305   h2_ele_PhiMnPhiTrueVsEta = bookH2(iBooker,
1306                                     "PhiMnPhiTrueVsEta",
1307                                     "ele momentum  phi - gen  phi vs eta",
1308                                     eta2D_nbin,
1309                                     eta_min,
1310                                     eta_max,
1311                                     dphi_nbin / 2,
1312                                     dphi_min,
1313                                     dphi_max);
1314   h2_ele_PhiMnPhiTrueVsPhi = bookH2(iBooker,
1315                                     "PhiMnPhiTrueVsPhi",
1316                                     "ele momentum  phi - gen  phi vs phi",
1317                                     phi2D_nbin,
1318                                     phi_min,
1319                                     phi_max,
1320                                     dphi_nbin / 2,
1321                                     dphi_min,
1322                                     dphi_max);
1323   h2_ele_PhiMnPhiTrueVsPt = bookH2(iBooker,
1324                                    "PhiMnPhiTrueVsPt",
1325                                    "ele momentum  phi - gen  phi vs pt",
1326                                    pt2D_nbin,
1327                                    0.,
1328                                    pt_max,
1329                                    dphi_nbin / 2,
1330                                    dphi_min,
1331                                    dphi_max);
1332   h1_ele_ecalEnergyError = bookH1withSumw2(
1333       iBooker, "ecalEnergyError", "Regression estimate of the ECAL energy error", error_nbin, 0, enerror_max);
1334   h1_ele_ecalEnergyError_barrel = bookH1withSumw2(
1335       iBooker, "ecalEnergyError_barrel", "Regression estimate of the ECAL energy error - barrel", 30, 0, 30);
1336   h1_ele_ecalEnergyError_endcaps = bookH1withSumw2(iBooker,
1337                                                    "ecalEnergyError_endcaps",
1338                                                    "Regression estimate of the ECAL energy error - endcaps",
1339                                                    error_nbin,
1340                                                    0,
1341                                                    enerror_max);
1342   h1_ele_combinedP4Error = bookH1withSumw2(
1343       iBooker, "combinedP4Error", "Estimated error on the combined momentum", error_nbin, 0, enerror_max);
1344   h1_ele_combinedP4Error_barrel = bookH1withSumw2(
1345       iBooker, "combinedP4Error_barrel", "Estimated error on the combined momentum - barrel", 30, 0, 30);
1346   h1_ele_combinedP4Error_endcaps = bookH1withSumw2(iBooker,
1347                                                    "combinedP4Error_endcaps",
1348                                                    "Estimated error on the combined momentum - endcaps",
1349                                                    error_nbin,
1350                                                    0,
1351                                                    enerror_max);
1352 
1353   // matched electron, superclusters
1354   setBookPrefix("h_scl");
1355   h1_scl_En = bookH1withSumw2(iBooker, "energy", "ele ecal energy", p_nbin, 0., p_max);
1356   h1_scl_EoEtrue_barrel =
1357       bookH1withSumw2(iBooker, "EoEtrue_barrel", "ele ecal energy / gen energy, barrel", 50, 0.2, 1.2, "E/E_{gen}");
1358   h1_scl_EoEtrue_barrel_etagap = bookH1withSumw2(
1359       iBooker, "EoEtrue_barrel_etagap", "ele ecal energy / gen energy, barrel, etagap", 50, 0.2, 1.2, "E/E_{gen}");
1360   h1_scl_EoEtrue_barrel_phigap = bookH1withSumw2(
1361       iBooker, "EoEtrue_barrel_phigap", "ele ecal energy / gen energy, barrel, phigap", 50, 0.2, 1.2, "E/E_{gen}");
1362   h1_scl_EoEtrue_ebeegap =
1363       bookH1withSumw2(iBooker, "EoEtrue_ebeegap", "ele ecal energy / gen energy, ebeegap", 50, 0.2, 1.2, "E/E_{gen}");
1364   h1_scl_EoEtrue_endcaps =
1365       bookH1withSumw2(iBooker, "EoEtrue_endcaps", "ele ecal energy / gen energy, endcaps", 50, 0.2, 1.2, "E/E_{gen}");
1366   h1_scl_EoEtrue_endcaps_deegap = bookH1withSumw2(
1367       iBooker, "EoEtrue_endcaps_deegap", "ele ecal energy / gen energy, endcaps, deegap", 50, 0.2, 1.2, "E/E_{gen}");
1368   h1_scl_EoEtrue_endcaps_ringgap = bookH1withSumw2(
1369       iBooker, "EoEtrue_endcaps_ringgap", "ele ecal energy / gen energy, endcaps, ringgap", 50, 0.2, 1.2, "E/E_{gen}");
1370   h1_scl_EoEtrue_barrel_new = bookH1withSumw2(iBooker,
1371                                               "EoEtrue_barrel_new",
1372                                               "ele ecal energy / gen energy, barrel",
1373                                               poptrue_nbin,
1374                                               poptrue_min,
1375                                               poptrue_max,
1376                                               "E/E_{gen}");
1377   h1_scl_EoEtrue_barrel_new_etagap = bookH1withSumw2(iBooker,
1378                                                      "EoEtrue_barrel_new_etagap",
1379                                                      "ele ecal energy / gen energy, barrel, etagap",
1380                                                      poptrue_nbin,
1381                                                      poptrue_min,
1382                                                      poptrue_max,
1383                                                      "E/E_{gen}");
1384   h1_scl_EoEtrue_barrel_new_phigap = bookH1withSumw2(iBooker,
1385                                                      "EoEtrue_barrel_new_phigap",
1386                                                      "ele ecal energy / gen energy, barrel, phigap",
1387                                                      poptrue_nbin,
1388                                                      poptrue_min,
1389                                                      poptrue_max,
1390                                                      "E/E_{gen}");
1391   h1_scl_EoEtrue_ebeegap_new = bookH1withSumw2(iBooker,
1392                                                "EoEtrue_ebeegap_new",
1393                                                "ele ecal energy / gen energy, ebeegap",
1394                                                poptrue_nbin,
1395                                                poptrue_min,
1396                                                poptrue_max,
1397                                                "E/E_{gen}");
1398   h1_scl_EoEtrue_endcaps_new = bookH1withSumw2(iBooker,
1399                                                "EoEtrue_endcaps_new",
1400                                                "ele ecal energy / gen energy, endcaps",
1401                                                poptrue_nbin,
1402                                                poptrue_min,
1403                                                poptrue_max,
1404                                                "E/E_{gen}");
1405   h1_scl_EoEtrue_endcaps_new_Extended = bookH1withSumw2(iBooker,
1406                                                         "EoEtrue_endcaps_new_Extended",
1407                                                         "ele ecal energy / gen energy, endcaps, extended",
1408                                                         poptrue_nbin,
1409                                                         poptrue_min,
1410                                                         poptrue_max,
1411                                                         "E/E_{gen}");
1412   h1_scl_EoEtrue_endcaps_new_deegap = bookH1withSumw2(iBooker,
1413                                                       "EoEtrue_endcaps_new_deegap",
1414                                                       "ele ecal energy / gen energy, endcaps, deegap",
1415                                                       poptrue_nbin,
1416                                                       poptrue_min,
1417                                                       poptrue_max,
1418                                                       "E/E_{gen}");
1419   h1_scl_EoEtrue_endcaps_new_ringgap = bookH1withSumw2(iBooker,
1420                                                        "EoEtrue_endcaps_new_ringgap",
1421                                                        "ele ecal energy / gen energy, endcaps, ringgap",
1422                                                        poptrue_nbin,
1423                                                        poptrue_min,
1424                                                        poptrue_max,
1425                                                        "E/E_{gen}");
1426   h1_scl_Et = bookH1withSumw2(iBooker, "et", "ele supercluster transverse energy", pt_nbin, 0., pt_max);
1427   h2_scl_EtVsEta = bookH2(iBooker,
1428                           "etVsEta",
1429                           "ele supercluster transverse energy vs eta",
1430                           eta2D_nbin,
1431                           eta_min,
1432                           eta_max,
1433                           pt_nbin,
1434                           0.,
1435                           pt_max);
1436   h2_scl_EtVsPhi = bookH2(iBooker,
1437                           "etVsPhi",
1438                           "ele supercluster transverse energy vs phi",
1439                           phi2D_nbin,
1440                           phi_min,
1441                           phi_max,
1442                           pt_nbin,
1443                           0.,
1444                           pt_max);
1445   h2_scl_EtaVsPhi = bookH2(
1446       iBooker, "etaVsPhi", "ele supercluster eta vs phi", phi2D_nbin, phi_min, phi_max, eta2D_nbin, eta_min, eta_max);
1447   h1_scl_Eta = bookH1withSumw2(iBooker, "eta", "ele supercluster eta", eta_nbin, eta_min, eta_max);
1448   h1_scl_Phi = bookH1withSumw2(iBooker, "phi", "ele supercluster phi", phi_nbin, phi_min, phi_max);
1449   h1_scl_SigEtaEta = bookH1withSumw2(iBooker,
1450                                      "sigetaeta",
1451                                      "ele supercluster sigma eta eta",
1452                                      100,
1453                                      0.,
1454                                      0.05,
1455                                      "#sigma_{#eta #eta}",
1456                                      "Events",
1457                                      "ELE_LOGY E1 P");
1458   h1_scl_SigEtaEta_barrel = bookH1withSumw2(iBooker,
1459                                             "sigetaeta_barrel",
1460                                             "ele supercluster sigma eta eta barrel",
1461                                             100,
1462                                             0.,
1463                                             0.05,
1464                                             "#sigma_{#eta #eta}",
1465                                             "Events",
1466                                             "ELE_LOGY E1 P");
1467   h1_scl_SigEtaEta_endcaps = bookH1withSumw2(iBooker,
1468                                              "sigetaeta_endcaps",
1469                                              "ele supercluster sigma eta eta endcaps",
1470                                              100,
1471                                              0.,
1472                                              0.05,
1473                                              "#sigma_{#eta #eta}",
1474                                              "Events",
1475                                              "ELE_LOGY E1 P");
1476   h1_scl_SigIEtaIEta = bookH1withSumw2(iBooker,
1477                                        "sigietaieta",
1478                                        "ele supercluster sigma ieta ieta",
1479                                        100,
1480                                        0.,
1481                                        0.05,
1482                                        "#sigma_{i#eta i#eta}",
1483                                        "Events",
1484                                        "ELE_LOGY E1 P");
1485   h1_scl_SigIEtaIEta_barrel = bookH1withSumw2(iBooker,
1486                                               "sigietaieta_barrel",
1487                                               "ele supercluster sigma ieta ieta, barrel",
1488                                               100,
1489                                               0.,
1490                                               0.05,
1491                                               "#sigma_{i#eta i#eta}",
1492                                               "Events",
1493                                               "ELE_LOGY E1 P");
1494   h1_scl_SigIEtaIEta_endcaps = bookH1withSumw2(iBooker,
1495                                                "sigietaieta_endcaps",
1496                                                "ele supercluster sigma ieta ieta, endcaps",
1497                                                100,
1498                                                0.,
1499                                                0.05,
1500                                                "#sigma_{i#eta i#eta}",
1501                                                "Events",
1502                                                "ELE_LOGY E1 P");
1503   h1_scl_SigIEtaIEta_mAOD = bookH1withSumw2(iBooker,
1504                                             "SigIEtaIEta_mAOD",
1505                                             "ele supercluster sigma ieta ieta",
1506                                             100,
1507                                             0.,
1508                                             0.05,
1509                                             "#sigma_{i#eta i#eta}",
1510                                             "Events",
1511                                             "ELE_LOGY E1 P");
1512   h1_scl_SigIEtaIEta_mAOD_barrel = bookH1withSumw2(iBooker,
1513                                                    "SigIEtaIEta_mAOD_barrel",
1514                                                    "ele supercluster sigma ieta ieta, barrel",
1515                                                    100,
1516                                                    0.,
1517                                                    0.05,
1518                                                    "#sigma_{i#eta i#eta}",
1519                                                    "Events",
1520                                                    "ELE_LOGY E1 P");
1521   h1_scl_SigIEtaIEta_mAOD_endcaps = bookH1withSumw2(iBooker,
1522                                                     "SigIEtaIEta_mAOD_endcaps",
1523                                                     "ele supercluster sigma ieta ieta, endcaps",
1524                                                     100,
1525                                                     0.,
1526                                                     0.05,
1527                                                     "#sigma_{i#eta i#eta}",
1528                                                     "Events",
1529                                                     "ELE_LOGY E1 P");
1530   h1_scl_full5x5_sigmaIetaIeta = bookH1withSumw2(iBooker,
1531                                                  "full5x5_sigietaieta",
1532                                                  "ele supercluster full5x5 sigma ieta ieta",
1533                                                  100,
1534                                                  0.,
1535                                                  0.05,
1536                                                  "#sigma_{i#eta i#eta}",
1537                                                  "Events",
1538                                                  "ELE_LOGY E1 P");
1539   h1_scl_full5x5_sigmaIetaIeta_Extended = bookH1withSumw2(iBooker,
1540                                                           "full5x5_sigietaieta_Extended",
1541                                                           "ele supercluster full5x5 sigma ieta ieta, 2.5<|eta|<3",
1542                                                           100,
1543                                                           0.,
1544                                                           0.05,
1545                                                           "#sigma_{i#eta i#eta}",
1546                                                           "Events",
1547                                                           "ELE_LOGY E1 P");
1548   h1_scl_full5x5_sigmaIetaIeta_barrel = bookH1withSumw2(iBooker,
1549                                                         "full5x5_sigietaieta_barrel",
1550                                                         "ele supercluster full5x5 sigma ieta ieta, barrel",
1551                                                         100,
1552                                                         0.,
1553                                                         0.05,
1554                                                         "#sigma_{i#eta i#eta}",
1555                                                         "Events",
1556                                                         "ELE_LOGY E1 P");
1557   h1_scl_full5x5_sigmaIetaIeta_endcaps = bookH1withSumw2(iBooker,
1558                                                          "full5x5_sigietaieta_endcaps",
1559                                                          "ele supercluster full5x5 sigma ieta ieta, endcaps",
1560                                                          100,
1561                                                          0.,
1562                                                          0.05,
1563                                                          "#sigma_{i#eta i#eta}",
1564                                                          "Events",
1565                                                          "ELE_LOGY E1 P");
1566   h1_scl_E1x5 = bookH1withSumw2(
1567       iBooker, "E1x5", "ele supercluster energy in 1x5", p_nbin, 0., p_max, "E1x5 (GeV)", "Events", "ELE_LOGY E1 P");
1568   h1_scl_E1x5_barrel = bookH1withSumw2(iBooker,
1569                                        "E1x5_barrel",
1570                                        "ele supercluster energy in 1x5 barrel",
1571                                        p_nbin,
1572                                        0.,
1573                                        p_max,
1574                                        "E1x5 (GeV)",
1575                                        "Events",
1576                                        "ELE_LOGY E1 P");
1577   h1_scl_E1x5_endcaps = bookH1withSumw2(iBooker,
1578                                         "E1x5_endcaps",
1579                                         "ele supercluster energy in 1x5 endcaps",
1580                                         p_nbin,
1581                                         0.,
1582                                         p_max,
1583                                         "E1x5 (GeV)",
1584                                         "Events",
1585                                         "ELE_LOGY E1 P");
1586   h1_scl_E2x5max = bookH1withSumw2(iBooker,
1587                                    "E2x5max",
1588                                    "ele supercluster energy in 2x5 max",
1589                                    p_nbin,
1590                                    0.,
1591                                    p_max,
1592                                    "E2x5 (GeV)",
1593                                    "Events",
1594                                    "ELE_LOGY E1 P");
1595   h1_scl_E2x5max_barrel = bookH1withSumw2(iBooker,
1596                                           "E2x5max_barrel",
1597                                           "ele supercluster energy in 2x5 _max barrel",
1598                                           p_nbin,
1599                                           0.,
1600                                           p_max,
1601                                           "E2x5 (GeV)",
1602                                           "Events",
1603                                           "ELE_LOGY E1 P");
1604   h1_scl_E2x5max_endcaps = bookH1withSumw2(iBooker,
1605                                            "E2x5max_endcaps",
1606                                            "ele supercluster energy in 2x5 _max endcaps",
1607                                            p_nbin,
1608                                            0.,
1609                                            p_max,
1610                                            "E2x5 (GeV)",
1611                                            "Events",
1612                                            "ELE_LOGY E1 P");
1613   h1_scl_E5x5 = bookH1withSumw2(
1614       iBooker, "E5x5", "ele supercluster energy in 5x5", p_nbin, 0., p_max, "E5x5 (GeV)", "Events", "ELE_LOGY E1 P");
1615   h1_scl_E5x5_barrel = bookH1withSumw2(iBooker,
1616                                        "E5x5_barrel",
1617                                        "ele supercluster energy in 5x5 barrel",
1618                                        p_nbin,
1619                                        0.,
1620                                        p_max,
1621                                        "E5x5 (GeV)",
1622                                        "Events",
1623                                        "ELE_LOGY E1 P");
1624   h1_scl_E5x5_endcaps = bookH1withSumw2(iBooker,
1625                                         "E5x5_endcaps",
1626                                         "ele supercluster energy in 5x5 endcaps",
1627                                         p_nbin,
1628                                         0.,
1629                                         p_max,
1630                                         "E5x5 (GeV)",
1631                                         "Events",
1632                                         "ELE_LOGY E1 P");
1633   h2_scl_EoEtruePfVsEg = bookH2(iBooker,
1634                                 "EoEtruePfVsEg",
1635                                 "mean mustache SC/true energy vs final SC/true energy",
1636                                 75,
1637                                 -0.1,
1638                                 1.4,
1639                                 75,
1640                                 -0.1,
1641                                 1.4,
1642                                 "E_{final SC}/E_{gen}",
1643                                 "E_{mustache}/E_{gen}");
1644   h1_scl_bcl_EtotoEtrue =
1645       bookH1withSumw2(iBooker, "bcl_EtotoEtrue", "Total basicclusters energy", 50, 0.2, 1.2, "E/E_{gen}");
1646   h1_scl_bcl_EtotoEtrue_Extended = bookH1withSumw2(
1647       iBooker, "bcl_EtotoEtrue_Extended", "Total basicclusters energy, 2.5<|eta|<3", 50, 0.2, 1.2, "E/E_{gen}");
1648   h1_scl_bcl_EtotoEtrue_barrel = bookH1withSumw2(
1649       iBooker, "bcl_EtotoEtrue_barrel", "Total basicclusters energy , barrel", 50, 0.2, 1.2, "E/E_{gen}");
1650   h1_scl_bcl_EtotoEtrue_endcaps = bookH1withSumw2(
1651       iBooker, "bcl_EtotoEtrue_endcaps", "Total basicclusters energy , endcaps", 50, 0.2, 1.2, "E/E_{gen}");
1652   h1_scl_ESFrac_endcaps = bookH1withSumw2(iBooker,
1653                                           "ESFrac_endcaps",
1654                                           "Preshower over SC raw energy , endcaps",
1655                                           100,
1656                                           0.,
1657                                           0.8,
1658                                           "E_{PS} / E^{raw}_{SC}",
1659                                           "Events",
1660                                           "ELE_LOGY E1 P");
1661 
1662   // matched electron, gsf tracks
1663   setBookPrefix("h_ele");
1664   h1_ele_ambiguousTracks = bookH1withSumw2(iBooker,
1665                                            "ambiguousTracks",
1666                                            "ele # ambiguous tracks",
1667                                            5,
1668                                            0.,
1669                                            5.,
1670                                            "N_{ambiguous tracks}",
1671                                            "Events",
1672                                            "ELE_LOGY E1 P");
1673   h2_ele_ambiguousTracksVsEta =
1674       bookH2(iBooker, "ambiguousTracksVsEta", "ele # ambiguous tracks vs eta", eta2D_nbin, eta_min, eta_max, 5, 0., 5.);
1675   h2_ele_ambiguousTracksVsPhi =
1676       bookH2(iBooker, "ambiguousTracksVsPhi", "ele # ambiguous tracks vs phi", phi2D_nbin, phi_min, phi_max, 5, 0., 5.);
1677   h2_ele_ambiguousTracksVsPt =
1678       bookH2(iBooker, "ambiguousTracksVsPt", "ele # ambiguous tracks vs pt", pt2D_nbin, 0., pt_max, 5, 0., 5.);
1679   h1_ele_foundHits =
1680       bookH1withSumw2(iBooker, "foundHits", "ele track # found hits", fhits_nbin, 0., fhits_max, "N_{hits}");
1681   h1_ele_foundHits_barrel = bookH1withSumw2(
1682       iBooker, "foundHits_barrel", "ele track # found hits, barrel", fhits_nbin, 0., fhits_max, "N_{hits}");
1683   h1_ele_foundHits_endcaps = bookH1withSumw2(
1684       iBooker, "foundHits_endcaps", "ele track # found hits, endcaps", fhits_nbin, 0., fhits_max, "N_{hits}");
1685   h2_ele_foundHitsVsEta_Extended = bookH2(iBooker,
1686                                           "foundHitsVsEta_Extended",
1687                                           "ele track # found hits vs eta",
1688                                           eta2D_nbin_extended,
1689                                           eta_min_extended,
1690                                           eta_max_extended,
1691                                           fhits_nbin,
1692                                           0.,
1693                                           fhits_max);
1694   h2_ele_foundHitsVsEta_mAOD = bookH2(iBooker,
1695                                       "foundHitsVsEta_mAOD",
1696                                       "ele track # found hits vs eta",
1697                                       eta2D_nbin,
1698                                       eta_min,
1699                                       eta_max,
1700                                       fhits_nbin,
1701                                       0.,
1702                                       fhits_max);
1703   h2_ele_foundHitsVsPhi = bookH2(iBooker,
1704                                  "foundHitsVsPhi",
1705                                  "ele track # found hits vs phi",
1706                                  phi2D_nbin,
1707                                  phi_min,
1708                                  phi_max,
1709                                  fhits_nbin,
1710                                  0.,
1711                                  fhits_max);
1712   h2_ele_foundHitsVsPt = bookH2(
1713       iBooker, "foundHitsVsPt", "ele track # found hits vs pt", pt2D_nbin, 0., pt_max, fhits_nbin, 0., fhits_max);
1714   h1_ele_lostHits = bookH1withSumw2(iBooker, "lostHits", "ele track # lost hits", 5, 0., 5., "N_{lost hits}");
1715   h1_ele_lostHits_barrel =
1716       bookH1withSumw2(iBooker, "lostHits_barrel", "ele track # lost hits, barrel", 5, 0., 5., "N_{lost hits}");
1717   h1_ele_lostHits_endcaps =
1718       bookH1withSumw2(iBooker, "lostHits_endcaps", "ele track # lost hits, endcaps", 5, 0., 5., "N_{lost hits}");
1719   h2_ele_lostHitsVsEta = bookH2(
1720       iBooker, "lostHitsVsEta", "ele track # lost hits vs eta", eta2D_nbin, eta_min, eta_max, lhits_nbin, 0., lhits_max);
1721   h2_ele_lostHitsVsPhi = bookH2(
1722       iBooker, "lostHitsVsPhi", "ele track # lost hits vs eta", phi2D_nbin, phi_min, phi_max, lhits_nbin, 0., lhits_max);
1723   h2_ele_lostHitsVsPt =
1724       bookH2(iBooker, "lostHitsVsPt", "ele track # lost hits vs eta", pt2D_nbin, 0., pt_max, lhits_nbin, 0., lhits_max);
1725   h1_ele_chi2 =
1726       bookH1withSumw2(iBooker, "chi2", "ele track #chi^{2}", 100, 0., 15., "#Chi^{2}", "Events", "ELE_LOGY E1 P");
1727   h1_ele_chi2_barrel = bookH1withSumw2(
1728       iBooker, "chi2_barrel", "ele track #chi^{2}, barrel", 100, 0., 15., "#Chi^{2}", "Events", "ELE_LOGY E1 P");
1729   h1_ele_chi2_endcaps = bookH1withSumw2(
1730       iBooker, "chi2_endcaps", "ele track #chi^{2}, endcaps", 100, 0., 15., "#Chi^{2}", "Events", "ELE_LOGY E1 P");
1731   h2_ele_chi2VsEta =
1732       bookH2(iBooker, "chi2VsEta", "ele track #chi^{2} vs eta", eta2D_nbin, eta_min, eta_max, 50, 0., 15.);
1733   h2_ele_chi2VsPhi =
1734       bookH2(iBooker, "chi2VsPhi", "ele track #chi^{2} vs phi", phi2D_nbin, phi_min, phi_max, 50, 0., 15.);
1735   h2_ele_chi2VsPt = bookH2(iBooker, "chi2VsPt", "ele track #chi^{2} vs pt", pt2D_nbin, 0., pt_max, 50, 0., 15.);
1736   h1_ele_PinMnPout = bookH1withSumw2(iBooker,
1737                                      "PinMnPout",
1738                                      "ele track inner p - outer p, mean of GSF components",
1739                                      p_nbin,
1740                                      0.,
1741                                      200.,
1742                                      "P_{vertex} - P_{out} (GeV/c)");
1743   h1_ele_PinMnPout_mode = bookH1withSumw2(iBooker,
1744                                           "PinMnPout_mode",
1745                                           "ele track inner p - outer p, mode of GSF components",
1746                                           p_nbin,
1747                                           0.,
1748                                           100.,
1749                                           "P_{vertex} - P_{out}, mode of GSF components (GeV/c)");
1750   h2_ele_PinMnPoutVsEta_mode = bookH2(iBooker,
1751                                       "PinMnPoutVsEta_mode",
1752                                       "ele track inner p - outer p vs eta, mode of GSF components",
1753                                       eta2D_nbin,
1754                                       eta_min,
1755                                       eta_max,
1756                                       p2D_nbin,
1757                                       0.,
1758                                       100.);
1759   h2_ele_PinMnPoutVsPhi_mode = bookH2(iBooker,
1760                                       "PinMnPoutVsPhi_mode",
1761                                       "ele track inner p - outer p vs phi, mode of GSF components",
1762                                       phi2D_nbin,
1763                                       phi_min,
1764                                       phi_max,
1765                                       p2D_nbin,
1766                                       0.,
1767                                       100.);
1768   h2_ele_PinMnPoutVsPt_mode = bookH2(iBooker,
1769                                      "PinMnPoutVsPt_mode",
1770                                      "ele track inner p - outer p vs pt, mode of GSF components",
1771                                      pt2D_nbin,
1772                                      0.,
1773                                      pt_max,
1774                                      p2D_nbin,
1775                                      0.,
1776                                      100.);
1777   h2_ele_PinMnPoutVsE_mode = bookH2(iBooker,
1778                                     "PinMnPoutVsE_mode",
1779                                     "ele track inner p - outer p vs E, mode of GSF components",
1780                                     p2D_nbin,
1781                                     0.,
1782                                     200.,
1783                                     p2D_nbin,
1784                                     0.,
1785                                     100.);
1786   h2_ele_PinMnPoutVsChi2_mode = bookH2(iBooker,
1787                                        "PinMnPoutVsChi2_mode",
1788                                        "ele track inner p - outer p vs track chi2, mode of GSF components",
1789                                        50,
1790                                        0.,
1791                                        20.,
1792                                        p2D_nbin,
1793                                        0.,
1794                                        100.);
1795   h1_ele_outerP = bookH1withSumw2(
1796       iBooker, "outerP", "ele track outer p, mean of GSF components", p_nbin, 0., p_max, "P_{out} (GeV/c)");
1797   h1_ele_outerP_mode = bookH1withSumw2(
1798       iBooker, "outerP_mode", "ele track outer p, mode of GSF components", p_nbin, 0., p_max, "P_{out} (GeV/c)");
1799   h2_ele_outerPVsEta_mode =
1800       bookH2(iBooker, "outerPVsEta_mode", "ele track outer p vs eta mode", eta2D_nbin, eta_min, eta_max, 50, 0., p_max);
1801   h1_ele_outerPt = bookH1withSumw2(
1802       iBooker, "outerPt", "ele track outer p_{T}, mean of GSF components", pt_nbin, 0., pt_max, "P_{T out} (GeV/c)");
1803   h1_ele_outerPt_mode = bookH1withSumw2(iBooker,
1804                                         "outerPt_mode",
1805                                         "ele track outer p_{T}, mode of GSF components",
1806                                         pt_nbin,
1807                                         0.,
1808                                         pt_max,
1809                                         "P_{T out} (GeV/c)");
1810   h2_ele_outerPtVsEta_mode = bookH2(iBooker,
1811                                     "outerPtVsEta_mode",
1812                                     "ele track outer p_{T} vs eta, mode of GSF components",
1813                                     eta2D_nbin,
1814                                     eta_min,
1815                                     eta_max,
1816                                     pt2D_nbin,
1817                                     0.,
1818                                     pt_max);
1819   h2_ele_outerPtVsPhi_mode = bookH2(iBooker,
1820                                     "outerPtVsPhi_mode",
1821                                     "ele track outer p_{T} vs phi, mode of GSF components",
1822                                     phi2D_nbin,
1823                                     phi_min,
1824                                     phi_max,
1825                                     pt2D_nbin,
1826                                     0.,
1827                                     pt_max);
1828   h2_ele_outerPtVsPt_mode = bookH2(iBooker,
1829                                    "outerPtVsPt_mode",
1830                                    "ele track outer p_{T} vs pt, mode of GSF components",
1831                                    pt2D_nbin,
1832                                    0.,
1833                                    100.,
1834                                    pt2D_nbin,
1835                                    0.,
1836                                    pt_max);
1837 
1838   // matched electrons, matching
1839   h1_ele_EoP = bookH1withSumw2(
1840       iBooker, "EoP", "ele E/P_{vertex}", eop_nbin, 0., eop_max, "E/P_{vertex}", "Events", "ELE_LOGY E1 P");
1841   h1_ele_EoP_barrel = bookH1withSumw2(iBooker,
1842                                       "EoP_barrel",
1843                                       "ele E/P_{vertex} barrel",
1844                                       eop_nbin,
1845                                       0.,
1846                                       eop_max,
1847                                       "E/P_{vertex}",
1848                                       "Events",
1849                                       "ELE_LOGY E1 P");
1850   h1_ele_EoP_endcaps = bookH1withSumw2(iBooker,
1851                                        "EoP_endcaps",
1852                                        "ele E/P_{vertex} endcaps",
1853                                        eop_nbin,
1854                                        0.,
1855                                        eop_max,
1856                                        "E/P_{vertex}",
1857                                        "Events",
1858                                        "ELE_LOGY E1 P");
1859   h2_ele_EoPVsEta_Extended = bookH2(iBooker,
1860                                     "EoPVsEta_Extended",
1861                                     "ele E/P_{vertex} vs eta",
1862                                     eta2D_nbin_extended,
1863                                     eta_min_extended,
1864                                     eta_max_extended,
1865                                     eop2D_nbin,
1866                                     0.,
1867                                     eopmaxsht);
1868   h2_ele_EoPVsPhi =
1869       bookH2(iBooker, "EoPVsPhi", "ele E/P_{vertex} vs phi", phi2D_nbin, phi_min, phi_max, eop2D_nbin, 0., eopmaxsht);
1870   h2_ele_EoPVsE = bookH2(iBooker, "EoPVsE", "ele E/P_{vertex} vs E", 50, 0., p_max, 50, 0., 5.);
1871   h1_ele_EseedOP = bookH1withSumw2(iBooker,
1872                                    "EseedOP",
1873                                    "ele E_{seed}/P_{vertex}",
1874                                    eop_nbin,
1875                                    0.,
1876                                    eop_max,
1877                                    "E_{seed}/P_{vertex}",
1878                                    "Events",
1879                                    "ELE_LOGY E1 P");
1880   h1_ele_EseedOP_barrel = bookH1withSumw2(iBooker,
1881                                           "EseedOP_barrel",
1882                                           "ele E_{seed}/P_{vertex} barrel",
1883                                           eop_nbin,
1884                                           0.,
1885                                           eop_max,
1886                                           "E_{seed}/P_{vertex}",
1887                                           "Events",
1888                                           "ELE_LOGY E1 P");
1889   h1_ele_EseedOP_endcaps = bookH1withSumw2(iBooker,
1890                                            "EseedOP_endcaps",
1891                                            "ele E_{seed}/P_{vertex} endcaps",
1892                                            eop_nbin,
1893                                            0.,
1894                                            eop_max,
1895                                            "E_{seed}/P_{vertex}",
1896                                            "Events",
1897                                            "ELE_LOGY E1 P");
1898   h2_ele_EseedOPVsEta = bookH2(iBooker,
1899                                "EseedOPVsEta",
1900                                "ele E_{seed}/P_{vertex} vs eta",
1901                                eta2D_nbin,
1902                                eta_min,
1903                                eta_max,
1904                                eop2D_nbin,
1905                                0.,
1906                                eopmaxsht);
1907   h2_ele_EseedOPVsPhi = bookH2(iBooker,
1908                                "EseedOPVsPhi",
1909                                "ele E_{seed}/P_{vertex} vs phi",
1910                                phi2D_nbin,
1911                                phi_min,
1912                                phi_max,
1913                                eop2D_nbin,
1914                                0.,
1915                                eopmaxsht);
1916   h2_ele_EseedOPVsE = bookH2(iBooker, "EseedOPVsE", "ele E_{seed}/P_{vertex} vs E", 50, 0., p_max, 50, 0., 5.);
1917   h1_ele_EoPout = bookH1withSumw2(
1918       iBooker, "EoPout", "ele E_{seed}/P_{out}", eop_nbin, 0., eop_max, "E_{seed}/P_{out}", "Events", "ELE_LOGY E1 P");
1919   h1_ele_EoPout_barrel = bookH1withSumw2(iBooker,
1920                                          "EoPout_barrel",
1921                                          "ele E_{seed}/P_{out} barrel",
1922                                          eop_nbin,
1923                                          0.,
1924                                          eop_max,
1925                                          "E_{seed}/P_{out}",
1926                                          "Events",
1927                                          "ELE_LOGY E1 P");
1928   h1_ele_EoPout_endcaps = bookH1withSumw2(iBooker,
1929                                           "EoPout_endcaps",
1930                                           "ele E_{seed}/P_{out} endcaps",
1931                                           eop_nbin,
1932                                           0.,
1933                                           eop_max,
1934                                           "E_{seed}/P_{out}",
1935                                           "Events",
1936                                           "ELE_LOGY E1 P");
1937   h2_ele_EoPoutVsEta = bookH2(
1938       iBooker, "EoPoutVsEta", "ele E_{seed}/P_{out} vs eta", eta2D_nbin, eta_min, eta_max, eop2D_nbin, 0., eopmaxsht);
1939   h2_ele_EoPoutVsPhi = bookH2(
1940       iBooker, "EoPoutVsPhi", "ele E_{seed}/P_{out} vs phi", phi2D_nbin, phi_min, phi_max, eop2D_nbin, 0., eopmaxsht);
1941   h2_ele_EoPoutVsE =
1942       bookH2(iBooker, "EoPoutVsE", "ele E_{seed}/P_{out} vs E", p2D_nbin, 0., p_max, eop2D_nbin, 0., eopmaxsht);
1943   h1_ele_EeleOPout = bookH1withSumw2(
1944       iBooker, "EeleOPout", "ele E_{ele}/P_{out}", eop_nbin, 0., eop_max, "E_{ele}/P_{out}", "Events", "ELE_LOGY E1 P");
1945   h1_ele_EeleOPout_barrel = bookH1withSumw2(iBooker,
1946                                             "EeleOPout_barrel",
1947                                             "ele E_{ele}/P_{out} barrel",
1948                                             eop_nbin,
1949                                             0.,
1950                                             eop_max,
1951                                             "E_{ele}/P_{out}",
1952                                             "Events",
1953                                             "ELE_LOGY E1 P");
1954   h1_ele_EeleOPout_endcaps = bookH1withSumw2(iBooker,
1955                                              "EeleOPout_endcaps",
1956                                              "ele E_{ele}/P_{out} endcaps",
1957                                              eop_nbin,
1958                                              0.,
1959                                              eop_max,
1960                                              "E_{ele}/P_{out}",
1961                                              "Events",
1962                                              "ELE_LOGY E1 P");
1963   h2_ele_EeleOPoutVsEta = bookH2(
1964       iBooker, "EeleOPoutVsEta", "ele E_{ele}/P_{out} vs eta", eta2D_nbin, eta_min, eta_max, eop2D_nbin, 0., eopmaxsht);
1965   h2_ele_EeleOPoutVsPhi = bookH2(
1966       iBooker, "EeleOPoutVsPhi", "ele E_{ele}/P_{out} vs phi", phi2D_nbin, phi_min, phi_max, eop2D_nbin, 0., eopmaxsht);
1967   h2_ele_EeleOPoutVsE =
1968       bookH2(iBooker, "EeleOPoutVsE", "ele E_{ele}/P_{out} vs E", p2D_nbin, 0., p_max, eop2D_nbin, 0., eopmaxsht);
1969   h1_ele_dEtaSc_propVtx = bookH1withSumw2(iBooker,
1970                                           "dEtaSc_propVtx",
1971                                           "ele #eta_{sc} - #eta_{tr}, prop from vertex",
1972                                           detamatch_nbin,
1973                                           detamatch_min,
1974                                           detamatch_max,
1975                                           "#eta_{sc} - #eta_{tr}",
1976                                           "Events",
1977                                           "ELE_LOGY E1 P");
1978   h1_ele_dEtaSc_propVtx_Extended = bookH1withSumw2(iBooker,
1979                                                    "dEtaSc_propVtx_Extended",
1980                                                    "ele #eta_{sc} - #eta_{tr}, prop from vertex, 2.5<|eta|<3",
1981                                                    detamatch_nbin,
1982                                                    detamatch_min,
1983                                                    detamatch_max,
1984                                                    "#eta_{sc} - #eta_{tr}",
1985                                                    "Events",
1986                                                    "ELE_LOGY E1 P");
1987   h1_ele_dEtaSc_propVtx_barrel = bookH1withSumw2(iBooker,
1988                                                  "dEtaSc_propVtx_barrel",
1989                                                  "ele #eta_{sc} - #eta_{tr}, prop from vertex, barrel",
1990                                                  detamatch_nbin,
1991                                                  detamatch_min,
1992                                                  detamatch_max,
1993                                                  "#eta_{sc} - #eta_{tr}",
1994                                                  "Events",
1995                                                  "ELE_LOGY E1 P");
1996   h1_ele_dEtaSc_propVtx_endcaps = bookH1withSumw2(iBooker,
1997                                                   "dEtaSc_propVtx_endcaps",
1998                                                   "ele #eta_{sc} - #eta_{tr}, prop from vertex, endcaps",
1999                                                   detamatch_nbin,
2000                                                   detamatch_min,
2001                                                   detamatch_max,
2002                                                   "#eta_{sc} - #eta_{tr}",
2003                                                   "Events",
2004                                                   "ELE_LOGY E1 P");
2005   h1_ele_dEtaSc_propVtx_mAOD = bookH1withSumw2(iBooker,
2006                                                "dEtaSc_propVtx_mAOD",
2007                                                "ele #eta_{sc} - #eta_{tr}, prop from vertex",
2008                                                detamatch_nbin,
2009                                                detamatch_min,
2010                                                detamatch_max,
2011                                                "#eta_{sc} - #eta_{tr}",
2012                                                "Events",
2013                                                "ELE_LOGY E1 P");
2014   h1_ele_dEtaSc_propVtx_mAOD_barrel = bookH1withSumw2(iBooker,
2015                                                       "dEtaSc_propVtx_mAOD_barrel",
2016                                                       "ele #eta_{sc} - #eta_{tr}, prop from vertex, barrel",
2017                                                       detamatch_nbin,
2018                                                       detamatch_min,
2019                                                       detamatch_max,
2020                                                       "#eta_{sc} - #eta_{tr}",
2021                                                       "Events",
2022                                                       "ELE_LOGY E1 P");
2023   h1_ele_dEtaSc_propVtx_mAOD_endcaps = bookH1withSumw2(iBooker,
2024                                                        "dEtaSc_propVtx_mAOD_endcaps",
2025                                                        "ele #eta_{sc} - #eta_{tr}, prop from vertex, endcaps",
2026                                                        detamatch_nbin,
2027                                                        detamatch_min,
2028                                                        detamatch_max,
2029                                                        "#eta_{sc} - #eta_{tr}",
2030                                                        "Events",
2031                                                        "ELE_LOGY E1 P");
2032   h2_ele_dEtaScVsEta_propVtx = bookH2(iBooker,
2033                                       "dEtaScVsEta_propVtx",
2034                                       "ele #eta_{sc} - #eta_{tr} vs eta, prop from vertex",
2035                                       eta2D_nbin,
2036                                       eta_min,
2037                                       eta_max,
2038                                       detamatch2D_nbin,
2039                                       detamatch_min,
2040                                       detamatch_max);
2041   h2_ele_dEtaScVsPhi_propVtx = bookH2(iBooker,
2042                                       "dEtaScVsPhi_propVtx",
2043                                       "ele #eta_{sc} - #eta_{tr} vs phi, prop from vertex",
2044                                       phi2D_nbin,
2045                                       phi_min,
2046                                       phi_max,
2047                                       detamatch2D_nbin,
2048                                       detamatch_min,
2049                                       detamatch_max);
2050   h2_ele_dEtaScVsPt_propVtx = bookH2(iBooker,
2051                                      "dEtaScVsPt_propVtx",
2052                                      "ele #eta_{sc} - #eta_{tr} vs pt, prop from vertex",
2053                                      pt2D_nbin,
2054                                      0.,
2055                                      pt_max,
2056                                      detamatch2D_nbin,
2057                                      detamatch_min,
2058                                      detamatch_max);
2059   h1_ele_dPhiSc_propVtx = bookH1withSumw2(iBooker,
2060                                           "dPhiSc_propVtx",
2061                                           "ele #phi_{sc} - #phi_{tr}, prop from vertex",
2062                                           dphimatch_nbin,
2063                                           dphimatch_min,
2064                                           dphimatch_max,
2065                                           "#phi_{sc} - #phi_{tr} (rad)",
2066                                           "Events",
2067                                           "ELE_LOGY E1 P");
2068   h1_ele_dPhiSc_propVtx_Extended = bookH1withSumw2(iBooker,
2069                                                    "dPhiSc_propVtx_Extended",
2070                                                    "ele #phi_{sc} - #phi_{tr}, prop from vertex, 2.5<|eta|<3",
2071                                                    dphimatch_nbin,
2072                                                    dphimatch_min,
2073                                                    dphimatch_max,
2074                                                    "#phi_{sc} - #phi_{tr} (rad)",
2075                                                    "Events",
2076                                                    "ELE_LOGY E1 P");
2077   h1_ele_dPhiSc_propVtx_barrel = bookH1withSumw2(iBooker,
2078                                                  "dPhiSc_propVtx_barrel",
2079                                                  "ele #phi_{sc} - #phi_{tr}, prop from vertex, barrel",
2080                                                  dphimatch_nbin,
2081                                                  dphimatch_min,
2082                                                  dphimatch_max,
2083                                                  "#phi_{sc} - #phi_{tr} (rad)",
2084                                                  "Events",
2085                                                  "ELE_LOGY E1 P");
2086   h1_ele_dPhiSc_propVtx_endcaps = bookH1withSumw2(iBooker,
2087                                                   "dPhiSc_propVtx_endcaps",
2088                                                   "ele #phi_{sc} - #phi_{tr}, prop from vertex, endcaps",
2089                                                   dphimatch_nbin,
2090                                                   dphimatch_min,
2091                                                   dphimatch_max,
2092                                                   "#phi_{sc} - #phi_{tr} (rad)",
2093                                                   "Events",
2094                                                   "ELE_LOGY E1 P");
2095   h2_ele_dPhiScVsEta_propVtx = bookH2(iBooker,
2096                                       "dPhiScVsEta_propVtx",
2097                                       "ele #phi_{sc} - #phi_{tr} vs eta, prop from vertex",
2098                                       eta2D_nbin,
2099                                       eta_min,
2100                                       eta_max,
2101                                       dphimatch2D_nbin,
2102                                       dphimatch_min,
2103                                       dphimatch_max);
2104   h2_ele_dPhiScVsPhi_propVtx = bookH2(iBooker,
2105                                       "dPhiScVsPhi_propVtx",
2106                                       "ele #phi_{sc} - #phi_{tr} vs phi, prop from vertex",
2107                                       phi2D_nbin,
2108                                       phi_min,
2109                                       phi_max,
2110                                       dphimatch2D_nbin,
2111                                       dphimatch_min,
2112                                       dphimatch_max);
2113   h2_ele_dPhiScVsPt_propVtx = bookH2(iBooker,
2114                                      "dPhiScVsPt_propVtx",
2115                                      "ele #phi_{sc} - #phi_{tr} vs pt, prop from vertex",
2116                                      pt2D_nbin,
2117                                      0.,
2118                                      pt_max,
2119                                      dphimatch2D_nbin,
2120                                      dphimatch_min,
2121                                      dphimatch_max);
2122   h1_ele_dEtaCl_propOut = bookH1withSumw2(iBooker,
2123                                           "dEtaCl_propOut",
2124                                           "ele #eta_{cl} - #eta_{tr}, prop from outermost",
2125                                           detamatch_nbin,
2126                                           detamatch_min,
2127                                           detamatch_max,
2128                                           "#eta_{seedcl} - #eta_{tr}",
2129                                           "Events",
2130                                           "ELE_LOGY E1 P");
2131   h1_ele_dEtaCl_propOut_barrel = bookH1withSumw2(iBooker,
2132                                                  "dEtaCl_propOut_barrel",
2133                                                  "ele #eta_{cl} - #eta_{tr}, prop from outermost, barrel",
2134                                                  detamatch_nbin,
2135                                                  detamatch_min,
2136                                                  detamatch_max,
2137                                                  "#eta_{seedcl} - #eta_{tr}",
2138                                                  "Events",
2139                                                  "ELE_LOGY E1 P");
2140   h1_ele_dEtaCl_propOut_endcaps = bookH1withSumw2(iBooker,
2141                                                   "dEtaCl_propOut_endcaps",
2142                                                   "ele #eta_{cl} - #eta_{tr}, prop from outermost, endcaps",
2143                                                   detamatch_nbin,
2144                                                   detamatch_min,
2145                                                   detamatch_max,
2146                                                   "#eta_{seedcl} - #eta_{tr}",
2147                                                   "Events",
2148                                                   "ELE_LOGY E1 P");
2149   h2_ele_dEtaClVsEta_propOut = bookH2(iBooker,
2150                                       "dEtaClVsEta_propOut",
2151                                       "ele #eta_{cl} - #eta_{tr} vs eta, prop from out",
2152                                       eta2D_nbin,
2153                                       eta_min,
2154                                       eta_max,
2155                                       detamatch2D_nbin,
2156                                       detamatch_min,
2157                                       detamatch_max);
2158   h2_ele_dEtaClVsPhi_propOut = bookH2(iBooker,
2159                                       "dEtaClVsPhi_propOut",
2160                                       "ele #eta_{cl} - #eta_{tr} vs phi, prop from out",
2161                                       phi2D_nbin,
2162                                       phi_min,
2163                                       phi_max,
2164                                       detamatch2D_nbin,
2165                                       detamatch_min,
2166                                       detamatch_max);
2167   h2_ele_dEtaClVsPt_propOut = bookH2(iBooker,
2168                                      "dEtaScVsPt_propOut",
2169                                      "ele #eta_{cl} - #eta_{tr} vs pt, prop from out",
2170                                      pt2D_nbin,
2171                                      0.,
2172                                      pt_max,
2173                                      detamatch2D_nbin,
2174                                      detamatch_min,
2175                                      detamatch_max);
2176   h1_ele_dPhiCl_propOut = bookH1withSumw2(iBooker,
2177                                           "dPhiCl_propOut",
2178                                           "ele #phi_{cl} - #phi_{tr}, prop from outermost",
2179                                           dphimatch_nbin,
2180                                           dphimatch_min,
2181                                           dphimatch_max,
2182                                           "#phi_{seedcl} - #phi_{tr} (rad)",
2183                                           "Events",
2184                                           "ELE_LOGY E1 P");
2185   h1_ele_dPhiCl_propOut_barrel = bookH1withSumw2(iBooker,
2186                                                  "dPhiCl_propOut_barrel",
2187                                                  "ele #phi_{cl} - #phi_{tr}, prop from outermost, barrel",
2188                                                  dphimatch_nbin,
2189                                                  dphimatch_min,
2190                                                  dphimatch_max,
2191                                                  "#phi_{seedcl} - #phi_{tr} (rad)",
2192                                                  "Events",
2193                                                  "ELE_LOGY E1 P");
2194   h1_ele_dPhiCl_propOut_endcaps = bookH1withSumw2(iBooker,
2195                                                   "dPhiCl_propOut_endcaps",
2196                                                   "ele #phi_{cl} - #phi_{tr}, prop from outermost, endcaps",
2197                                                   dphimatch_nbin,
2198                                                   dphimatch_min,
2199                                                   dphimatch_max,
2200                                                   "#phi_{seedcl} - #phi_{tr} (rad)",
2201                                                   "Events",
2202                                                   "ELE_LOGY E1 P");
2203   h1_ele_dPhiCl_propOut_mAOD = bookH1withSumw2(iBooker,
2204                                                "dPhiCl_propOut_mAOD",
2205                                                "ele #phi_{cl} - #phi_{tr}, prop from outermost",
2206                                                dphimatch_nbin,
2207                                                dphimatch_min,
2208                                                dphimatch_max,
2209                                                "#phi_{seedcl} - #phi_{tr} (rad)",
2210                                                "Events",
2211                                                "ELE_LOGY E1 P");
2212   h1_ele_dPhiCl_propOut_mAOD_barrel = bookH1withSumw2(iBooker,
2213                                                       "dPhiCl_propOut_mAOD_barrel",
2214                                                       "ele #phi_{cl} - #phi_{tr}, prop from outermost, barrel",
2215                                                       dphimatch_nbin,
2216                                                       dphimatch_min,
2217                                                       dphimatch_max,
2218                                                       "#phi_{seedcl} - #phi_{tr} (rad)",
2219                                                       "Events",
2220                                                       "ELE_LOGY E1 P");
2221   h1_ele_dPhiCl_propOut_mAOD_endcaps = bookH1withSumw2(iBooker,
2222                                                        "dPhiCl_propOut_mAOD_endcaps",
2223                                                        "ele #phi_{cl} - #phi_{tr}, prop from outermost, endcaps",
2224                                                        dphimatch_nbin,
2225                                                        dphimatch_min,
2226                                                        dphimatch_max,
2227                                                        "#phi_{seedcl} - #phi_{tr} (rad)",
2228                                                        "Events",
2229                                                        "ELE_LOGY E1 P");
2230   h2_ele_dPhiClVsEta_propOut = bookH2(iBooker,
2231                                       "dPhiClVsEta_propOut",
2232                                       "ele #phi_{cl} - #phi_{tr} vs eta, prop from out",
2233                                       eta2D_nbin,
2234                                       eta_min,
2235                                       eta_max,
2236                                       dphimatch2D_nbin,
2237                                       dphimatch_min,
2238                                       dphimatch_max);
2239   h2_ele_dPhiClVsPhi_propOut = bookH2(iBooker,
2240                                       "dPhiClVsPhi_propOut",
2241                                       "ele #phi_{cl} - #phi_{tr} vs phi, prop from out",
2242                                       phi2D_nbin,
2243                                       phi_min,
2244                                       phi_max,
2245                                       dphimatch2D_nbin,
2246                                       dphimatch_min,
2247                                       dphimatch_max);
2248   h2_ele_dPhiClVsPt_propOut = bookH2(iBooker,
2249                                      "dPhiSClsPt_propOut",
2250                                      "ele #phi_{cl} - #phi_{tr} vs pt, prop from out",
2251                                      pt2D_nbin,
2252                                      0.,
2253                                      pt_max,
2254                                      dphimatch2D_nbin,
2255                                      dphimatch_min,
2256                                      dphimatch_max);
2257   h1_ele_dEtaEleCl_propOut = bookH1withSumw2(iBooker,
2258                                              "dEtaEleCl_propOut",
2259                                              "ele #eta_{EleCl} - #eta_{tr}, prop from outermost",
2260                                              detamatch_nbin,
2261                                              detamatch_min,
2262                                              detamatch_max,
2263                                              "#eta_{elecl} - #eta_{tr}",
2264                                              "Events",
2265                                              "ELE_LOGY E1 P");
2266   h1_ele_dEtaEleCl_propOut_barrel = bookH1withSumw2(iBooker,
2267                                                     "dEtaEleCl_propOut_barrel",
2268                                                     "ele #eta_{EleCl} - #eta_{tr}, prop from outermost, barrel",
2269                                                     detamatch_nbin,
2270                                                     detamatch_min,
2271                                                     detamatch_max,
2272                                                     "#eta_{elecl} - #eta_{tr}",
2273                                                     "Events",
2274                                                     "ELE_LOGY E1 P");
2275   h1_ele_dEtaEleCl_propOut_endcaps = bookH1withSumw2(iBooker,
2276                                                      "dEtaEleCl_propOut_endcaps",
2277                                                      "ele #eta_{EleCl} - #eta_{tr}, prop from outermost, endcaps",
2278                                                      detamatch_nbin,
2279                                                      detamatch_min,
2280                                                      detamatch_max,
2281                                                      "#eta_{elecl} - #eta_{tr}",
2282                                                      "Events",
2283                                                      "ELE_LOGY E1 P");
2284   h2_ele_dEtaEleClVsEta_propOut = bookH2(iBooker,
2285                                          "dEtaEleClVsEta_propOut",
2286                                          "ele #eta_{EleCl} - #eta_{tr} vs eta, prop from out",
2287                                          eta2D_nbin,
2288                                          eta_min,
2289                                          eta_max,
2290                                          detamatch2D_nbin,
2291                                          detamatch_min,
2292                                          detamatch_max);
2293   h2_ele_dEtaEleClVsPhi_propOut = bookH2(iBooker,
2294                                          "dEtaEleClVsPhi_propOut",
2295                                          "ele #eta_{EleCl} - #eta_{tr} vs phi, prop from out",
2296                                          phi2D_nbin,
2297                                          phi_min,
2298                                          phi_max,
2299                                          detamatch2D_nbin,
2300                                          detamatch_min,
2301                                          detamatch_max);
2302   h2_ele_dEtaEleClVsPt_propOut = bookH2(iBooker,
2303                                         "dEtaScVsPt_propOut",
2304                                         "ele #eta_{EleCl} - #eta_{tr} vs pt, prop from out",
2305                                         pt2D_nbin,
2306                                         0.,
2307                                         pt_max,
2308                                         detamatch2D_nbin,
2309                                         detamatch_min,
2310                                         detamatch_max);
2311   h1_ele_dPhiEleCl_propOut = bookH1withSumw2(iBooker,
2312                                              "dPhiEleCl_propOut",
2313                                              "ele #phi_{EleCl} - #phi_{tr}, prop from outermost",
2314                                              dphimatch_nbin,
2315                                              dphimatch_min,
2316                                              dphimatch_max,
2317                                              "#phi_{elecl} - #phi_{tr} (rad)",
2318                                              "Events",
2319                                              "ELE_LOGY E1 P");
2320   h1_ele_dPhiEleCl_propOut_barrel = bookH1withSumw2(iBooker,
2321                                                     "dPhiEleCl_propOut_barrel",
2322                                                     "ele #phi_{EleCl} - #phi_{tr}, prop from outermost, barrel",
2323                                                     dphimatch_nbin,
2324                                                     dphimatch_min,
2325                                                     dphimatch_max,
2326                                                     "#phi_{elecl} - #phi_{tr} (rad)",
2327                                                     "Events",
2328                                                     "ELE_LOGY E1 P");
2329   h1_ele_dPhiEleCl_propOut_endcaps = bookH1withSumw2(iBooker,
2330                                                      "dPhiEleCl_propOut_endcaps",
2331                                                      "ele #phi_{EleCl} - #phi_{tr}, prop from outermost, endcaps",
2332                                                      dphimatch_nbin,
2333                                                      dphimatch_min,
2334                                                      dphimatch_max,
2335                                                      "#phi_{elecl} - #phi_{tr} (rad)",
2336                                                      "Events",
2337                                                      "ELE_LOGY E1 P");
2338   h2_ele_dPhiEleClVsEta_propOut = bookH2(iBooker,
2339                                          "dPhiEleClVsEta_propOut",
2340                                          "ele #phi_{EleCl} - #phi_{tr} vs eta, prop from out",
2341                                          eta2D_nbin,
2342                                          eta_min,
2343                                          eta_max,
2344                                          dphimatch2D_nbin,
2345                                          dphimatch_min,
2346                                          dphimatch_max);
2347   h2_ele_dPhiEleClVsPhi_propOut = bookH2(iBooker,
2348                                          "dPhiEleClVsPhi_propOut",
2349                                          "ele #phi_{EleCl} - #phi_{tr} vs phi, prop from out",
2350                                          phi2D_nbin,
2351                                          phi_min,
2352                                          phi_max,
2353                                          dphimatch2D_nbin,
2354                                          dphimatch_min,
2355                                          dphimatch_max);
2356   h2_ele_dPhiEleClVsPt_propOut = bookH2(iBooker,
2357                                         "dPhiSEleClsPt_propOut",
2358                                         "ele #phi_{EleCl} - #phi_{tr} vs pt, prop from out",
2359                                         pt2D_nbin,
2360                                         0.,
2361                                         pt_max,
2362                                         dphimatch2D_nbin,
2363                                         dphimatch_min,
2364                                         dphimatch_max);
2365   h1_ele_HoE = bookH1withSumw2(
2366       iBooker, "HoE", "ele hadronic energy / em energy", hoe_nbin, hoe_min, hoe_max, "H/E", "Events", "ELE_LOGY E1 P");
2367   h1_ele_HoE_Extended = bookH1withSumw2(iBooker,
2368                                         "HoE_Extended",
2369                                         "ele hadronic energy / em energy, 2.5<|eta|<3",
2370                                         hoe_nbin,
2371                                         hoe_min,
2372                                         hoe_max,
2373                                         "H/E",
2374                                         "Events",
2375                                         "ELE_LOGY E1 P");
2376   h1_ele_HoE_barrel = bookH1withSumw2(iBooker,
2377                                       "HoE_barrel",
2378                                       "ele hadronic energy / em energy, barrel",
2379                                       hoe_nbin,
2380                                       hoe_min,
2381                                       hoe_max,
2382                                       "H/E",
2383                                       "Events",
2384                                       "ELE_LOGY E1 P");
2385   h1_ele_HoE_endcaps = bookH1withSumw2(iBooker,
2386                                        "HoE_endcaps",
2387                                        "ele hadronic energy / em energy, endcaps",
2388                                        hoe_nbin,
2389                                        hoe_min,
2390                                        hoe_max,
2391                                        "H/E",
2392                                        "Events",
2393                                        "ELE_LOGY E1 P");
2394   h1_ele_HoE_mAOD = bookH1withSumw2(iBooker,
2395                                     "HoE_mAOD",
2396                                     "ele hadronic energy / em energy",
2397                                     hoe_nbin,
2398                                     hoe_min,
2399                                     hoe_max,
2400                                     "H/E",
2401                                     "Events",
2402                                     "ELE_LOGY E1 P");
2403   h1_ele_HoE_mAOD_barrel = bookH1withSumw2(iBooker,
2404                                            "HoE_mAOD_barrel",
2405                                            "ele hadronic energy / em energy, barrel",
2406                                            hoe_nbin,
2407                                            hoe_min,
2408                                            hoe_max,
2409                                            "H/E",
2410                                            "Events",
2411                                            "ELE_LOGY E1 P");
2412   h1_ele_HoE_mAOD_endcaps = bookH1withSumw2(iBooker,
2413                                             "HoE_mAOD_endcaps",
2414                                             "ele hadronic energy / em energy, endcaps",
2415                                             hoe_nbin,
2416                                             hoe_min,
2417                                             hoe_max,
2418                                             "H/E",
2419                                             "Events",
2420                                             "ELE_LOGY E1 P");
2421   h1_ele_HoE_bc = bookH1withSumw2(iBooker,
2422                                   "HoE_bc",
2423                                   "ele hadronic energy / em energy behind cluster",
2424                                   hoe_nbin,
2425                                   hoe_min,
2426                                   hoe_max,
2427                                   "H/E",
2428                                   "Events",
2429                                   "ELE_LOGY E1 P");
2430   h1_ele_HoE_bc_barrel = bookH1withSumw2(iBooker,
2431                                          "HoE_bc_barrel",
2432                                          "ele hadronic energy / em energy, behind cluster barrel",
2433                                          hoe_nbin,
2434                                          hoe_min,
2435                                          hoe_max,
2436                                          "H/E",
2437                                          "Events",
2438                                          "ELE_LOGY E1 P");
2439   h1_ele_HoE_bc_endcaps = bookH1withSumw2(iBooker,
2440                                           "HoE_bc_endcaps",
2441                                           "ele hadronic energy / em energy, behind cluster, endcaps",
2442                                           hoe_nbin,
2443                                           hoe_min,
2444                                           hoe_max,
2445                                           "H/E",
2446                                           "Events",
2447                                           "ELE_LOGY E1 P");
2448   h1_ele_hcalDepth1OverEcalBc = bookH1withSumw2(iBooker,
2449                                                 "hcalDepth1OverEcalBc",
2450                                                 "hcalDepth1OverEcalBc",
2451                                                 hoe_nbin,
2452                                                 hoe_min,
2453                                                 hoe_max,
2454                                                 "H/E",
2455                                                 "Events",
2456                                                 "ELE_LOGY E1 P");
2457   h1_ele_hcalDepth1OverEcalBc_barrel = bookH1withSumw2(iBooker,
2458                                                        "hcalDepth1OverEcalBc_barrel",
2459                                                        "hcalDepth1OverEcalBc_barrel",
2460                                                        hoe_nbin,
2461                                                        hoe_min,
2462                                                        hoe_max,
2463                                                        "H/E",
2464                                                        "Events",
2465                                                        "ELE_LOGY E1 P");
2466   h1_ele_hcalDepth1OverEcalBc_endcaps = bookH1withSumw2(iBooker,
2467                                                         "hcalDepth1OverEcalBc_endcaps",
2468                                                         "hcalDepth1OverEcalBc_endcaps",
2469                                                         hoe_nbin,
2470                                                         hoe_min,
2471                                                         hoe_max,
2472                                                         "H/E",
2473                                                         "Events",
2474                                                         "ELE_LOGY E1 P");
2475   h1_ele_hcalDepth2OverEcalBc = bookH1withSumw2(iBooker,
2476                                                 "hcalDepth2OverEcalBc",
2477                                                 "hcalDepth2OverEcalBc",
2478                                                 hoe_nbin,
2479                                                 hoe_min,
2480                                                 hoe_max,
2481                                                 "H/E",
2482                                                 "Events",
2483                                                 "ELE_LOGY E1 P");
2484   h1_ele_hcalDepth2OverEcalBc_barrel = bookH1withSumw2(iBooker,
2485                                                        "hcalDepth2OverEcalBc_barrel",
2486                                                        "hcalDepth2OverEcalBc_barrel",
2487                                                        hoe_nbin,
2488                                                        hoe_min,
2489                                                        hoe_max,
2490                                                        "H/E",
2491                                                        "Events",
2492                                                        "ELE_LOGY E1 P");
2493   h1_ele_hcalDepth2OverEcalBc_endcaps = bookH1withSumw2(iBooker,
2494                                                         "hcalDepth2OverEcalBc_endcaps",
2495                                                         "hcalDepth2OverEcalBc_endcaps",
2496                                                         hoe_nbin,
2497                                                         hoe_min,
2498                                                         hoe_max,
2499                                                         "H/E",
2500                                                         "Events",
2501                                                         "ELE_LOGY E1 P");
2502 
2503   h1_ele_HoE_fiducial = bookH1withSumw2(iBooker,
2504                                         "HoE_fiducial",
2505                                         "ele hadronic energy / em energy, fiducial region",
2506                                         hoe_nbin,
2507                                         hoe_min,
2508                                         hoe_max,
2509                                         "H/E",
2510                                         "Events",
2511                                         "ELE_LOGY E1 P");
2512   h2_ele_HoEVsEta = bookH2(iBooker,
2513                            "HoEVsEta",
2514                            "ele hadronic energy / em energy vs eta",
2515                            eta_nbin,
2516                            eta_min,
2517                            eta_max,
2518                            hoe_nbin,
2519                            hoe_min,
2520                            hoe_max);
2521   h2_ele_HoEVsPhi = bookH2(iBooker,
2522                            "HoEVsPhi",
2523                            "ele hadronic energy / em energy vs phi",
2524                            phi2D_nbin,
2525                            phi_min,
2526                            phi_max,
2527                            hoe_nbin,
2528                            hoe_min,
2529                            hoe_max);
2530   h2_ele_HoEVsE =
2531       bookH2(iBooker, "HoEVsE", "ele hadronic energy / em energy vs E", p_nbin, 0., 300., hoe_nbin, hoe_min, hoe_max);
2532 
2533   // seeds
2534   h1_ele_seed_subdet2 =
2535       bookH1withSumw2(iBooker, "seedSubdet2", "ele seed subdet 2nd layer", 11, -0.5, 10.5, "2nd hit subdet Id");
2536   h1_ele_seed_mask = bookH1withSumw2(iBooker, "seedMask", "ele seed hits mask", 13, -0.5, 12.5);
2537   h1_ele_seed_mask_bpix =
2538       bookH1withSumw2(iBooker, "seedMask_Bpix", "ele seed hits mask when subdet2 is bpix", 13, -0.5, 12.5);
2539   h1_ele_seed_mask_fpix =
2540       bookH1withSumw2(iBooker, "seedMask_Fpix", "ele seed hits mask when subdet2 is fpix", 13, -0.5, 12.5);
2541   h1_ele_seed_mask_tec =
2542       bookH1withSumw2(iBooker, "seedMask_Tec", "ele seed hits mask when subdet2 is tec", 13, -0.5, 12.5);
2543   h1_ele_seed_dphi2 = bookH1withSumw2(
2544       iBooker, "seedDphi2", "ele seed dphi 2nd layer", 50, -0.010, +0.010, "#phi_{hit}-#phi_{pred} (rad)");
2545   h2_ele_seed_dphi2VsEta = bookH2(
2546       iBooker, "seedDphi2_VsEta", "ele seed dphi 2nd layer vs eta", eta2D_nbin, eta_min, eta_max, 50, -0.003, +0.003);
2547   h2_ele_seed_dphi2VsPt =
2548       bookH2(iBooker, "seedDphi2_VsPt", "ele seed dphi 2nd layer vs pt", pt2D_nbin, 0., pt_max, 50, -0.003, +0.003);
2549   h1_ele_seed_dphi2pos = bookH1withSumw2(
2550       iBooker, "seedDphi2Pos", "ele seed dphi 2nd layer positron", 50, -0.010, +0.010, "#phi_{hit}-#phi_{pred} (rad)");
2551   h2_ele_seed_dphi2posVsEta = bookH2(iBooker,
2552                                      "seedDphi2Pos_VsEta",
2553                                      "ele seed dphi 2nd layer positron vs eta",
2554                                      eta2D_nbin,
2555                                      eta_min,
2556                                      eta_max,
2557                                      50,
2558                                      -0.003,
2559                                      +0.003);
2560   h2_ele_seed_dphi2posVsPt = bookH2(
2561       iBooker, "seedDphi2Pos_VsPt", "ele seed dphi 2nd layer positron vs pt", pt2D_nbin, 0., pt_max, 50, -0.003, +0.003);
2562   h1_ele_seed_drz2 = bookH1withSumw2(
2563       iBooker, "seedDrz2", "ele seed dr (dz) 2nd layer", 50, -0.03, +0.03, "r(z)_{hit}-r(z)_{pred} (cm)");
2564   h2_ele_seed_drz2VsEta = bookH2(
2565       iBooker, "seedDrz2_VsEta", "ele seed dr/dz 2nd layer vs eta", eta2D_nbin, eta_min, eta_max, 50, -0.03, +0.03);
2566   h2_ele_seed_drz2VsPt =
2567       bookH2(iBooker, "seedDrz2_VsPt", "ele seed dr/dz 2nd layer vs pt", pt2D_nbin, 0., pt_max, 50, -0.03, +0.03);
2568   h1_ele_seed_drz2pos = bookH1withSumw2(
2569       iBooker, "seedDrz2Pos", "ele seed dr (dz) 2nd layer positron", 50, -0.03, +0.03, "r(z)_{hit}-r(z)_{pred} (cm)");
2570   h2_ele_seed_drz2posVsEta = bookH2(iBooker,
2571                                     "seedDrz2Pos_VsEta",
2572                                     "ele seed dr/dz 2nd layer positron vs eta",
2573                                     eta2D_nbin,
2574                                     eta_min,
2575                                     eta_max,
2576                                     50,
2577                                     -0.03,
2578                                     +0.03);
2579   h2_ele_seed_drz2posVsPt = bookH2(
2580       iBooker, "seedDrz2Pos_VsPt", "ele seed dr/dz 2nd layer positron vs pt", pt2D_nbin, 0., pt_max, 50, -0.03, +0.03);
2581 
2582   // classes
2583   h1_ele_classes = bookH1withSumw2(iBooker, "classes", "ele classes", 20, 0.0, 20., "class Id");
2584   h1_ele_eta = bookH1withSumw2(iBooker, "eta", "ele electron eta", eta_nbin / 2, 0.0, eta_max);
2585   h1_ele_eta_golden = bookH1withSumw2(iBooker, "eta_golden", "ele electron eta golden", eta_nbin / 2, 0.0, eta_max);
2586   h1_ele_eta_bbrem = bookH1withSumw2(iBooker, "eta_bbrem", "ele electron eta bbrem", eta_nbin / 2, 0.0, eta_max);
2587   h1_ele_eta_shower = bookH1withSumw2(iBooker, "eta_shower", "ele electron eta showering", eta_nbin / 2, 0.0, eta_max);
2588   h2_ele_PinVsPoutGolden_mode = bookH2(iBooker,
2589                                        "PinVsPoutGolden_mode",
2590                                        "ele track inner p vs outer p vs eta, golden, mode of GSF components",
2591                                        p2D_nbin,
2592                                        0.,
2593                                        p_max,
2594                                        50,
2595                                        0.,
2596                                        p_max);
2597   h2_ele_PinVsPoutShowering_mode = bookH2(iBooker,
2598                                           "PinVsPoutShowering_mode",
2599                                           "ele track inner p vs outer p vs eta, showering, mode of GSF components",
2600                                           p2D_nbin,
2601                                           0.,
2602                                           p_max,
2603                                           50,
2604                                           0.,
2605                                           p_max);
2606   h2_ele_PinVsPoutGolden_mean = bookH2(iBooker,
2607                                        "PinVsPoutGolden_mean",
2608                                        "ele track inner p vs outer p vs eta, golden, mean of GSF components",
2609                                        p2D_nbin,
2610                                        0.,
2611                                        p_max,
2612                                        50,
2613                                        0.,
2614                                        p_max);
2615   h2_ele_PinVsPoutShowering_mean = bookH2(iBooker,
2616                                           "PinVsPoutShowering_mean",
2617                                           "ele track inner p vs outer p vs eta, showering, mean of GSF components",
2618                                           p2D_nbin,
2619                                           0.,
2620                                           p_max,
2621                                           50,
2622                                           0.,
2623                                           p_max);
2624   h2_ele_PtinVsPtoutGolden_mode = bookH2(iBooker,
2625                                          "PtinVsPtoutGolden_mode",
2626                                          "ele track inner pt vs outer pt vs eta, golden, mode of GSF components",
2627                                          pt2D_nbin,
2628                                          0.,
2629                                          pt_max,
2630                                          50,
2631                                          0.,
2632                                          pt_max);
2633   h2_ele_PtinVsPtoutShowering_mode = bookH2(iBooker,
2634                                             "PtinVsPtoutShowering_mode",
2635                                             "ele track inner pt vs outer pt vs eta, showering, mode of GSF components",
2636                                             pt2D_nbin,
2637                                             0.,
2638                                             pt_max,
2639                                             50,
2640                                             0.,
2641                                             pt_max);
2642   h2_ele_PtinVsPtoutGolden_mean = bookH2(iBooker,
2643                                          "PtinVsPtoutGolden_mean",
2644                                          "ele track inner pt vs outer pt vs eta, golden, mean of GSF components",
2645                                          pt2D_nbin,
2646                                          0.,
2647                                          pt_max,
2648                                          50,
2649                                          0.,
2650                                          pt_max);
2651   h2_ele_PtinVsPtoutShowering_mean = bookH2(iBooker,
2652                                             "PtinVsPtoutShowering_mean",
2653                                             "ele track inner pt vs outer pt vs eta, showering, mean of GSF components",
2654                                             pt2D_nbin,
2655                                             0.,
2656                                             pt_max,
2657                                             50,
2658                                             0.,
2659                                             pt_max);
2660   setBookPrefix("h_scl");
2661   h1_scl_EoEtrueGolden_barrel = bookH1withSumw2(iBooker,
2662                                                 "EoEtrue_golden_barrel",
2663                                                 "ele supercluster energy / gen energy, golden, barrel",
2664                                                 poptrue_nbin,
2665                                                 poptrue_min,
2666                                                 poptrue_max);
2667   h1_scl_EoEtrueGolden_endcaps = bookH1withSumw2(iBooker,
2668                                                  "EoEtrue_golden_endcaps",
2669                                                  "ele supercluster energy / gen energy, golden, endcaps",
2670                                                  poptrue_nbin,
2671                                                  poptrue_min,
2672                                                  poptrue_max);
2673   h1_scl_EoEtrueShowering_barrel = bookH1withSumw2(iBooker,
2674                                                    "EoEtrue_showering_barrel",
2675                                                    "ele supercluster energy / gen energy, showering, barrel",
2676                                                    poptrue_nbin,
2677                                                    poptrue_min,
2678                                                    poptrue_max);
2679   h1_scl_EoEtrueShowering_endcaps = bookH1withSumw2(iBooker,
2680                                                     "EoEtrue_showering_endcaps",
2681                                                     "ele supercluster energy / gen energy, showering, endcaps",
2682                                                     poptrue_nbin,
2683                                                     poptrue_min,
2684                                                     poptrue_max);
2685 
2686   // isolation
2687   setBookPrefix("h_ele");
2688   h1_ele_tkSumPt_dr03 = bookH1withSumw2(iBooker,
2689                                         "tkSumPt_dr03",
2690                                         "tk isolation sum, dR=0.3",
2691                                         100,
2692                                         0.0,
2693                                         20.,
2694                                         "TkIsoSum, cone 0.3 (GeV/c)",
2695                                         "Events",
2696                                         "ELE_LOGY E1 P");
2697   h1_ele_tkSumPt_dr03_barrel = bookH1withSumw2(iBooker,
2698                                                "tkSumPt_dr03_barrel",
2699                                                "tk isolation sum, dR=0.3, barrel",
2700                                                100,
2701                                                0.0,
2702                                                20.,
2703                                                "TkIsoSum, cone 0.3 (GeV/c)",
2704                                                "Events",
2705                                                "ELE_LOGY E1 P");
2706   h1_ele_tkSumPt_dr03_endcaps = bookH1withSumw2(iBooker,
2707                                                 "tkSumPt_dr03_endcaps",
2708                                                 "tk isolation sum, dR=0.3, endcaps",
2709                                                 100,
2710                                                 0.0,
2711                                                 20.,
2712                                                 "TkIsoSum, cone 0.3 (GeV/c)",
2713                                                 "Events",
2714                                                 "ELE_LOGY E1 P");
2715   h1_ele_ecalRecHitSumEt_dr03 = bookH1withSumw2(iBooker,
2716                                                 "ecalRecHitSumEt_dr03",
2717                                                 "ecal isolation sum, dR=0.3",
2718                                                 100,
2719                                                 0.0,
2720                                                 20.,
2721                                                 "EcalIsoSum, cone 0.3 (GeV)",
2722                                                 "Events",
2723                                                 "ELE_LOGY E1 P");
2724   h1_ele_ecalRecHitSumEt_dr03_barrel = bookH1withSumw2(iBooker,
2725                                                        "ecalRecHitSumEt_dr03_barrel",
2726                                                        "ecal isolation sum, dR=0.3, barrel",
2727                                                        100,
2728                                                        0.0,
2729                                                        20.,
2730                                                        "EcalIsoSum, cone 0.3 (GeV)",
2731                                                        "Events",
2732                                                        "ELE_LOGY E1 P");
2733   h1_ele_ecalRecHitSumEt_dr03_endcaps = bookH1withSumw2(iBooker,
2734                                                         "ecalRecHitSumEt_dr03_endcaps",
2735                                                         "ecal isolation sum, dR=0.3, endcaps",
2736                                                         100,
2737                                                         0.0,
2738                                                         20.,
2739                                                         "EcalIsoSum, cone 0.3 (GeV)",
2740                                                         "Events",
2741                                                         "ELE_LOGY E1 P");
2742   h1_ele_hcalTowerSumEt_dr03_depth1 = bookH1withSumw2(iBooker,
2743                                                       "hcalTowerSumEt_dr03_depth1",
2744                                                       "hcal depth1 isolation sum, dR=0.3",
2745                                                       100,
2746                                                       0.0,
2747                                                       20.,
2748                                                       "Hcal1IsoSum, cone 0.3 (GeV)",
2749                                                       "Events",
2750                                                       "ELE_LOGY E1 P");
2751   h1_ele_hcalTowerSumEt_dr03_depth1_barrel = bookH1withSumw2(iBooker,
2752                                                              "hcalTowerSumEt_dr03_depth1_barrel",
2753                                                              "hcal depth1 isolation sum, dR=0.3, barrel",
2754                                                              100,
2755                                                              0.0,
2756                                                              20.,
2757                                                              "Hcal1IsoSum, cone 0.3 (GeV)",
2758                                                              "Events",
2759                                                              "ELE_LOGY E1 P");
2760   h1_ele_hcalTowerSumEt_dr03_depth1_endcaps = bookH1withSumw2(iBooker,
2761                                                               "hcalTowerSumEt_dr03_depth1_endcaps",
2762                                                               "hcal depth1 isolation sum, dR=0.3, endcaps",
2763                                                               100,
2764                                                               0.0,
2765                                                               20.,
2766                                                               "Hcal1IsoSum, cone 0.3 (GeV)",
2767                                                               "Events",
2768                                                               "ELE_LOGY E1 P");
2769   h1_ele_hcalTowerSumEt_dr03_depth2 = bookH1withSumw2(iBooker,
2770                                                       "hcalTowerSumEt_dr03_depth2",
2771                                                       "hcal depth2 isolation sum, dR=0.3",
2772                                                       100,
2773                                                       0.0,
2774                                                       20.,
2775                                                       "Hcal2IsoSum, cone 0.3 (GeV)",
2776                                                       "Events",
2777                                                       "ELE_LOGY E1 P");
2778   h1_ele_hcalTowerSumEt_dr03_depth2_barrel = bookH1withSumw2(iBooker,
2779                                                              "hcalTowerSumEt_dr03_depth2_barrel",
2780                                                              "hcal depth2 isolation sum, dR=0.3",
2781                                                              100,
2782                                                              0.0,
2783                                                              20.,
2784                                                              "Hcal2IsoSum, cone 0.3 (GeV)",
2785                                                              "Events",
2786                                                              "ELE_LOGY E1 P");
2787   h1_ele_hcalTowerSumEt_dr03_depth2_endcaps = bookH1withSumw2(iBooker,
2788                                                               "hcalTowerSumEt_dr03_depth2_endcaps",
2789                                                               "hcal depth2 isolation sum, dR=0.3",
2790                                                               100,
2791                                                               0.0,
2792                                                               20.,
2793                                                               "Hcal2IsoSum, cone 0.3 (GeV)",
2794                                                               "Events",
2795                                                               "ELE_LOGY E1 P");
2796 
2797   // newHCAL
2798   // isolation new hcal
2799   h1_ele_hcalTowerSumEtBc_dr03_depth1 = bookH1withSumw2(iBooker,
2800                                                         "hcalTowerSumEtBc_dr03_depth1",
2801                                                         "hcal depth1 isolation sum behind cluster, dR=0.3",
2802                                                         100,
2803                                                         0.0,
2804                                                         20.,
2805                                                         "Hcal1IsoSum, cone 0.3 (GeV)",
2806                                                         "Events",
2807                                                         "ELE_LOGY E1 P");
2808   h1_ele_hcalTowerSumEtBc_dr03_depth1_barrel =
2809       bookH1withSumw2(iBooker,
2810                       "hcalTowerSumEtBc_dr03_depth1_barrel",
2811                       "hcal depth1 isolation sum behind cluster, dR=0.3, barrel",
2812                       100,
2813                       0.0,
2814                       20.,
2815                       "Hcal1IsoSum, cone 0.3 (GeV)",
2816                       "Events",
2817                       "ELE_LOGY E1 P");
2818   h1_ele_hcalTowerSumEtBc_dr03_depth1_endcaps =
2819       bookH1withSumw2(iBooker,
2820                       "hcalTowerSumEtBc_dr03_depth1_endcaps",
2821                       "hcal depth1 isolation sum behind cluster, dR=0.3, endcaps",
2822                       100,
2823                       0.0,
2824                       20.,
2825                       "Hcal1IsoSum, cone 0.3 (GeV)",
2826                       "Events",
2827                       "ELE_LOGY E1 P");
2828 
2829   h1_ele_hcalTowerSumEtBc_dr03_depth2 = bookH1withSumw2(iBooker,
2830                                                         "hcalTowerSumEtBc_dr03_depth2",
2831                                                         "hcal depth2 isolation sum behind cluster, dR=0.3",
2832                                                         100,
2833                                                         0.0,
2834                                                         20.,
2835                                                         "Hcal1IsoSum, cone 0.3 (GeV)",
2836                                                         "Events",
2837                                                         "ELE_LOGY E1 P");
2838   h1_ele_hcalTowerSumEtBc_dr03_depth2_barrel =
2839       bookH1withSumw2(iBooker,
2840                       "hcalTowerSumEtBc_dr03_depth2_barrel",
2841                       "hcal depth2 isolation sum behind cluster, dR=0.3, barrel",
2842                       100,
2843                       0.0,
2844                       20.,
2845                       "Hcal1IsoSum, cone 0.3 (GeV)",
2846                       "Events",
2847                       "ELE_LOGY E1 P");
2848   h1_ele_hcalTowerSumEtBc_dr03_depth2_endcaps =
2849       bookH1withSumw2(iBooker,
2850                       "hcalTowerSumEtBc_dr03_depth2_endcaps",
2851                       "hcal depth2 isolation sum behind cluster, dR=0.3, endcaps",
2852                       100,
2853                       0.0,
2854                       20.,
2855                       "Hcal1IsoSum, cone 0.3 (GeV)",
2856                       "Events",
2857                       "ELE_LOGY E1 P");
2858 
2859   h1_ele_ecalPFClusterIso = bookH1withSumw2(iBooker,
2860                                             "ecalPFClusterIso",
2861                                             "ecal PF Cluster Iso",
2862                                             100,
2863                                             0.0,
2864                                             100.,
2865                                             "hcal PF Cluser Iso",
2866                                             "Events",
2867                                             "ELE_LOGY E1 P");
2868   h1_ele_ecalPFClusterIso_barrel = bookH1withSumw2(iBooker,
2869                                                    "ecalPFClusterIso_barrel",
2870                                                    "ecal PF Cluster Iso barrel",
2871                                                    100,
2872                                                    0.0,
2873                                                    100.,
2874                                                    "hcal PF Cluser Iso",
2875                                                    "Events",
2876                                                    "ELE_LOGY E1 P");
2877   h1_ele_ecalPFClusterIso_endcaps = bookH1withSumw2(iBooker,
2878                                                     "ecalPFClusterIso_endcaps",
2879                                                     "ecal PF Cluster Iso endcaps",
2880                                                     100,
2881                                                     0.0,
2882                                                     100.,
2883                                                     "hcal PF Cluser Iso",
2884                                                     "Events",
2885                                                     "ELE_LOGY E1 P");
2886   h1_ele_hcalPFClusterIso = bookH1withSumw2(iBooker,
2887                                             "hcalPFClusterIso",
2888                                             "hcal PF Cluster Iso",
2889                                             100,
2890                                             0.0,
2891                                             100.,
2892                                             "hcal PF Cluser Iso",
2893                                             "Events",
2894                                             "ELE_LOGY E1 P");
2895   h1_ele_hcalPFClusterIso_barrel = bookH1withSumw2(iBooker,
2896                                                    "hcalPFClusterIso_barrel",
2897                                                    "hcal PF Cluster Iso barrel",
2898                                                    100,
2899                                                    0.0,
2900                                                    100.,
2901                                                    "hcal PF Cluser Iso",
2902                                                    "Events",
2903                                                    "ELE_LOGY E1 P");
2904   h1_ele_hcalPFClusterIso_endcaps = bookH1withSumw2(iBooker,
2905                                                     "hcalPFClusterIso_endcaps",
2906                                                     "hcal PF Cluster Iso endcaps",
2907                                                     100,
2908                                                     0.0,
2909                                                     100.,
2910                                                     "hcal PF Cluser Iso",
2911                                                     "Events",
2912                                                     "ELE_LOGY E1 P");
2913   h1_ele_ecalPFClusterIso_Extended = bookH1withSumw2(iBooker,
2914                                                      "ecalPFClusterIso_Extended",
2915                                                      "ecal PF Cluster Iso Extended",
2916                                                      100,
2917                                                      0.0,
2918                                                      100.,
2919                                                      "hcal PF Cluser Iso Extended, 2.5<|eta|<3",
2920                                                      "Events",
2921                                                      "ELE_LOGY E1 P");
2922   h1_ele_hcalPFClusterIso_Extended = bookH1withSumw2(iBooker,
2923                                                      "hcalPFClusterIso_Extended",
2924                                                      "hcal PF Cluster Iso Extended",
2925                                                      100,
2926                                                      0.0,
2927                                                      100.,
2928                                                      "hcal PF Cluser Iso Extended, 2.5<|eta|<3",
2929                                                      "Events",
2930                                                      "ELE_LOGY E1 P");
2931 
2932   // fbrem
2933   h1_ele_fbrem = bookH1withSumw2(
2934       iBooker, "fbrem", "ele brem fraction, mode of GSF components", 100, 0., 1., "P_{in} - P_{out} / P_{in}");
2935   h1_ele_fbrem_Extended = bookH1withSumw2(iBooker,
2936                                           "fbrem_Extended",
2937                                           "ele brem fraction, mode of GSF components, 2.5<|eta|<3",
2938                                           100,
2939                                           0.,
2940                                           1.,
2941                                           "P_{in} - P_{out} / P_{in}");
2942   h1_ele_fbrem_barrel = bookH1withSumw2(iBooker,
2943                                         "fbrem_barrel",
2944                                         "ele brem fraction for barrel, mode of GSF components",
2945                                         100,
2946                                         0.,
2947                                         1.,
2948                                         "P_{in} - P_{out} / P_{in}");
2949   h1_ele_fbrem_endcaps = bookH1withSumw2(iBooker,
2950                                          "fbrem_endcaps",
2951                                          "ele brem franction for endcaps, mode of GSF components",
2952                                          100,
2953                                          0.,
2954                                          1.,
2955                                          "P_{in} - P_{out} / P_{in}");
2956   h1_ele_fbrem_mAOD = bookH1withSumw2(
2957       iBooker, "fbrem_mAOD", "ele brem fraction, mode of GSF components", 100, 0., 1., "P_{in} - P_{out} / P_{in}");
2958   h1_ele_fbrem_mAOD_barrel = bookH1withSumw2(iBooker,
2959                                              "fbrem_mAOD_barrel",
2960                                              "ele brem fraction for barrel, mode of GSF components",
2961                                              100,
2962                                              0.,
2963                                              1.,
2964                                              "P_{in} - P_{out} / P_{in}");
2965   h1_ele_fbrem_mAOD_endcaps = bookH1withSumw2(iBooker,
2966                                               "fbrem_mAOD_endcaps",
2967                                               "ele brem franction for endcaps, mode of GSF components",
2968                                               100,
2969                                               0.,
2970                                               1.,
2971                                               "P_{in} - P_{out} / P_{in}");
2972   h1_ele_superclusterfbrem =
2973       bookH1withSumw2(iBooker, "superclusterfbrem", "supercluster brem fraction", 100, 0., 1., "1 - E_{ele} / E_{SC}");
2974   h1_ele_superclusterfbrem_barrel = bookH1withSumw2(
2975       iBooker, "superclusterfbrem_barrel", "supercluster brem fraction for barrel", 100, 0., 1., "1 - E_{ele} / E_{SC}");
2976   h1_ele_superclusterfbrem_endcaps = bookH1withSumw2(iBooker,
2977                                                      "superclusterfbrem_endcaps",
2978                                                      "supercluster brem franction for endcaps",
2979                                                      100,
2980                                                      0.,
2981                                                      1.,
2982                                                      "1 - E_{ele} / E_{SC}");
2983   p1_ele_fbremVsEta_mode = bookP1(iBooker,
2984                                   "fbremvsEtamode",
2985                                   "mean ele brem fraction vs eta, mode of GSF components",
2986                                   eta2D_nbin,
2987                                   eta_min,
2988                                   eta_max,
2989                                   0.,
2990                                   1.,
2991                                   "#eta",
2992                                   "<P_{in} - P_{out} / P_{in}>");
2993   p1_ele_fbremVsEta_mean = bookP1(iBooker,
2994                                   "fbremvsEtamean",
2995                                   "mean ele brem fraction vs eta, mean of GSF components",
2996                                   eta2D_nbin,
2997                                   eta_min,
2998                                   eta_max,
2999                                   0.,
3000                                   1.,
3001                                   "#eta",
3002                                   "<P_{in} - P_{out} / P_{in}>");
3003   h1_ele_chargeInfo = bookH1withSumw2(iBooker, "chargeInfo", "chargeInfo", 5, -2., 3.);
3004 
3005   // e/g et pflow electrons
3006   h1_ele_mva = bookH1withSumw2(iBooker, "mva", "ele identification mva", 100, -1., 1.);
3007   h1_ele_mva_barrel = bookH1withSumw2(iBooker, "mva_barrel", "ele identification mva barrel", 100, -1., 1.);
3008   h1_ele_mva_endcaps = bookH1withSumw2(iBooker, "mva_endcaps", "ele identification mva endcaps", 100, -1., 1.);
3009   h1_ele_mva_isolated = bookH1withSumw2(iBooker, "mva_isolated", "ele identification mva isolated", 100, -1., 1.);
3010   h1_ele_mva_barrel_isolated =
3011       bookH1withSumw2(iBooker, "mva_isolated_barrel", "ele identification mva isolated barrel", 100, -1., 1.);
3012   h1_ele_mva_endcaps_isolated =
3013       bookH1withSumw2(iBooker, "mva_isolated_endcaps", "ele identification mva isolated endcaps", 100, -1., 1.);
3014   h1_ele_provenance = bookH1withSumw2(iBooker, "provenance", "ele provenance", 5, -2., 3.);
3015   h1_ele_provenance_Extended = bookH1withSumw2(iBooker, "provenance_Extended", "ele provenance Extended", 5, -2., 3.);
3016   h1_ele_provenance_barrel = bookH1withSumw2(iBooker, "provenance_barrel", "ele provenance barrel", 5, -2., 3.);
3017   h1_ele_provenance_endcaps = bookH1withSumw2(iBooker, "provenance_endcaps", "ele provenance endcaps", 5, -2., 3.);
3018 
3019   // pflow isolation variables
3020   h1_ele_chargedHadronIso = bookH1withSumw2(
3021       iBooker, "chargedHadronIso", "chargedHadronIso", 100, 0.0, 20., "chargedHadronIso", "Events", "ELE_LOGY E1 P");
3022   h1_ele_chargedHadronIso_barrel = bookH1withSumw2(iBooker,
3023                                                    "chargedHadronIso_barrel",
3024                                                    "chargedHadronIso for barrel",
3025                                                    100,
3026                                                    0.0,
3027                                                    20.,
3028                                                    "chargedHadronIso_barrel",
3029                                                    "Events",
3030                                                    "ELE_LOGY E1 P");
3031   h1_ele_chargedHadronIso_endcaps = bookH1withSumw2(iBooker,
3032                                                     "chargedHadronIso_endcaps",
3033                                                     "chargedHadronIso for endcaps",
3034                                                     100,
3035                                                     0.0,
3036                                                     20.,
3037                                                     "chargedHadronIso_endcaps",
3038                                                     "Events",
3039                                                     "ELE_LOGY E1 P");
3040   h1_ele_neutralHadronIso = bookH1withSumw2(
3041       iBooker, "neutralHadronIso", "neutralHadronIso", 21, 0.0, 20., "neutralHadronIso", "Events", "ELE_LOGY E1 P");
3042   h1_ele_neutralHadronIso_barrel = bookH1withSumw2(iBooker,
3043                                                    "neutralHadronIso_barrel",
3044                                                    "neutralHadronIso for barrel",
3045                                                    21,
3046                                                    0.0,
3047                                                    20.,
3048                                                    "neutralHadronIso_barrel",
3049                                                    "Events",
3050                                                    "ELE_LOGY E1 P");
3051   h1_ele_neutralHadronIso_endcaps = bookH1withSumw2(iBooker,
3052                                                     "neutralHadronIso_endcaps",
3053                                                     "neutralHadronIso for endcaps",
3054                                                     21,
3055                                                     0.0,
3056                                                     20.,
3057                                                     "neutralHadronIso_endcaps",
3058                                                     "Events",
3059                                                     "ELE_LOGY E1 P");
3060   h1_ele_photonIso =
3061       bookH1withSumw2(iBooker, "photonIso", "photonIso", 100, 0.0, 20., "photonIso", "Events", "ELE_LOGY E1 P");
3062   h1_ele_photonIso_barrel = bookH1withSumw2(
3063       iBooker, "photonIso_barrel", "photonIso for barrel", 100, 0.0, 20., "photonIso_barrel", "Events", "ELE_LOGY E1 P");
3064   h1_ele_photonIso_endcaps = bookH1withSumw2(iBooker,
3065                                              "photonIso_endcaps",
3066                                              "photonIso for endcaps",
3067                                              100,
3068                                              0.0,
3069                                              20.,
3070                                              "photonIso_endcaps",
3071                                              "Events",
3072                                              "ELE_LOGY E1 P");
3073   // -- pflow over pT
3074   h1_ele_chargedHadronRelativeIso = bookH1withSumw2(iBooker,
3075                                                     "chargedHadronRelativeIso",
3076                                                     "chargedHadronRelativeIso",
3077                                                     100,
3078                                                     0.0,
3079                                                     2.,
3080                                                     "chargedHadronRelativeIso",
3081                                                     "Events",
3082                                                     "ELE_LOGY E1 P");
3083   h1_ele_chargedHadronRelativeIso_Extended = bookH1withSumw2(iBooker,
3084                                                              "chargedHadronRelativeIso_Extended",
3085                                                              "chargedHadronRelativeIso_Extended",
3086                                                              100,
3087                                                              0.0,
3088                                                              2.,
3089                                                              "chargedHadronRelativeIso Extended, 2.5<|eta|<3",
3090                                                              "Events",
3091                                                              "ELE_LOGY E1 P");
3092   h1_ele_chargedHadronRelativeIso_barrel = bookH1withSumw2(iBooker,
3093                                                            "chargedHadronRelativeIso_barrel",
3094                                                            "chargedHadronRelativeIso for barrel",
3095                                                            100,
3096                                                            0.0,
3097                                                            2.,
3098                                                            "chargedHadronRelativeIso_barrel",
3099                                                            "Events",
3100                                                            "ELE_LOGY E1 P");
3101   h1_ele_chargedHadronRelativeIso_endcaps = bookH1withSumw2(iBooker,
3102                                                             "chargedHadronRelativeIso_endcaps",
3103                                                             "chargedHadronRelativeIso for endcaps",
3104                                                             100,
3105                                                             0.0,
3106                                                             2.,
3107                                                             "chargedHadronRelativeIso_endcaps",
3108                                                             "Events",
3109                                                             "ELE_LOGY E1 P");
3110   h1_ele_neutralHadronRelativeIso = bookH1withSumw2(iBooker,
3111                                                     "neutralHadronRelativeIso",
3112                                                     "neutralHadronRelativeIso",
3113                                                     100,
3114                                                     0.0,
3115                                                     2.,
3116                                                     "neutralHadronRelativeIso",
3117                                                     "Events",
3118                                                     "ELE_LOGY E1 P");
3119   h1_ele_neutralHadronRelativeIso_Extended = bookH1withSumw2(iBooker,
3120                                                              "neutralHadronRelativeIso_Extended",
3121                                                              "neutralHadronRelativeIso_Extended",
3122                                                              100,
3123                                                              0.0,
3124                                                              2.,
3125                                                              "neutralHadronRelativeIso Extended, 2.5<|eta|<3",
3126                                                              "Events",
3127                                                              "ELE_LOGY E1 P");
3128   h1_ele_neutralHadronRelativeIso_barrel = bookH1withSumw2(iBooker,
3129                                                            "neutralHadronRelativeIso_barrel",
3130                                                            "neutralHadronRelativeIso for barrel",
3131                                                            100,
3132                                                            0.0,
3133                                                            2.,
3134                                                            "neutralHadronRelativeIso_barrel",
3135                                                            "Events",
3136                                                            "ELE_LOGY E1 P");
3137   h1_ele_neutralHadronRelativeIso_endcaps = bookH1withSumw2(iBooker,
3138                                                             "neutralHadronRelativeIso_endcaps",
3139                                                             "neutralHadronRelativeIso for endcaps",
3140                                                             100,
3141                                                             0.0,
3142                                                             2.,
3143                                                             "neutralHadronRelativeIso_endcaps",
3144                                                             "Events",
3145                                                             "ELE_LOGY E1 P");
3146   h1_ele_photonRelativeIso = bookH1withSumw2(
3147       iBooker, "photonRelativeIso", "photonRelativeIso", 100, 0.0, 2., "photonRelativeIso", "Events", "ELE_LOGY E1 P");
3148   h1_ele_photonRelativeIso_Extended = bookH1withSumw2(iBooker,
3149                                                       "photonRelativeIso_Extended",
3150                                                       "photonRelativeIso_Extended",
3151                                                       100,
3152                                                       0.0,
3153                                                       2.,
3154                                                       "photonRelativeIso Extended, 2.5<|eta|<3",
3155                                                       "Events",
3156                                                       "ELE_LOGY E1 P");
3157   h1_ele_photonRelativeIso_barrel = bookH1withSumw2(iBooker,
3158                                                     "photonRelativeIso_barrel",
3159                                                     "photonRelativeIso for barrel",
3160                                                     100,
3161                                                     0.0,
3162                                                     2.,
3163                                                     "photonRelativeIso_barrel",
3164                                                     "Events",
3165                                                     "ELE_LOGY E1 P");
3166   h1_ele_photonRelativeIso_endcaps = bookH1withSumw2(iBooker,
3167                                                      "photonRelativeIso_endcaps",
3168                                                      "photonRelativeIso for endcaps",
3169                                                      100,
3170                                                      0.0,
3171                                                      2.,
3172                                                      "photonRelativeIso_endcaps",
3173                                                      "Events",
3174                                                      "ELE_LOGY E1 P");
3175   h1_ele_chargedHadronRelativeIso_mAOD = bookH1withSumw2(iBooker,
3176                                                          "chargedHadronRelativeIso_mAOD",
3177                                                          "chargedHadronRelativeIso",
3178                                                          100,
3179                                                          0.0,
3180                                                          2.,
3181                                                          "chargedHadronRelativeIso",
3182                                                          "Events",
3183                                                          "ELE_LOGY E1 P");
3184   h1_ele_chargedHadronRelativeIso_mAOD_barrel = bookH1withSumw2(iBooker,
3185                                                                 "chargedHadronRelativeIso_mAOD_barrel",
3186                                                                 "chargedHadronRelativeIso for barrel",
3187                                                                 100,
3188                                                                 0.0,
3189                                                                 2.,
3190                                                                 "chargedHadronRelativeIso_barrel",
3191                                                                 "Events",
3192                                                                 "ELE_LOGY E1 P");
3193   h1_ele_chargedHadronRelativeIso_mAOD_endcaps = bookH1withSumw2(iBooker,
3194                                                                  "chargedHadronRelativeIso_mAOD_endcaps",
3195                                                                  "chargedHadronRelativeIso for endcaps",
3196                                                                  100,
3197                                                                  0.0,
3198                                                                  2.,
3199                                                                  "chargedHadronRelativeIso_endcaps",
3200                                                                  "Events",
3201                                                                  "ELE_LOGY E1 P");
3202   h1_ele_neutralHadronRelativeIso_mAOD = bookH1withSumw2(iBooker,
3203                                                          "neutralHadronRelativeIso_mAOD",
3204                                                          "neutralHadronRelativeIso",
3205                                                          100,
3206                                                          0.0,
3207                                                          2.,
3208                                                          "neutralHadronRelativeIso",
3209                                                          "Events",
3210                                                          "ELE_LOGY E1 P");
3211   h1_ele_neutralHadronRelativeIso_mAOD_barrel = bookH1withSumw2(iBooker,
3212                                                                 "neutralHadronRelativeIso_mAOD_barrel",
3213                                                                 "neutralHadronRelativeIso for barrel",
3214                                                                 100,
3215                                                                 0.0,
3216                                                                 2.,
3217                                                                 "neutralHadronRelativeIso_barrel",
3218                                                                 "Events",
3219                                                                 "ELE_LOGY E1 P");
3220   h1_ele_neutralHadronRelativeIso_mAOD_endcaps = bookH1withSumw2(iBooker,
3221                                                                  "neutralHadronRelativeIso_mAOD_endcaps",
3222                                                                  "neutralHadronRelativeIso for endcaps",
3223                                                                  100,
3224                                                                  0.0,
3225                                                                  2.,
3226                                                                  "neutralHadronRelativeIso_endcaps",
3227                                                                  "Events",
3228                                                                  "ELE_LOGY E1 P");
3229   h1_ele_photonRelativeIso_mAOD = bookH1withSumw2(iBooker,
3230                                                   "photonRelativeIso_mAOD",
3231                                                   "photonRelativeIso",
3232                                                   100,
3233                                                   0.0,
3234                                                   2.,
3235                                                   "photonRelativeIso",
3236                                                   "Events",
3237                                                   "ELE_LOGY E1 P");
3238   h1_ele_photonRelativeIso_mAOD_barrel = bookH1withSumw2(iBooker,
3239                                                          "photonRelativeIso_mAOD_barrel",
3240                                                          "photonRelativeIso for barrel",
3241                                                          100,
3242                                                          0.0,
3243                                                          2.,
3244                                                          "photonRelativeIso_barrel",
3245                                                          "Events",
3246                                                          "ELE_LOGY E1 P");
3247   h1_ele_photonRelativeIso_mAOD_endcaps = bookH1withSumw2(iBooker,
3248                                                           "photonRelativeIso_mAOD_endcaps",
3249                                                           "photonRelativeIso for endcaps",
3250                                                           100,
3251                                                           0.0,
3252                                                           2.,
3253                                                           "photonRelativeIso_endcaps",
3254                                                           "Events",
3255                                                           "ELE_LOGY E1 P");
3256 
3257   // conversion rejection information
3258   h1_ele_convFlags = bookH1withSumw2(iBooker, "convFlags", "conversion rejection flag", 5, -1.5, 3.5);
3259   h1_ele_convFlags_all =
3260       bookH1withSumw2(iBooker, "convFlags_all", "conversion rejection flag, all electrons", 5, -1.5, 3.5);
3261   h1_ele_convDist = bookH1withSumw2(iBooker, "convDist", "distance to the conversion partner", 100, -15., 15.);
3262   h1_ele_convDist_all =
3263       bookH1withSumw2(iBooker, "convDist_all", "distance to the conversion partner, all electrons", 100, -15., 15.);
3264   h1_ele_convDcot = bookH1withSumw2(
3265       iBooker, "convDcot", "difference of cot(angle) with the conversion partner", 100, -CLHEP::pi / 2., CLHEP::pi / 2.);
3266   h1_ele_convDcot_all = bookH1withSumw2(iBooker,
3267                                         "convDcot_all",
3268                                         "difference of cot(angle) with the conversion partner, all electrons",
3269                                         100,
3270                                         -CLHEP::pi / 2.,
3271                                         CLHEP::pi / 2.);
3272   h1_ele_convRadius = bookH1withSumw2(iBooker, "convRadius", "signed conversion radius", 100, 0., 130.);
3273   h1_ele_convRadius_all =
3274       bookH1withSumw2(iBooker, "convRadius_all", "signed conversion radius, all electrons", 100, 0., 130.);
3275 }
3276 
3277 ElectronMcSignalValidator::~ElectronMcSignalValidator() {}
3278 
3279 void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::EventSetup &) {
3280   // get collections
3281   auto gsfElectrons = iEvent.getHandle(electronCollection_);
3282   auto gsfElectronsEndcaps = iEvent.getHandle(electronCollectionEndcaps_);
3283   auto gsfElectronCores = iEvent.getHandle(electronCoreCollection_);
3284   auto gsfElectronCoresEndcaps = iEvent.getHandle(electronCoreCollectionEndcaps_);
3285   auto gsfElectronTracks = iEvent.getHandle(electronTrackCollection_);
3286   auto gsfElectronSeeds = iEvent.getHandle(electronSeedCollection_);
3287   auto genParticles = iEvent.getHandle(mcTruthCollection_);
3288   auto theBeamSpot = iEvent.getHandle(beamSpotTag_);
3289 
3290   auto isoFromDepsTk03Handle = iEvent.getHandle(isoFromDepsTk03Tag_);
3291   auto isoFromDepsTk04Handle = iEvent.getHandle(isoFromDepsTk04Tag_);
3292   auto isoFromDepsEcalFull03Handle = iEvent.getHandle(isoFromDepsEcalFull03Tag_);
3293   auto isoFromDepsEcalFull04Handle = iEvent.getHandle(isoFromDepsEcalFull04Tag_);
3294   auto isoFromDepsEcalReduced03Handle = iEvent.getHandle(isoFromDepsEcalReduced03Tag_);
3295   auto isoFromDepsEcalReduced04Handle = iEvent.getHandle(isoFromDepsEcalReduced04Tag_);
3296   auto isoFromDepsHcal03Handle = iEvent.getHandle(isoFromDepsHcal03Tag_);
3297   auto isoFromDepsHcal04Handle = iEvent.getHandle(isoFromDepsHcal04Tag_);
3298   auto vertexCollectionHandle = iEvent.getHandle(offlineVerticesCollection_);
3299   if (!vertexCollectionHandle.isValid()) {
3300     edm::LogInfo("ElectronMcSignalValidator::analyze") << "vertexCollectionHandle KO";
3301   } else {
3302     edm::LogInfo("ElectronMcSignalValidator::analyze") << "vertexCollectionHandle OK";
3303   }
3304 
3305   reco::GsfElectronCollection::const_iterator gsfIter;          //
3306   reco::GsfElectronCoreCollection::const_iterator gsfCoreIter;  //
3307   std::vector<reco::GsfElectron>::const_iterator gsfIter3;
3308   std::vector<reco::GsfElectron>::const_iterator gsfIter4;
3309 
3310   //===============================================
3311   // get a vector with EB & EE
3312   //===============================================
3313   std::vector<reco::GsfElectron> localCollection;
3314   std::vector<reco::GsfElectron> localCollection_EB;
3315   std::vector<reco::GsfElectron> localCollection_EE;
3316 
3317   // looking for EB
3318   for (gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end(); gsfIter++) {
3319     if (gsfIter->isEB()) {
3320       localCollection.push_back(*gsfIter);
3321       localCollection_EB.push_back(*gsfIter);
3322     }
3323   }
3324 
3325   // looking for EE
3326   for (gsfIter = gsfElectronsEndcaps->begin(); gsfIter != gsfElectronsEndcaps->end(); gsfIter++) {
3327     if (gsfIter->isEE()) {
3328       localCollection.push_back(*gsfIter);
3329       localCollection_EE.push_back(*gsfIter);
3330     }
3331   }
3332 
3333   //===============================================
3334   // get a vector with EB & EE for Core
3335   //===============================================
3336   std::vector<reco::GsfElectronCore> localCoreCollection;
3337 
3338   // looking for EB
3339 
3340   for (gsfCoreIter = gsfElectronCores->begin(); gsfCoreIter != gsfElectronCores->end(); gsfCoreIter++) {
3341     if (gsfCoreIter->superCluster()->seed()->seed().subdetId() == EcalBarrel) {
3342       localCoreCollection.push_back(*gsfCoreIter);
3343     }
3344   }
3345 
3346   // looking for EE
3347   for (gsfCoreIter = gsfElectronCoresEndcaps->begin(); gsfCoreIter != gsfElectronCoresEndcaps->end(); gsfCoreIter++) {
3348     if ((gsfCoreIter->superCluster()->seed()->seed().subdetId() == EcalEndcap) ||
3349         (EcalTools::isHGCalDet(gsfCoreIter->superCluster()->seed()->seed().det()))) {
3350       localCoreCollection.push_back(*gsfCoreIter);
3351     }
3352   }
3353 
3354   //===============================================
3355   // Analyze
3356   //===============================================
3357   edm::LogInfo("ElectronMcSignalValidator::analyze")
3358       << "Treating event " << iEvent.id() << " with " << gsfElectrons.product()->size() << " electrons";
3359   edm::LogInfo("ElectronMcSignalValidator::analyze")
3360       << "Treating event " << iEvent.id() << " with " << gsfElectronsEndcaps.product()->size() << " electrons";
3361 
3362   h1_recEleNum->Fill((localCollection).size());
3363   h1_recCoreNum->Fill(localCoreCollection.size());
3364   h1_recTrackNum->Fill((*gsfElectronTracks).size());
3365   h1_recSeedNum->Fill((*gsfElectronSeeds).size());
3366   h1_recOfflineVertices->Fill((*vertexCollectionHandle).size());
3367 
3368   //===============================================
3369   // all rec electrons
3370   //===============================================
3371 
3372   // mee only
3373   for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) {
3374     float enrj1 = gsfIter3->ecalEnergy();
3375 
3376     for (gsfIter4 = gsfIter3 + 1; gsfIter4 != localCollection.end(); gsfIter4++) {
3377       math::XYZTLorentzVector p12 = (*gsfIter3).p4() + (*gsfIter4).p4();
3378       float mee2 = p12.Dot(p12);
3379       float enrj2 = gsfIter4->ecalEnergy();
3380       h1_ele_mee_all->Fill(sqrt(mee2));
3381       h2_ele_E2mnE1vsMee_all->Fill(sqrt(mee2), enrj2 - enrj1);
3382       if (gsfIter3->ecalDrivenSeed() && gsfIter4->ecalDrivenSeed()) {
3383         h2_ele_E2mnE1vsMee_egeg_all->Fill(sqrt(mee2), enrj2 - enrj1);
3384       }
3385       if (gsfIter3->charge() * gsfIter4->charge() < 0.) {
3386         h1_ele_mee_os->Fill(sqrt(mee2));
3387         if (gsfIter3->isEB() && gsfIter4->isEB()) {
3388           h1_ele_mee_os_ebeb->Fill(sqrt(mee2));
3389         }
3390         if ((gsfIter3->isEB() && gsfIter4->isEE()) || (gsfIter3->isEE() && gsfIter4->isEB()))
3391           h1_ele_mee_os_ebee->Fill(sqrt(mee2));
3392         if (gsfIter3->isEE() && gsfIter4->isEE()) {
3393           h1_ele_mee_os_eeee->Fill(sqrt(mee2));
3394         }
3395         if ((gsfIter3->classification() == GsfElectron::GOLDEN && gsfIter4->classification() == GsfElectron::GOLDEN) ||
3396             (gsfIter3->classification() == GsfElectron::GOLDEN && gsfIter4->classification() == GsfElectron::BIGBREM) ||
3397             (gsfIter3->classification() == GsfElectron::BIGBREM && gsfIter4->classification() == GsfElectron::GOLDEN) ||
3398             (gsfIter3->classification() == GsfElectron::BIGBREM &&
3399              gsfIter4->classification() == GsfElectron::BIGBREM)) {
3400           h1_ele_mee_os_gg->Fill(sqrt(mee2));
3401         } else if ((gsfIter3->classification() == GsfElectron::SHOWERING &&
3402                     gsfIter4->classification() == GsfElectron::SHOWERING) ||
3403                    (gsfIter3->classification() == GsfElectron::SHOWERING && gsfIter4->isGap()) ||
3404                    (gsfIter3->isGap() && gsfIter4->classification() == GsfElectron::SHOWERING) ||
3405                    (gsfIter3->isGap() && gsfIter4->isGap())) {
3406           h1_ele_mee_os_bb->Fill(sqrt(mee2));
3407         } else {
3408           h1_ele_mee_os_gb->Fill(sqrt(mee2));
3409         }
3410       }
3411     }
3412   }
3413 
3414   for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) {
3415     // preselect electrons
3416     if (gsfIter3->pt() > maxPt_ || std::abs(gsfIter3->eta()) > maxAbsEta_)
3417       continue;
3418 
3419     h1_ele_EoverP_all->Fill(gsfIter3->eSuperClusterOverP());
3420     h1_ele_EseedOP_all->Fill(gsfIter3->eSeedClusterOverP());
3421     h1_ele_EoPout_all->Fill(gsfIter3->eSeedClusterOverPout());
3422     h1_ele_EeleOPout_all->Fill(gsfIter3->eEleClusterOverPout());
3423     h1_ele_dEtaSc_propVtx_all->Fill(gsfIter3->deltaEtaSuperClusterTrackAtVtx());
3424     h1_ele_dPhiSc_propVtx_all->Fill(gsfIter3->deltaPhiSuperClusterTrackAtVtx());
3425     h1_ele_dEtaCl_propOut_all->Fill(gsfIter3->deltaEtaSeedClusterTrackAtCalo());
3426     h1_ele_dPhiCl_propOut_all->Fill(gsfIter3->deltaPhiSeedClusterTrackAtCalo());
3427     h1_ele_HoE_all->Fill(gsfIter3->hcalOverEcal());
3428     h1_ele_HoE_bc_all->Fill(gsfIter3->hcalOverEcalBc());
3429     h1_ele_TIP_all->Fill(EleRelPoint(gsfIter3->vertex(), theBeamSpot->position()).perp());
3430     h1_ele_vertexEta_all->Fill(gsfIter3->eta());
3431     h1_ele_vertexPt_all->Fill(gsfIter3->pt());
3432     h1_ele_Et_all->Fill(gsfIter3->ecalEnergy() / cosh(gsfIter3->superCluster()->eta()));
3433 
3434     // conversion rejection
3435     int flags = gsfIter3->convFlags();
3436     if (flags == -9999) {
3437       flags = -1;
3438     }
3439     h1_ele_convFlags_all->Fill(flags);
3440     if (flags >= 0.) {
3441       h1_ele_convDist_all->Fill(gsfIter3->convDist());
3442       h1_ele_convDcot_all->Fill(gsfIter3->convDcot());
3443       h1_ele_convRadius_all->Fill(gsfIter3->convRadius());
3444     }
3445   }
3446 
3447   //===============================================
3448   // charge mis-ID
3449   //===============================================
3450 
3451   int mcNum = 0, eleNum = 0;
3452   bool matchingID, matchingMotherID;
3453 
3454   reco::GenParticleCollection::const_iterator mcIter;
3455   for (mcIter = genParticles->begin(); mcIter != genParticles->end(); mcIter++) {
3456     // select requested matching gen particle
3457     matchingID = false;
3458     for (unsigned int i = 0; i < matchingIDs_.size(); i++) {
3459       if (mcIter->pdgId() == matchingIDs_[i]) {
3460         matchingID = true;
3461       }
3462     }
3463     if (matchingID) {
3464       // select requested mother matching gen particle
3465       // always include single particle with no mother
3466       const Candidate *mother = mcIter->mother();
3467       matchingMotherID = false;
3468       for (unsigned int i = 0; i < matchingMotherIDs_.size(); i++) {
3469         if (mother == nullptr) {
3470           matchingMotherID = true;
3471         } else if (mother->pdgId() == matchingMotherIDs_[i]) {
3472           if (mother->numberOfDaughters() <= 2) {
3473             matchingMotherID = true;
3474           }
3475         }  // end of mother if test
3476       }
3477       if (matchingMotherID) {
3478         if (mcIter->pt() > maxPt_ || std::abs(mcIter->eta()) > maxAbsEta_) {
3479           continue;
3480         }
3481 
3482         // looking for the best matching gsf electron
3483         bool okGsfFound = false;
3484         double gsfOkRatio = 999999.;
3485 
3486         // find best matched electron
3487         reco::GsfElectron bestGsfElectron;
3488         for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) {
3489           double dphi = gsfIter3->phi() - mcIter->phi();
3490           if (std::abs(dphi) > CLHEP::pi) {
3491             dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
3492           }
3493           double deltaR2 = (gsfIter3->eta() - mcIter->eta()) * (gsfIter3->eta() - mcIter->eta()) + dphi * dphi;
3494           if (deltaR2 < deltaR2_) {
3495             double mc_charge = mcIter->pdgId() == 11 ? -1. : 1.;
3496             h1_ele_ChargeMnChargeTrue->Fill(std::abs(gsfIter3->charge() - mc_charge));
3497             // require here a charge mismatch
3498             if (((mcIter->pdgId() == 11) && (gsfIter3->charge() > 0.)) ||
3499                 ((mcIter->pdgId() == -11) && (gsfIter3->charge() < 0.))) {
3500               double tmpGsfRatio = gsfIter3->p() / mcIter->p();
3501               if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) {
3502                 gsfOkRatio = tmpGsfRatio;
3503                 bestGsfElectron = *gsfIter3;
3504                 okGsfFound = true;
3505               }
3506             }
3507           }
3508         }  // loop over rec ele to look for the best one
3509 
3510         // analysis when the mc track is found
3511         if (okGsfFound) {  //  && (std::abs(mcIter->eta())<maxAbsEta_)
3512           // generated distributions for matched electrons
3513           h1_mc_Pt_matched_qmisid->Fill(mcIter->pt());
3514           h1_mc_Phi_matched_qmisid->Fill(mcIter->phi());
3515           h1_mc_AbsEta_matched_qmisid->Fill(std::abs(mcIter->eta()));
3516           h1_mc_Eta_matched_qmisid->Fill(mcIter->eta());
3517           h1_mc_Z_matched_qmisid->Fill(mcIter->vz());
3518         }
3519       }
3520     }
3521   }
3522 
3523   //===============================================
3524   // association mc-reco
3525   //===============================================
3526 
3527   for (mcIter = genParticles->begin(); mcIter != genParticles->end(); mcIter++) {
3528     // number of mc particles
3529     mcNum++;
3530 
3531     // select requested matching gen particle
3532     matchingID = false;
3533     for (unsigned int i = 0; i < matchingIDs_.size(); i++) {
3534       if (mcIter->pdgId() == matchingIDs_[i]) {
3535         matchingID = true;
3536       }
3537     }
3538     if (!matchingID)
3539       continue;
3540 
3541     // select requested mother matching gen particle
3542     // always include single particle with no mother
3543     const Candidate *mother = mcIter->mother();
3544     matchingMotherID = false;
3545     for (unsigned int i = 0; i < matchingMotherIDs_.size(); i++) {
3546       if ((mother == nullptr) || ((mother != nullptr) && mother->pdgId() == matchingMotherIDs_[i])) {
3547         matchingMotherID = true;
3548       }
3549     }
3550     if (!matchingMotherID)
3551       continue;
3552 
3553     // electron preselection
3554     if (mcIter->pt() > maxPt_ || std::abs(mcIter->eta()) > maxAbsEtaExtended_) {
3555       continue;
3556     }
3557 
3558     eleNum++;
3559     if (std::abs(mcIter->eta()) < maxAbsEta_) {
3560       h1_mc_Eta->Fill(mcIter->eta());
3561       h1_mc_AbsEta->Fill(std::abs(mcIter->eta()));
3562       h1_mc_P->Fill(mcIter->p());
3563       h1_mc_Pt->Fill(mcIter->pt());
3564       h1_mc_Phi->Fill(mcIter->phi());
3565       h1_mc_Z->Fill(mcIter->vz());
3566       h2_mc_PtEta->Fill(mcIter->eta(), mcIter->pt());
3567     }
3568     if (std::abs(mcIter->eta()) < maxAbsEtaExtended_) {
3569       h1_mc_Eta_Extended->Fill(mcIter->eta());
3570       h1_mc_AbsEta_Extended->Fill(std::abs(mcIter->eta()));
3571     }
3572 
3573     // find best matched electron
3574     bool okGsfFound = false;
3575     bool passMiniAODSelection = true;
3576     double gsfOkRatio = 999999.;
3577     bool isEBflag = false;
3578     bool isEEflag = false;
3579     bool isEEextendedflag = false;
3580 
3581     reco::GsfElectron bestGsfElectron;
3582     for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) {
3583       // temporary cut for pt < 5.
3584       double dphi = gsfIter3->phi() - mcIter->phi();
3585       if (std::abs(dphi) > CLHEP::pi) {
3586         dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
3587       }
3588       double deltaR2 = (gsfIter3->eta() - mcIter->eta()) * (gsfIter3->eta() - mcIter->eta()) + dphi * dphi;
3589       if (deltaR2 < deltaR2_) {
3590         if (((mcIter->pdgId() == 11) && (gsfIter3->charge() < 0.)) ||
3591             ((mcIter->pdgId() == -11) && (gsfIter3->charge() > 0.))) {
3592           double tmpGsfRatio = gsfIter3->p() / mcIter->p();
3593           if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) {
3594             gsfOkRatio = tmpGsfRatio;
3595             bestGsfElectron = *gsfIter3;
3596             okGsfFound = true;
3597           }
3598         }
3599       }
3600     }  // loop over rec ele to look for the best one
3601 
3602     if (!okGsfFound)
3603       continue;
3604 
3605     //------------------------------------
3606     // analysis when the mc track is found
3607     //------------------------------------
3608     passMiniAODSelection = bestGsfElectron.pt() >= 5.;
3609     isEBflag = bestGsfElectron.isEB();
3610     isEEflag = bestGsfElectron.isEE() && (std::abs(mcIter->eta()) < maxAbsEta_);
3611     isEEextendedflag = bestGsfElectron.isEE();
3612 
3613     float Etot = 0.;
3614     CaloCluster_iterator it = bestGsfElectron.superCluster()->clustersBegin();
3615     CaloCluster_iterator itend = bestGsfElectron.superCluster()->clustersEnd();
3616     for (; it != itend; ++it) {
3617       Etot += (*it)->energy();
3618     }
3619 
3620     if (isEEextendedflag) {  // Extended flag
3621       if (!isEEflag) {
3622         h1_mc_Eta_Extended_matched->Fill(mcIter->eta());
3623         h1_mc_AbsEta_matched->Fill(std::abs(mcIter->eta()));
3624         h1_mc_AbsEta_Extended_matched->Fill(std::abs(mcIter->eta()));
3625         h2_ele_EoPVsEta_Extended->Fill(bestGsfElectron.eta(), bestGsfElectron.eSuperClusterOverP());
3626         h1_scl_bcl_EtotoEtrue_Extended->Fill(Etot / mcIter->p());  //
3627         h1_scl_EoEtrue_endcaps_new_Extended->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3628         h1_ele_dEtaSc_propVtx_Extended->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
3629         h1_ele_dPhiSc_propVtx_Extended->Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx());
3630         h1_scl_full5x5_sigmaIetaIeta_Extended->Fill(bestGsfElectron.full5x5_sigmaIetaIeta());
3631         h1_ele_HoE_Extended->Fill(bestGsfElectron.hcalOverEcal());
3632         h1_ele_photonRelativeIso_Extended->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt /
3633                                                 bestGsfElectron.pt());
3634         h1_ele_chargedHadronRelativeIso_Extended->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt /
3635                                                        bestGsfElectron.pt());
3636         h1_ele_neutralHadronRelativeIso_Extended->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt /
3637                                                        bestGsfElectron.pt());
3638         h2_scl_EoEtrueVsrecOfflineVertices_Extended->Fill((*vertexCollectionHandle).size(),
3639                                                           bestGsfElectron.ecalEnergy() / mcIter->p());
3640         h2_ele_PoPtrueVsEta_Extended->Fill(bestGsfElectron.eta(), bestGsfElectron.p() / mcIter->p());
3641         h1_ele_ecalPFClusterIso_Extended->Fill(bestGsfElectron.ecalPFClusterIso());
3642         h1_ele_hcalPFClusterIso_Extended->Fill(bestGsfElectron.hcalPFClusterIso());
3643 
3644         double fbrem_mode = bestGsfElectron.fbrem();
3645         h1_ele_fbrem_Extended->Fill(fbrem_mode);
3646         if (!readAOD_) {
3647           if (bestGsfElectron.ecalDrivenSeed())
3648             h1_ele_provenance_Extended->Fill(1.);
3649           if (bestGsfElectron.trackerDrivenSeed()) {
3650             h1_ele_provenance_Extended->Fill(-1.);
3651           }
3652           if (bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) {
3653             h1_ele_provenance_Extended->Fill(0.);
3654           }
3655           if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed()) {
3656             h1_ele_provenance_Extended->Fill(-2.);
3657           }
3658           if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed()) {
3659             h1_ele_provenance_Extended->Fill(-1.);
3660           }
3661         }
3662       }
3663 
3664       if (!readAOD_) {
3665         h2_ele_foundHitsVsEta_Extended->Fill(bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->numberOfValidHits());
3666 
3667         edm::RefToBase<TrajectorySeed> seed_Ext = bestGsfElectron.gsfTrack()->extra()->seedRef();
3668         ElectronSeedRef elseed_Ext = seed_Ext.castTo<ElectronSeedRef>();
3669         if (elseed_Ext->dPhiNeg(1) != std::numeric_limits<float>::infinity()) {
3670           h2_ele_seed_dphi2VsEta->Fill(bestGsfElectron.eta(), elseed_Ext->dPhiNeg(1));
3671         }
3672         if (elseed_Ext->dRZNeg(1) != std::numeric_limits<float>::infinity()) {
3673           h2_ele_seed_drz2VsEta->Fill(bestGsfElectron.eta(), elseed_Ext->dRZNeg(1));
3674         }
3675       }
3676     }  // end of Extended flag
3677 
3678     if (!isEBflag && !isEEflag)
3679       continue;
3680 
3681     // electron related distributions
3682     if (isEBflag) {
3683       h1_ele_vertexPt_EB->Fill(bestGsfElectron.pt());
3684     } else if (isEEflag) {
3685       h1_ele_vertexPt_EE->Fill(bestGsfElectron.pt());
3686     }
3687     h1_ele_charge->Fill(bestGsfElectron.charge());
3688     h2_ele_chargeVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.charge());
3689     h2_ele_chargeVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.charge());
3690     h2_ele_chargeVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.charge());
3691     h1_ele_vertexP->Fill(bestGsfElectron.p());
3692     h1_ele_vertexPt->Fill(bestGsfElectron.pt());
3693     if (bestGsfElectron.scSigmaIEtaIEta() == 0.)
3694       h1_ele_vertexPt_nocut->Fill(bestGsfElectron.pt());
3695     h1_ele_Et->Fill(bestGsfElectron.ecalEnergy() / cosh(bestGsfElectron.superCluster()->eta()));
3696     h2_ele_vertexPtVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.pt());
3697     h2_ele_vertexPtVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.pt());
3698     h1_ele_vertexEta->Fill(bestGsfElectron.eta());
3699 
3700     h2_scl_EoEtrueVsrecOfflineVertices->Fill((*vertexCollectionHandle).size(),
3701                                              bestGsfElectron.ecalEnergy() / mcIter->p());
3702     if (isEBflag)
3703       h2_scl_EoEtrueVsrecOfflineVertices_barrel->Fill((*vertexCollectionHandle).size(),
3704                                                       bestGsfElectron.ecalEnergy() / mcIter->p());
3705     else if (isEEflag)
3706       h2_scl_EoEtrueVsrecOfflineVertices_endcaps->Fill((*vertexCollectionHandle).size(),
3707                                                        bestGsfElectron.ecalEnergy() / mcIter->p());
3708 
3709     // generated distributions for matched electrons
3710     h1_mc_Pt_matched->Fill(mcIter->pt());
3711     h1_mc_Phi_matched->Fill(mcIter->phi());
3712     h1_mc_AbsEta_matched->Fill(std::abs(mcIter->eta()));
3713     h1_mc_AbsEta_Extended_matched->Fill(std::abs(mcIter->eta()));
3714     h1_mc_Eta_Extended_matched->Fill(mcIter->eta());
3715     h2_mc_PtEta_matched->Fill(mcIter->eta(), mcIter->pt());
3716     h2_ele_vertexEtaVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eta());
3717     h1_ele_vertexPhi->Fill(bestGsfElectron.phi());
3718     h1_ele_vertexX->Fill(bestGsfElectron.vertex().x());
3719     h1_ele_vertexY->Fill(bestGsfElectron.vertex().y());
3720     h1_ele_vertexZ->Fill(bestGsfElectron.vertex().z());
3721     h1_mc_Z_matched->Fill(mcIter->vz());
3722     double d = (bestGsfElectron.vertex().x() - mcIter->vx()) * (bestGsfElectron.vertex().x() - mcIter->vx()) +
3723                (bestGsfElectron.vertex().y() - mcIter->vy()) * (bestGsfElectron.vertex().y() - mcIter->vy());
3724     d = sqrt(d);
3725     h1_ele_vertexTIP->Fill(d);
3726     h2_ele_vertexTIPVsEta->Fill(bestGsfElectron.eta(), d);
3727     h2_ele_vertexTIPVsPhi->Fill(bestGsfElectron.phi(), d);
3728     h2_ele_vertexTIPVsPt->Fill(bestGsfElectron.pt(), d);
3729     h1_ele_EtaMnEtaTrue->Fill(bestGsfElectron.eta() - mcIter->eta());
3730     h2_ele_EtaMnEtaTrueVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eta() - mcIter->eta());
3731     h2_ele_EtaMnEtaTrueVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eta() - mcIter->eta());
3732     h2_ele_EtaMnEtaTrueVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.eta() - mcIter->eta());
3733     h1_ele_PhiMnPhiTrue->Fill(bestGsfElectron.phi() - mcIter->phi());
3734     h1_ele_PhiMnPhiTrue2->Fill(bestGsfElectron.phi() - mcIter->phi());
3735     h2_ele_PhiMnPhiTrueVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.phi() - mcIter->phi());
3736     h2_ele_PhiMnPhiTrueVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.phi() - mcIter->phi());
3737     h2_ele_PhiMnPhiTrueVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.phi() - mcIter->phi());
3738     h1_ele_PoPtrue->Fill(bestGsfElectron.p() / mcIter->p());
3739     h1_ele_PtoPttrue->Fill(bestGsfElectron.pt() / mcIter->pt());
3740     h2_ele_PoPtrueVsEta_Extended->Fill(bestGsfElectron.eta(), bestGsfElectron.p() / mcIter->p());
3741     h2_ele_PoPtrueVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.p() / mcIter->p());
3742     h2_ele_PoPtrueVsPt->Fill(bestGsfElectron.py(), bestGsfElectron.p() / mcIter->p());
3743     h2_ele_sigmaIetaIetaVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.scSigmaIEtaIEta());
3744     h1_ele_ecalEnergyError->Fill(bestGsfElectron.correctedEcalEnergyError());
3745     h1_ele_combinedP4Error->Fill(bestGsfElectron.p4Error(bestGsfElectron.P4_COMBINATION));
3746     if (isEBflag) {
3747       h1_ele_EtaMnEtaTrue_barrel->Fill(bestGsfElectron.eta() - mcIter->eta());
3748       h1_ele_PhiMnPhiTrue_barrel->Fill(bestGsfElectron.phi() - mcIter->phi());
3749       h1_ele_PoPtrue_barrel->Fill(bestGsfElectron.p() / mcIter->p());
3750       h1_ele_PtoPttrue_barrel->Fill(bestGsfElectron.pt() / mcIter->pt());
3751       h1_ele_ecalEnergyError_barrel->Fill(bestGsfElectron.correctedEcalEnergyError());
3752       h1_ele_combinedP4Error_barrel->Fill(bestGsfElectron.p4Error(bestGsfElectron.P4_COMBINATION));
3753     } else if (isEEflag) {
3754       h1_ele_EtaMnEtaTrue_endcaps->Fill(bestGsfElectron.eta() - mcIter->eta());
3755       h1_ele_PhiMnPhiTrue_endcaps->Fill(bestGsfElectron.phi() - mcIter->phi());
3756       h1_ele_PoPtrue_endcaps->Fill(bestGsfElectron.p() / mcIter->p());
3757       h1_ele_PtoPttrue_endcaps->Fill(bestGsfElectron.pt() / mcIter->pt());
3758       h1_ele_ecalEnergyError_endcaps->Fill(bestGsfElectron.correctedEcalEnergyError());
3759       h1_ele_combinedP4Error_endcaps->Fill(bestGsfElectron.p4Error(bestGsfElectron.P4_COMBINATION));
3760     }
3761 
3762     if (isEBflag && bestGsfElectron.classification() == GsfElectron::GOLDEN)
3763       h1_ele_PoPtrue_golden_barrel->Fill(bestGsfElectron.p() / mcIter->p());
3764     if (isEEflag && bestGsfElectron.classification() == GsfElectron::GOLDEN)
3765       h1_ele_PoPtrue_golden_endcaps->Fill(bestGsfElectron.p() / mcIter->p());
3766     if (isEBflag && bestGsfElectron.classification() == GsfElectron::SHOWERING)
3767       h1_ele_PoPtrue_showering_barrel->Fill(bestGsfElectron.p() / mcIter->p());
3768     if (isEEflag && bestGsfElectron.classification() == GsfElectron::SHOWERING)
3769       h1_ele_PoPtrue_showering_endcaps->Fill(bestGsfElectron.p() / mcIter->p());
3770 
3771     // supercluster related distributions
3772     reco::SuperClusterRef sclRef = bestGsfElectron.superCluster();
3773 
3774     h1_scl_En->Fill(bestGsfElectron.ecalEnergy());
3775     if (isEBflag) {
3776       h1_scl_EoEtrue_barrel->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3777       h1_scl_EoEtrue_barrel_new->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3778     } else if (isEEflag) {
3779       h1_scl_EoEtrue_endcaps->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3780       h1_scl_EoEtrue_endcaps_new->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3781     }
3782     if (isEBflag && bestGsfElectron.isEBEtaGap())
3783       h1_scl_EoEtrue_barrel_etagap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3784     if (isEBflag && bestGsfElectron.isEBPhiGap())
3785       h1_scl_EoEtrue_barrel_phigap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3786     if (bestGsfElectron.isEBEEGap())
3787       h1_scl_EoEtrue_ebeegap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3788     if (isEEflag && bestGsfElectron.isEEDeeGap())
3789       h1_scl_EoEtrue_endcaps_deegap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3790     if (isEEflag && bestGsfElectron.isEERingGap())
3791       h1_scl_EoEtrue_endcaps_ringgap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3792     if (isEBflag && bestGsfElectron.isEBEtaGap())
3793       h1_scl_EoEtrue_barrel_new_etagap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3794     if (isEBflag && bestGsfElectron.isEBPhiGap())
3795       h1_scl_EoEtrue_barrel_new_phigap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3796     if (bestGsfElectron.isEBEEGap())
3797       h1_scl_EoEtrue_ebeegap_new->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3798     if (isEEflag && bestGsfElectron.isEEDeeGap())
3799       h1_scl_EoEtrue_endcaps_new_deegap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3800     if (isEEflag && bestGsfElectron.isEERingGap())
3801       h1_scl_EoEtrue_endcaps_new_ringgap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p());
3802 
3803     double R = TMath::Sqrt(sclRef->x() * sclRef->x() + sclRef->y() * sclRef->y() + sclRef->z() * sclRef->z());
3804     double Rt = TMath::Sqrt(sclRef->x() * sclRef->x() + sclRef->y() * sclRef->y());
3805     h1_scl_Et->Fill(sclRef->energy() * (Rt / R));
3806     h2_scl_EtVsEta->Fill(sclRef->eta(), sclRef->energy() * (Rt / R));
3807     h2_scl_EtVsPhi->Fill(sclRef->phi(), sclRef->energy() * (Rt / R));
3808     h1_scl_Eta->Fill(sclRef->eta());
3809     h2_scl_EtaVsPhi->Fill(sclRef->phi(), sclRef->eta());
3810     h1_scl_Phi->Fill(sclRef->phi());
3811     h1_scl_SigEtaEta->Fill(bestGsfElectron.scSigmaEtaEta());
3812     h1_scl_SigIEtaIEta->Fill(bestGsfElectron.scSigmaIEtaIEta());
3813     h1_scl_full5x5_sigmaIetaIeta->Fill(bestGsfElectron.full5x5_sigmaIetaIeta());
3814     h1_scl_E1x5->Fill(bestGsfElectron.scE1x5());
3815     h1_scl_E2x5max->Fill(bestGsfElectron.scE2x5Max());
3816     h1_scl_E5x5->Fill(bestGsfElectron.scE5x5());
3817     if (isEBflag) {
3818       h1_scl_SigEtaEta_barrel->Fill(bestGsfElectron.scSigmaEtaEta());
3819       h1_scl_SigIEtaIEta_barrel->Fill(bestGsfElectron.scSigmaIEtaIEta());
3820       h1_scl_full5x5_sigmaIetaIeta_barrel->Fill(bestGsfElectron.full5x5_sigmaIetaIeta());
3821       h1_scl_E1x5_barrel->Fill(bestGsfElectron.scE1x5());
3822       h1_scl_E2x5max_barrel->Fill(bestGsfElectron.scE2x5Max());
3823       h1_scl_E5x5_barrel->Fill(bestGsfElectron.scE5x5());
3824     } else if (isEEflag) {
3825       h1_scl_SigEtaEta_endcaps->Fill(bestGsfElectron.scSigmaEtaEta());
3826       h1_scl_SigIEtaIEta_endcaps->Fill(bestGsfElectron.scSigmaIEtaIEta());
3827       h1_scl_full5x5_sigmaIetaIeta_endcaps->Fill(bestGsfElectron.full5x5_sigmaIetaIeta());
3828       h1_scl_E1x5_endcaps->Fill(bestGsfElectron.scE1x5());
3829       h1_scl_E2x5max_endcaps->Fill(bestGsfElectron.scE2x5Max());
3830       h1_scl_E5x5_endcaps->Fill(bestGsfElectron.scE5x5());
3831     }
3832 
3833     if (passMiniAODSelection) {  // Pt > 5.
3834       h1_scl_SigIEtaIEta_mAOD->Fill(bestGsfElectron.scSigmaIEtaIEta());
3835       if (isEBflag)
3836         h1_scl_SigIEtaIEta_mAOD_barrel->Fill(bestGsfElectron.scSigmaIEtaIEta());
3837       else if (isEEflag)
3838         h1_scl_SigIEtaIEta_mAOD_endcaps->Fill(bestGsfElectron.scSigmaIEtaIEta());
3839     }
3840 
3841     float pfEnergy = 0.;
3842     if (!bestGsfElectron.parentSuperCluster().isNull())
3843       pfEnergy = bestGsfElectron.parentSuperCluster()->energy();
3844     h2_scl_EoEtruePfVsEg->Fill(bestGsfElectron.ecalEnergy() / mcIter->p(), pfEnergy / mcIter->p());
3845     if (isEEflag)
3846       h1_scl_ESFrac_endcaps->Fill(sclRef->preshowerEnergy() / sclRef->rawEnergy());
3847 
3848     h1_scl_bcl_EtotoEtrue->Fill(Etot / mcIter->p());
3849     if (isEBflag)
3850       h1_scl_bcl_EtotoEtrue_barrel->Fill(Etot / mcIter->p());
3851     else if (isEEflag)
3852       h1_scl_bcl_EtotoEtrue_endcaps->Fill(Etot / mcIter->p());
3853 
3854     // track related distributions
3855     h1_ele_ambiguousTracks->Fill(bestGsfElectron.ambiguousGsfTracksSize());
3856     h2_ele_ambiguousTracksVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.ambiguousGsfTracksSize());
3857     h2_ele_ambiguousTracksVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.ambiguousGsfTracksSize());
3858     h2_ele_ambiguousTracksVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.ambiguousGsfTracksSize());
3859     if (!readAOD_)  // track extra does not exist in AOD
3860     {
3861       h1_ele_foundHits->Fill(bestGsfElectron.gsfTrack()->numberOfValidHits());
3862       h2_ele_foundHitsVsEta_Extended->Fill(bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->numberOfValidHits());
3863       h2_ele_foundHitsVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.gsfTrack()->numberOfValidHits());
3864       h2_ele_foundHitsVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.gsfTrack()->numberOfValidHits());
3865       h1_ele_lostHits->Fill(bestGsfElectron.gsfTrack()->numberOfLostHits());
3866       h2_ele_lostHitsVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->numberOfLostHits());
3867       h2_ele_lostHitsVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.gsfTrack()->numberOfLostHits());
3868       h2_ele_lostHitsVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.gsfTrack()->numberOfLostHits());
3869       h1_ele_chi2->Fill(bestGsfElectron.gsfTrack()->normalizedChi2());
3870       h2_ele_chi2VsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->normalizedChi2());
3871       h2_ele_chi2VsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.gsfTrack()->normalizedChi2());
3872       h2_ele_chi2VsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.gsfTrack()->normalizedChi2());
3873       if (isEBflag) {
3874         h1_ele_foundHits_barrel->Fill(bestGsfElectron.gsfTrack()->numberOfValidHits());
3875         h1_ele_lostHits_barrel->Fill(bestGsfElectron.gsfTrack()->numberOfLostHits());
3876         h1_ele_chi2_barrel->Fill(bestGsfElectron.gsfTrack()->normalizedChi2());
3877       } else if (isEEflag) {
3878         h1_ele_foundHits_endcaps->Fill(bestGsfElectron.gsfTrack()->numberOfValidHits());
3879         h1_ele_lostHits_endcaps->Fill(bestGsfElectron.gsfTrack()->numberOfLostHits());
3880         h1_ele_chi2_endcaps->Fill(bestGsfElectron.gsfTrack()->normalizedChi2());
3881       }
3882 
3883       if (passMiniAODSelection) {  // Pt > 5.
3884         h2_ele_foundHitsVsEta_mAOD->Fill(bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->numberOfValidHits());
3885       }
3886     }
3887     // from gsf track interface, hence using mean
3888     if (!readAOD_)  // track extra does not exist in AOD
3889     {
3890       h1_ele_PinMnPout->Fill(bestGsfElectron.gsfTrack()->innerMomentum().R() -
3891                              bestGsfElectron.gsfTrack()->outerMomentum().R());
3892       h1_ele_outerP->Fill(bestGsfElectron.gsfTrack()->outerMomentum().R());
3893       h1_ele_outerPt->Fill(bestGsfElectron.gsfTrack()->outerMomentum().Rho());
3894     }
3895     // from electron interface, hence using mode
3896     h1_ele_PinMnPout_mode->Fill(bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R());
3897     h2_ele_PinMnPoutVsEta_mode->Fill(bestGsfElectron.eta(),
3898                                      bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R());
3899     h2_ele_PinMnPoutVsPhi_mode->Fill(bestGsfElectron.phi(),
3900                                      bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R());
3901     h2_ele_PinMnPoutVsPt_mode->Fill(bestGsfElectron.pt(),
3902                                     bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R());
3903     h2_ele_PinMnPoutVsE_mode->Fill(bestGsfElectron.caloEnergy(),
3904                                    bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R());
3905     if (!readAOD_)  // track extra does not exist in AOD
3906     {
3907       h2_ele_PinMnPoutVsChi2_mode->Fill(
3908           bestGsfElectron.gsfTrack()->normalizedChi2(),
3909           bestGsfElectron.trackMomentumAtVtx().R() - bestGsfElectron.trackMomentumOut().R());
3910     }
3911     h1_ele_outerP_mode->Fill(bestGsfElectron.trackMomentumOut().R());
3912     h2_ele_outerPVsEta_mode->Fill(bestGsfElectron.eta(), bestGsfElectron.trackMomentumOut().R());
3913     h1_ele_outerPt_mode->Fill(bestGsfElectron.trackMomentumOut().Rho());
3914     h2_ele_outerPtVsEta_mode->Fill(bestGsfElectron.eta(), bestGsfElectron.trackMomentumOut().Rho());
3915     h2_ele_outerPtVsPhi_mode->Fill(bestGsfElectron.phi(), bestGsfElectron.trackMomentumOut().Rho());
3916     h2_ele_outerPtVsPt_mode->Fill(bestGsfElectron.pt(), bestGsfElectron.trackMomentumOut().Rho());
3917 
3918     if (!readAOD_)  // track extra does not exist in AOD
3919     {
3920       edm::RefToBase<TrajectorySeed> seed = bestGsfElectron.gsfTrack()->extra()->seedRef();
3921       ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>();
3922       h1_ele_seed_subdet2->Fill(elseed->subDet(1));
3923       h1_ele_seed_mask->Fill(elseed->hitsMask());
3924       if (elseed->subDet(1) == 1) {
3925         h1_ele_seed_mask_bpix->Fill(elseed->hitsMask());
3926       } else if (elseed->subDet(1) == 2) {
3927         h1_ele_seed_mask_fpix->Fill(elseed->hitsMask());
3928       } else if (elseed->subDet(1) == 6) {
3929         h1_ele_seed_mask_tec->Fill(elseed->hitsMask());
3930       }
3931 
3932       if (elseed->dPhiNeg(1) != std::numeric_limits<float>::infinity()) {
3933         h1_ele_seed_dphi2->Fill(elseed->dPhiNeg(1));
3934         h2_ele_seed_dphi2VsEta->Fill(bestGsfElectron.eta(), elseed->dPhiNeg(1));
3935         h2_ele_seed_dphi2VsPt->Fill(bestGsfElectron.pt(), elseed->dPhiNeg(1));
3936       }
3937       if (elseed->dPhiPos(1) != std::numeric_limits<float>::infinity()) {
3938         h1_ele_seed_dphi2pos->Fill(elseed->dPhiPos(1));
3939         h2_ele_seed_dphi2posVsEta->Fill(bestGsfElectron.eta(), elseed->dPhiPos(1));
3940         h2_ele_seed_dphi2posVsPt->Fill(bestGsfElectron.pt(), elseed->dPhiPos(1));
3941       }
3942       if (elseed->dRZNeg(1) != std::numeric_limits<float>::infinity()) {
3943         h1_ele_seed_drz2->Fill(elseed->dRZNeg(1));
3944         h2_ele_seed_drz2VsEta->Fill(bestGsfElectron.eta(), elseed->dRZNeg(1));
3945         h2_ele_seed_drz2VsPt->Fill(bestGsfElectron.pt(), elseed->dRZNeg(1));
3946       }
3947       if (elseed->dRZPos(1) != std::numeric_limits<float>::infinity()) {
3948         h1_ele_seed_drz2pos->Fill(elseed->dRZPos(1));
3949         h2_ele_seed_drz2posVsEta->Fill(bestGsfElectron.eta(), elseed->dRZPos(1));
3950         h2_ele_seed_drz2posVsPt->Fill(bestGsfElectron.pt(), elseed->dRZPos(1));
3951       }
3952     }
3953 
3954     // match distributions
3955     h1_ele_EoP->Fill(bestGsfElectron.eSuperClusterOverP());
3956     h2_ele_EoPVsEta_Extended->Fill(bestGsfElectron.eta(), bestGsfElectron.eSuperClusterOverP());
3957     h2_ele_EoPVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eSuperClusterOverP());
3958     h2_ele_EoPVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eSuperClusterOverP());
3959     h1_ele_EseedOP->Fill(bestGsfElectron.eSeedClusterOverP());
3960     h2_ele_EseedOPVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eSeedClusterOverP());
3961     h2_ele_EseedOPVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eSeedClusterOverP());
3962     h2_ele_EseedOPVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eSeedClusterOverP());
3963     h1_ele_EoPout->Fill(bestGsfElectron.eSeedClusterOverPout());
3964     h2_ele_EoPoutVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eSeedClusterOverPout());
3965     h2_ele_EoPoutVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eSeedClusterOverPout());
3966     h2_ele_EoPoutVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eSeedClusterOverPout());
3967     h1_ele_EeleOPout->Fill(bestGsfElectron.eEleClusterOverPout());
3968     h2_ele_EeleOPoutVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eEleClusterOverPout());
3969     h2_ele_EeleOPoutVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eEleClusterOverPout());
3970     h2_ele_EeleOPoutVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eEleClusterOverPout());
3971     h1_ele_dEtaSc_propVtx->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
3972     h2_ele_dEtaScVsEta_propVtx->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
3973     h2_ele_dEtaScVsPhi_propVtx->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
3974     h2_ele_dEtaScVsPt_propVtx->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
3975     h1_ele_dPhiSc_propVtx->Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx());
3976     h2_ele_dPhiScVsEta_propVtx->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaPhiSuperClusterTrackAtVtx());
3977     h2_ele_dPhiScVsPhi_propVtx->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaPhiSuperClusterTrackAtVtx());
3978     h2_ele_dPhiScVsPt_propVtx->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaPhiSuperClusterTrackAtVtx());
3979     h1_ele_dEtaCl_propOut->Fill(bestGsfElectron.deltaEtaSeedClusterTrackAtCalo());
3980     h2_ele_dEtaClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaEtaSeedClusterTrackAtCalo());
3981     h2_ele_dEtaClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaEtaSeedClusterTrackAtCalo());
3982     h2_ele_dEtaClVsPt_propOut->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaEtaSeedClusterTrackAtCalo());
3983     h1_ele_dPhiCl_propOut->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo());
3984     h2_ele_dPhiClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaPhiSeedClusterTrackAtCalo());
3985     h2_ele_dPhiClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaPhiSeedClusterTrackAtCalo());
3986     h2_ele_dPhiClVsPt_propOut->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaPhiSeedClusterTrackAtCalo());
3987     h1_ele_dEtaEleCl_propOut->Fill(bestGsfElectron.deltaEtaEleClusterTrackAtCalo());
3988     h2_ele_dEtaEleClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaEtaEleClusterTrackAtCalo());
3989     h2_ele_dEtaEleClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaEtaEleClusterTrackAtCalo());
3990     h2_ele_dEtaEleClVsPt_propOut->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaEtaEleClusterTrackAtCalo());
3991     h1_ele_dPhiEleCl_propOut->Fill(bestGsfElectron.deltaPhiEleClusterTrackAtCalo());
3992     h2_ele_dPhiEleClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaPhiEleClusterTrackAtCalo());
3993     h2_ele_dPhiEleClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaPhiEleClusterTrackAtCalo());
3994     h2_ele_dPhiEleClVsPt_propOut->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaPhiEleClusterTrackAtCalo());
3995     h1_ele_HoE->Fill(bestGsfElectron.hcalOverEcal());
3996     h1_ele_HoE_bc->Fill(bestGsfElectron.hcalOverEcalBc());
3997     if (isEBflag) {
3998       h1_ele_EoP_barrel->Fill(bestGsfElectron.eSuperClusterOverP());
3999       h1_ele_EseedOP_barrel->Fill(bestGsfElectron.eSeedClusterOverP());
4000       h1_ele_EoPout_barrel->Fill(bestGsfElectron.eSeedClusterOverPout());
4001       h1_ele_EeleOPout_barrel->Fill(bestGsfElectron.eEleClusterOverPout());
4002       h1_ele_dEtaSc_propVtx_barrel->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
4003       h1_ele_dPhiSc_propVtx_barrel->Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx());
4004       h1_ele_dEtaCl_propOut_barrel->Fill(bestGsfElectron.deltaEtaSeedClusterTrackAtCalo());
4005       h1_ele_dPhiCl_propOut_barrel->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo());
4006       h1_ele_dEtaEleCl_propOut_barrel->Fill(bestGsfElectron.deltaEtaEleClusterTrackAtCalo());
4007       h1_ele_dPhiEleCl_propOut_barrel->Fill(bestGsfElectron.deltaPhiEleClusterTrackAtCalo());
4008       h1_ele_HoE_bc_barrel->Fill(bestGsfElectron.hcalOverEcalBc());
4009       h1_ele_HoE_barrel->Fill(bestGsfElectron.hcalOverEcal());
4010     } else if (isEEflag) {
4011       h1_ele_EoP_endcaps->Fill(bestGsfElectron.eSuperClusterOverP());
4012       h1_ele_EseedOP_endcaps->Fill(bestGsfElectron.eSeedClusterOverP());
4013       h1_ele_EoPout_endcaps->Fill(bestGsfElectron.eSeedClusterOverPout());
4014       h1_ele_EeleOPout_endcaps->Fill(bestGsfElectron.eEleClusterOverPout());
4015       h1_ele_dEtaSc_propVtx_endcaps->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
4016       h1_ele_dPhiSc_propVtx_endcaps->Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx());
4017       h1_ele_dEtaCl_propOut_endcaps->Fill(bestGsfElectron.deltaEtaSeedClusterTrackAtCalo());
4018       h1_ele_dPhiCl_propOut_endcaps->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo());
4019       h1_ele_dEtaEleCl_propOut_endcaps->Fill(bestGsfElectron.deltaEtaEleClusterTrackAtCalo());
4020       h1_ele_dPhiEleCl_propOut_endcaps->Fill(bestGsfElectron.deltaPhiEleClusterTrackAtCalo());
4021       h1_ele_HoE_bc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc());
4022       h1_ele_HoE_endcaps->Fill(bestGsfElectron.hcalOverEcal());
4023     }
4024 
4025     if (passMiniAODSelection) {  // Pt > 5.
4026       h1_ele_dEtaSc_propVtx_mAOD->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
4027       h1_ele_dPhiCl_propOut_mAOD->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo());
4028       h1_ele_HoE_mAOD->Fill(bestGsfElectron.hcalOverEcal());
4029       if (isEBflag) {
4030         h1_ele_dEtaSc_propVtx_mAOD_barrel->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
4031         h1_ele_dPhiCl_propOut_mAOD_barrel->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo());
4032         h1_ele_HoE_mAOD_barrel->Fill(bestGsfElectron.hcalOverEcal());
4033       } else if (isEEflag) {
4034         h1_ele_dEtaSc_propVtx_mAOD_endcaps->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx());
4035         h1_ele_dPhiCl_propOut_mAOD_endcaps->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo());
4036         h1_ele_HoE_mAOD_endcaps->Fill(bestGsfElectron.hcalOverEcal());
4037       }
4038     }
4039 
4040     if (!bestGsfElectron.isEBEtaGap() && !bestGsfElectron.isEBPhiGap() && !bestGsfElectron.isEBEEGap() &&
4041         !bestGsfElectron.isEERingGap() && !bestGsfElectron.isEEDeeGap())
4042       h1_ele_HoE_fiducial->Fill(bestGsfElectron.hcalOverEcal());
4043     h2_ele_HoEVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.hcalOverEcal());
4044     h2_ele_HoEVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.hcalOverEcal());
4045     h2_ele_HoEVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.hcalOverEcal());
4046 
4047     //classes
4048     int eleClass = bestGsfElectron.classification();
4049     if (isEEflag)
4050       eleClass += 10;
4051     h1_ele_classes->Fill(eleClass);
4052 
4053     if (bestGsfElectron.classification() == GsfElectron::GOLDEN && isEBflag)
4054       h1_scl_EoEtrueGolden_barrel->Fill(sclRef->energy() / mcIter->p());
4055     if (bestGsfElectron.classification() == GsfElectron::GOLDEN && isEEflag)
4056       h1_scl_EoEtrueGolden_endcaps->Fill(sclRef->energy() / mcIter->p());
4057     if (bestGsfElectron.classification() == GsfElectron::SHOWERING && isEBflag)
4058       h1_scl_EoEtrueShowering_barrel->Fill(sclRef->energy() / mcIter->p());
4059     if (bestGsfElectron.classification() == GsfElectron::SHOWERING && isEEflag)
4060       h1_scl_EoEtrueShowering_endcaps->Fill(sclRef->energy() / mcIter->p());
4061 
4062     //eleClass = eleClass%100; // get rid of barrel/endcap distinction
4063     h1_ele_eta->Fill(std::abs(bestGsfElectron.eta()));
4064     if (bestGsfElectron.classification() == GsfElectron::GOLDEN)
4065       h1_ele_eta_golden->Fill(std::abs(bestGsfElectron.eta()));
4066     if (bestGsfElectron.classification() == GsfElectron::BIGBREM)
4067       h1_ele_eta_bbrem->Fill(std::abs(bestGsfElectron.eta()));
4068     if (bestGsfElectron.classification() == GsfElectron::SHOWERING)
4069       h1_ele_eta_shower->Fill(std::abs(bestGsfElectron.eta()));
4070 
4071     // fbrem
4072 
4073     double fbrem_mode = bestGsfElectron.fbrem();
4074     h1_ele_fbrem->Fill(fbrem_mode);
4075     if (passMiniAODSelection) {  // Pt > 5.
4076       h1_ele_fbrem_mAOD->Fill(fbrem_mode);
4077     }
4078     if (isEBflag) {
4079       double fbrem_mode_barrel = bestGsfElectron.fbrem();
4080       h1_ele_fbrem_barrel->Fill(fbrem_mode_barrel);
4081       if (passMiniAODSelection) {  // Pt > 5.
4082         h1_ele_fbrem_mAOD_barrel->Fill(fbrem_mode_barrel);
4083       }
4084     } else if (isEEflag) {
4085       double fbrem_mode_endcaps = bestGsfElectron.fbrem();
4086       h1_ele_fbrem_endcaps->Fill(fbrem_mode_endcaps);
4087       if (passMiniAODSelection) {  // Pt > 5.
4088         h1_ele_fbrem_mAOD_endcaps->Fill(fbrem_mode_endcaps);
4089       }
4090     }
4091 
4092     double superclusterfbrem_mode = bestGsfElectron.superClusterFbrem();
4093     h1_ele_superclusterfbrem->Fill(superclusterfbrem_mode);
4094 
4095     if (isEBflag) {
4096       double superclusterfbrem_mode_barrel = bestGsfElectron.superClusterFbrem();
4097       h1_ele_superclusterfbrem_barrel->Fill(superclusterfbrem_mode_barrel);
4098     } else if (isEEflag) {
4099       double superclusterfbrem_mode_endcaps = bestGsfElectron.superClusterFbrem();
4100       h1_ele_superclusterfbrem_endcaps->Fill(superclusterfbrem_mode_endcaps);
4101     }
4102 
4103     p1_ele_fbremVsEta_mode->Fill(bestGsfElectron.eta(), fbrem_mode);
4104 
4105     if (!readAOD_)  // track extra does not exist in AOD
4106     {
4107       double fbrem_mean =
4108           1. - bestGsfElectron.gsfTrack()->outerMomentum().R() / bestGsfElectron.gsfTrack()->innerMomentum().R();
4109       p1_ele_fbremVsEta_mean->Fill(bestGsfElectron.eta(), fbrem_mean);
4110     }
4111 
4112     //
4113 
4114     if (bestGsfElectron.classification() == GsfElectron::GOLDEN)
4115       h2_ele_PinVsPoutGolden_mode->Fill(bestGsfElectron.trackMomentumOut().R(),
4116                                         bestGsfElectron.trackMomentumAtVtx().R());
4117     if (bestGsfElectron.classification() == GsfElectron::SHOWERING)
4118       h2_ele_PinVsPoutShowering_mode->Fill(bestGsfElectron.trackMomentumOut().R(),
4119                                            bestGsfElectron.trackMomentumAtVtx().R());
4120     if (!readAOD_)  // track extra not available in AOD
4121     {
4122       if (bestGsfElectron.classification() == GsfElectron::GOLDEN)
4123         h2_ele_PinVsPoutGolden_mean->Fill(bestGsfElectron.gsfTrack()->outerMomentum().R(),
4124                                           bestGsfElectron.gsfTrack()->innerMomentum().R());
4125       if (bestGsfElectron.classification() == GsfElectron::SHOWERING)
4126         h2_ele_PinVsPoutShowering_mean->Fill(bestGsfElectron.gsfTrack()->outerMomentum().R(),
4127                                              bestGsfElectron.gsfTrack()->innerMomentum().R());
4128     }
4129     if (bestGsfElectron.classification() == GsfElectron::GOLDEN)
4130       h2_ele_PtinVsPtoutGolden_mode->Fill(bestGsfElectron.trackMomentumOut().Rho(),
4131                                           bestGsfElectron.trackMomentumAtVtx().Rho());
4132     if (bestGsfElectron.classification() == GsfElectron::SHOWERING)
4133       h2_ele_PtinVsPtoutShowering_mode->Fill(bestGsfElectron.trackMomentumOut().Rho(),
4134                                              bestGsfElectron.trackMomentumAtVtx().Rho());
4135     if (!readAOD_)  // track extra not available in AOD
4136     {
4137       if (bestGsfElectron.classification() == GsfElectron::GOLDEN)
4138         h2_ele_PtinVsPtoutGolden_mean->Fill(bestGsfElectron.gsfTrack()->outerMomentum().Rho(),
4139                                             bestGsfElectron.gsfTrack()->innerMomentum().Rho());
4140       if (bestGsfElectron.classification() == GsfElectron::SHOWERING)
4141         h2_ele_PtinVsPtoutShowering_mean->Fill(bestGsfElectron.gsfTrack()->outerMomentum().Rho(),
4142                                                bestGsfElectron.gsfTrack()->innerMomentum().Rho());
4143     }
4144 
4145     // provenance and pflow data
4146     h1_ele_mva->Fill(bestGsfElectron.mva_e_pi());
4147     h1_ele_mva_isolated->Fill(bestGsfElectron.mva_Isolated());
4148     if (isEBflag) {
4149       h1_ele_mva_barrel->Fill(bestGsfElectron.mva_e_pi());
4150       h1_ele_mva_barrel_isolated->Fill(bestGsfElectron.mva_Isolated());
4151     } else if (isEEflag) {
4152       h1_ele_mva_endcaps->Fill(bestGsfElectron.mva_e_pi());
4153       h1_ele_mva_endcaps_isolated->Fill(bestGsfElectron.mva_Isolated());
4154     }
4155     if (bestGsfElectron.ecalDrivenSeed()) {
4156       h1_ele_provenance->Fill(1.);
4157     }
4158     if (bestGsfElectron.trackerDrivenSeed()) {
4159       h1_ele_provenance->Fill(-1.);
4160     }
4161     if (bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) {
4162       h1_ele_provenance->Fill(0.);
4163     }
4164     if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed()) {
4165       h1_ele_provenance->Fill(-2.);
4166     }
4167     if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed()) {
4168       h1_ele_provenance->Fill(2.);
4169     } /**/
4170 
4171     if (bestGsfElectron.ecalDrivenSeed() && isEBflag)
4172       h1_ele_provenance_barrel->Fill(1.);
4173     if (bestGsfElectron.trackerDrivenSeed() && isEBflag)
4174       h1_ele_provenance_barrel->Fill(-1.);
4175     if ((bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) && isEBflag)
4176       h1_ele_provenance_barrel->Fill(0.);
4177     if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed() && isEBflag)
4178       h1_ele_provenance_barrel->Fill(-2.);
4179     if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed() && isEBflag)
4180       h1_ele_provenance_barrel->Fill(2.);
4181     if (bestGsfElectron.ecalDrivenSeed() && isEEflag)
4182       h1_ele_provenance_endcaps->Fill(1.);
4183     if (bestGsfElectron.trackerDrivenSeed() && isEEflag)
4184       h1_ele_provenance_endcaps->Fill(-1.);
4185     if ((bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) && isEEflag)
4186       h1_ele_provenance_endcaps->Fill(0.);
4187     if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed() && isEEflag)
4188       h1_ele_provenance_endcaps->Fill(-2.);
4189     if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed() && isEEflag)
4190       h1_ele_provenance_endcaps->Fill(2.);
4191 
4192     if (bestGsfElectron.isGsfCtfScPixChargeConsistent())
4193       h1_ele_chargeInfo->Fill(-1.0);
4194     if (bestGsfElectron.isGsfScPixChargeConsistent())
4195       h1_ele_chargeInfo->Fill(0.);
4196     if (bestGsfElectron.isGsfCtfChargeConsistent())
4197       h1_ele_chargeInfo->Fill(1.0);
4198 
4199     // Pflow isolation
4200     h1_ele_chargedHadronIso->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt);
4201     h1_ele_neutralHadronIso->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt);
4202     h1_ele_photonIso->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt);
4203     h1_ele_photonRelativeIso->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt());
4204     if (isEBflag) {
4205       h1_ele_chargedHadronIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt);
4206       h1_ele_neutralHadronIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt);
4207       h1_ele_photonIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt);
4208     }
4209 
4210     else if (isEEflag) {
4211       h1_ele_chargedHadronIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt);
4212       h1_ele_neutralHadronIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt);
4213       h1_ele_photonIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt);
4214     }
4215 
4216     // -- pflow over pT
4217     h1_ele_chargedHadronRelativeIso->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt /
4218                                           bestGsfElectron.pt());
4219     h1_ele_neutralHadronRelativeIso->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt /
4220                                           bestGsfElectron.pt());
4221     if (isEBflag) {
4222       h1_ele_chargedHadronRelativeIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt /
4223                                                    bestGsfElectron.pt());
4224       h1_ele_neutralHadronRelativeIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt /
4225                                                    bestGsfElectron.pt());
4226       h1_ele_photonRelativeIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt());
4227     } else if (isEEflag) {
4228       h1_ele_chargedHadronRelativeIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt /
4229                                                     bestGsfElectron.pt());
4230       h1_ele_neutralHadronRelativeIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt /
4231                                                     bestGsfElectron.pt());
4232       h1_ele_photonRelativeIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt());
4233     }
4234     if (passMiniAODSelection) {  // Pt > 5.
4235       h1_ele_chargedHadronRelativeIso_mAOD->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt /
4236                                                  bestGsfElectron.pt());
4237       h1_ele_neutralHadronRelativeIso_mAOD->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt /
4238                                                  bestGsfElectron.pt());
4239       h1_ele_photonRelativeIso_mAOD->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt());
4240       if (isEBflag) {
4241         h1_ele_chargedHadronRelativeIso_mAOD_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt /
4242                                                           bestGsfElectron.pt());
4243         h1_ele_neutralHadronRelativeIso_mAOD_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt /
4244                                                           bestGsfElectron.pt());
4245         h1_ele_photonRelativeIso_mAOD_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt /
4246                                                    bestGsfElectron.pt());
4247       } else if (isEEflag) {
4248         h1_ele_chargedHadronRelativeIso_mAOD_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt /
4249                                                            bestGsfElectron.pt());
4250         h1_ele_neutralHadronRelativeIso_mAOD_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt /
4251                                                            bestGsfElectron.pt());
4252         h1_ele_photonRelativeIso_mAOD_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt /
4253                                                     bestGsfElectron.pt());
4254       }
4255     }
4256 
4257     // isolation
4258     h1_ele_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt());
4259     h1_ele_ecalPFClusterIso->Fill(bestGsfElectron.ecalPFClusterIso());
4260     h1_ele_hcalPFClusterIso->Fill(bestGsfElectron.hcalPFClusterIso());
4261     h1_ele_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt());
4262     h1_ele_hcalTowerSumEt_dr03_depth1->Fill(bestGsfElectron.dr03HcalTowerSumEt(1));
4263     h1_ele_hcalTowerSumEt_dr03_depth2->Fill(bestGsfElectron.dr03HcalTowerSumEt(2));
4264     h1_ele_hcalTowerSumEtBc_dr03_depth1->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1));
4265     h1_ele_hcalTowerSumEtBc_dr03_depth2->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2));
4266     h1_ele_hcalDepth1OverEcalBc->Fill(bestGsfElectron.hcalOverEcalBc(1));
4267     h1_ele_hcalDepth2OverEcalBc->Fill(bestGsfElectron.hcalOverEcalBc(2));
4268     if (isEBflag) {
4269       h1_ele_tkSumPt_dr03_barrel->Fill(bestGsfElectron.dr03TkSumPt());
4270       h1_ele_ecalRecHitSumEt_dr03_barrel->Fill(bestGsfElectron.dr03EcalRecHitSumEt());
4271       h1_ele_hcalTowerSumEt_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEt(1));
4272       h1_ele_hcalTowerSumEt_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEt(2));
4273       h1_ele_hcalTowerSumEtBc_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1));
4274       h1_ele_hcalTowerSumEtBc_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2));
4275       h1_ele_hcalDepth1OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(1));
4276       h1_ele_hcalDepth2OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(2));
4277       h1_ele_ecalPFClusterIso_barrel->Fill(bestGsfElectron.ecalPFClusterIso());
4278       h1_ele_hcalPFClusterIso_barrel->Fill(bestGsfElectron.hcalPFClusterIso());
4279     } else if (isEEflag) {
4280       h1_ele_tkSumPt_dr03_endcaps->Fill(bestGsfElectron.dr03TkSumPt());
4281       h1_ele_ecalRecHitSumEt_dr03_endcaps->Fill(bestGsfElectron.dr03EcalRecHitSumEt());
4282       h1_ele_hcalTowerSumEt_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEt(1));
4283       h1_ele_hcalTowerSumEt_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEt(2));
4284       h1_ele_hcalTowerSumEtBc_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1));
4285       h1_ele_hcalTowerSumEtBc_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2));
4286       h1_ele_hcalDepth1OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(1));
4287       h1_ele_hcalDepth2OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(2));
4288       h1_ele_ecalPFClusterIso_endcaps->Fill(bestGsfElectron.ecalPFClusterIso());
4289       h1_ele_hcalPFClusterIso_endcaps->Fill(bestGsfElectron.hcalPFClusterIso());
4290     }
4291 
4292     // conversion rejection
4293     int flags = bestGsfElectron.convFlags();
4294     if (flags == -9999) {
4295       flags = -1;
4296     }
4297     h1_ele_convFlags->Fill(flags);
4298     if (flags >= 0.) {
4299       h1_ele_convDist->Fill(bestGsfElectron.convDist());
4300       h1_ele_convDcot->Fill(bestGsfElectron.convDcot());
4301       h1_ele_convRadius->Fill(bestGsfElectron.convRadius());
4302     }
4303 
4304   }  // loop over mc particle
4305   h1_mcNum->Fill(mcNum);
4306   h1_eleNum->Fill(eleNum);
4307 }