Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-09-21 22:40:28

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