Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:33:01

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