Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-01-13 23:40:13

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