From 244ddecd69c6bb17dec652ed5e7d230f08d0868c Mon Sep 17 00:00:00 2001 From: Arnaud Date: Tue, 7 Sep 2021 16:19:44 +0200 Subject: [PATCH 1/8] Phase2_RECO_miniAOD_vectorization_V1 : python part --- ...tronMcFakeValidator_gedGsfElectrons_cfi.py | 5 +-- .../ElectronMcSignalValidatorMiniAOD_cfi.py | 45 +++++++++---------- ...gnalValidatorPt1000_gedGsfElectrons_cfi.py | 9 +--- ...onMcSignalValidator_gedGsfElectrons_cfi.py | 19 +------- 4 files changed, 26 insertions(+), 52 deletions(-) diff --git a/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py index 1282976882da5..b06c58fbfb5ea 100644 --- a/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py @@ -38,12 +38,11 @@ matchingObjectCollection = cms.InputTag("ak4GenJets"), electronCollection = cms.InputTag("gedGsfElectrons"), + electronCollectionEndcaps = cms.InputTag("gedGsfElectrons"), electronCoreCollection = cms.InputTag("gedGsfElectronCores"), electronTrackCollection = cms.InputTag("electronGsfTracks"), electronSeedCollection = cms.InputTag("electronMergedSeeds"), - # ajout 04/02/2015 offlinePrimaryVertices = cms.InputTag("offlinePrimaryVertices"), - # fin ajout beamSpot = cms.InputTag("offlineBeamSpot"), readAOD = cms.bool(False), @@ -66,7 +65,7 @@ from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify( electronMcFakeValidator, - electronCollection = 'ecalDrivenGsfElectronsHGC', + electronCollectionEndcaps = 'ecalDrivenGsfElectronsHGC', electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', MaxAbsEta = cms.double(3.0), histosCfg = dict( diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py index 44ff038e33eea..fc47bee9d7a08 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py @@ -17,7 +17,8 @@ Nbinmee=cms.int32(100), Meemin=cms.double(0.0), Meemax=cms.double(150.), Nbinhoe=cms.int32(100), Hoemin=cms.double(0.0), Hoemax=cms.double(0.5), Nbinpoptrue=cms.int32(75), Poptruemin=cms.double(0.0), Poptruemax=cms.double(1.5), - EfficiencyFlag=cms.bool(True), StatOverflowFlag=cms.bool(False) + EfficiencyFlag=cms.bool(True), StatOverflowFlag=cms.bool(False), + NbinELE = cms.int32(11), ELE_min = cms.double(-0.5), ELE_max = cms.double(10.5), # ELE : recEleNum ) electronPFIsolationCfg = cms.PSet( @@ -25,43 +26,37 @@ _gedGsfElectrons.pfIsolationValues.pfSumChargedHadronPt.getProductInstanceLabel()), pfSumNeutralHadronEtTmp=cms.InputTag("miniAODElectronIsolation", _gedGsfElectrons.pfIsolationValues.pfSumNeutralHadronEt.getProductInstanceLabel()), - # pfSumPhotonEtTmp=cms.InputTag("miniAODElectronIsolation", - _gedGsfElectrons.pfIsolationValues.pfSumPhotonEt.getProductInstanceLabel()), # + _gedGsfElectrons.pfIsolationValues.pfSumPhotonEt.getProductInstanceLabel()), ) from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer electronMcSignalValidatorMiniAOD = DQMEDAnalyzer('ElectronMcSignalValidatorMiniAOD', - Verbosity=cms.untracked.int32(0), - FinalStep=cms.string("AtJobEnd"), - InputFile=cms.string(""), - OutputFile=cms.string(""), - InputFolderName=cms.string("EgammaV/ElectronMcSignalValidatorMiniAOD"), - # - OutputFolderName=cms.string( - "EgammaV/ElectronMcSignalValidatorMiniAOD"), # + Verbosity=cms.untracked.int32(0), + FinalStep=cms.string("AtJobEnd"), + InputFile=cms.string(""), + OutputFile=cms.string(""), + InputFolderName=cms.string("EgammaV/ElectronMcSignalValidatorMiniAOD"), + OutputFolderName=cms.string("EgammaV/ElectronMcSignalValidatorMiniAOD"), + mcTruthCollection=cms.InputTag("prunedGenParticles"), + electrons=cms.InputTag("slimmedElectrons"), + electrons_endcaps=cms.InputTag("slimmedElectrons"), - mcTruthCollection=cms.InputTag("prunedGenParticles"), - electrons=cms.InputTag("slimmedElectrons"), - electrons_endcaps=cms.InputTag("slimmedElectrons"), - # temp for miniAOD tests - - MaxPt=cms.double(100.0), - DeltaR=cms.double(0.05), - MaxAbsEta=cms.double(2.5), - MatchingID=cms.vint32(11, -11), - MatchingMotherID=cms.vint32(23, 24, -24, 32), - histosCfg=cms.PSet(electronMcSignalHistosCfg), - isolationCfg=cms.PSet(electronPFIsolationCfg), - ) + MaxPt=cms.double(100.0), + DeltaR=cms.double(0.05), + MaxAbsEta=cms.double(2.5), + MatchingID=cms.vint32(11, -11), + MatchingMotherID=cms.vint32(23, 24, -24, 32), + histosCfg=cms.PSet(electronMcSignalHistosCfg), + isolationCfg=cms.PSet(electronPFIsolationCfg), +) from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify( electronMcSignalValidatorMiniAOD, - # electrons = cms.InputTag("slimmedElectronsHGC"), electrons_endcaps=cms.InputTag("slimmedElectronsHGC"), MaxAbsEta=cms.double(3.0), histosCfg=dict( diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py index 1f78607019781..b0f9897874206 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py @@ -3,7 +3,6 @@ electronMcSignalHistosCfg = cms.PSet( Nbinxyz = cms.int32(50), Nbinp = cms.int32(50), Nbinp2D = cms.int32(50), -# Pmax = cms.double(300.0), Pmax = cms.double(4500), Nbinpt = cms.int32(50), Nbinpt2D = cms.int32(50), Nbinpteff = cms.int32(19),Ptmax = cms.double(1500.0), Nbinfhits = cms.int32(30), Fhitsmax = cms.double(30.0), @@ -15,7 +14,6 @@ Nbindphi = cms.int32(100), Dphimin = cms.double(-0.01), Dphimax = cms.double(0.01), Nbindphimatch = cms.int32(100), Nbindphimatch2D = cms.int32(50), Dphimatchmin = cms.double(-0.2), Dphimatchmax = cms.double(0.2), Nbineop = cms.int32(50), Nbineop2D = cms.int32(30), -# Eopmax = cms.double(5.0), Eopmax = cms.double(10), Eopmaxsht = cms.double(3.0), Nbinmee = cms.int32(100), Meemin = cms.double(0.0), Meemax = cms.double(150.), @@ -42,12 +40,11 @@ mcTruthCollection = cms.InputTag("genParticles"), electronCollection = cms.InputTag("gedGsfElectrons"), + electronCollectionEndcaps = cms.InputTag("gedGsfElectrons"), electronCoreCollection = cms.InputTag("gedGsfElectronCores"), electronTrackCollection = cms.InputTag("electronGsfTracks"), electronSeedCollection = cms.InputTag("electronMergedSeeds"), - # ajout 04/02/2015 offlinePrimaryVertices = cms.InputTag("offlinePrimaryVertices"), - # fin ajout beamSpot = cms.InputTag("offlineBeamSpot"), readAOD = cms.bool(False), @@ -72,10 +69,8 @@ from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify( electronMcSignalValidatorPt1000, - electronCollection = 'ecalDrivenGsfElectronsHGC', + electronCollectionEndcaps = cms.InputTag("ecalDrivenGsfElectronsHGC"), electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', - electronTrackCollection = 'electronGsfTracks', - electronSeedCollection = 'electronMergedSeeds', MaxAbsEta = cms.double(3.0), histosCfg = dict( Nbineta = 60 , diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py index f3f47c4a18352..d4b533cbf7d73 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py @@ -34,16 +34,14 @@ OutputFile = cms.string(""), InputFolderName = cms.string("EgammaV/ElectronMcSignalValidator"), OutputFolderName = cms.string("EgammaV/ElectronMcSignalValidator"), -# OutputMEsInRootFile = cms.bool(True), mcTruthCollection = cms.InputTag("genParticles"), electronCollection = cms.InputTag("gedGsfElectrons"), + electronCollectionEndcaps = cms.InputTag("gedGsfElectrons"), electronCoreCollection = cms.InputTag("gedGsfElectronCores"), electronTrackCollection = cms.InputTag("electronGsfTracks"), electronSeedCollection = cms.InputTag("electronMergedSeeds"), - # ajout 03/02/2015 offlinePrimaryVertices = cms.InputTag("offlinePrimaryVertices"), - # fin ajout beamSpot = cms.InputTag("offlineBeamSpot"), readAOD = cms.bool(False), @@ -56,15 +54,6 @@ isoFromDepsHcal03 = cms.InputTag(""), isoFromDepsHcal04 = cms.InputTag(""), -# isoFromDepsTk03 = cms.InputTag("eleIsoFromDepsTk03"), -# isoFromDepsTk04 = cms.InputTag("eleIsoFromDepsTk04"), -# isoFromDepsEcalFull03 = cms.InputTag("eleIsoFromDepsEcalFromHitsByCrystalFull03"), -# isoFromDepsEcalFull04 = cms.InputTag("eleIsoFromDepsEcalFromHitsByCrystalFull04"), -# isoFromDepsEcalReduced03 = cms.InputTag("eleIsoFromDepsEcalFromHitsByCrystalReduced03"), -# isoFromDepsEcalReduced04 = cms.InputTag("eleIsoFromDepsEcalFromHitsByCrystalReduced04"), -# isoFromDepsHcal03 = cms.InputTag("eleIsoFromDepsHcalFromTowers03"), -# isoFromDepsHcal04 = cms.InputTag("eleIsoFromDepsHcalFromTowers04"), - MaxPt = cms.double(100.0), DeltaR = cms.double(0.05), MaxAbsEta = cms.double(2.5), @@ -76,12 +65,8 @@ from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal phase2_hgcal.toModify( electronMcSignalValidator, -# electronCollection = cms.InputTag("ecalDrivenGsfElectrons"), -# electronCoreCollection = cms.InputTag("ecalDrivenGsfElectronCores"), - electronCollection = 'ecalDrivenGsfElectronsHGC', + electronCollectionEndcaps = 'ecalDrivenGsfElectronsHGC', electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', - electronTrackCollection = 'electronGsfTracks', - electronSeedCollection = 'electronMergedSeeds', MaxAbsEta = cms.double(3.0), histosCfg = dict( Nbineta = 60 , From e7d4cc584d1fb03bfbfe09adb77eb90612ff0273 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Tue, 7 Sep 2021 16:22:51 +0200 Subject: [PATCH 2/8] Phase2_RECO_miniAOD_vectorization_V2 : headers part --- .../RecoEgamma/plugins/ElectronMcFakeValidator.h | 12 ++++++------ .../plugins/ElectronMcMiniAODSignalValidator.h | 8 ++++---- .../RecoEgamma/plugins/ElectronMcSignalValidator.h | 6 +----- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h index 8064d0e684a9f..b7cb107b0b083 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h @@ -40,11 +40,12 @@ class ElectronMcFakeValidator : public ElectronDqmAnalyzerBase { private: edm::EDGetTokenT electronCollection_; + edm::EDGetTokenT electronCollectionEndcaps_; edm::EDGetTokenT electronCoreCollection_; edm::EDGetTokenT electronTrackCollection_; edm::EDGetTokenT electronSeedCollection_; edm::EDGetTokenT matchingObjectCollection_; - edm::EDGetTokenT offlineVerticesCollection_; // new 2015.04.02 + edm::EDGetTokenT offlineVerticesCollection_; edm::EDGetTokenT beamSpotTag_; bool readAOD_; @@ -148,7 +149,7 @@ class ElectronMcFakeValidator : public ElectronDqmAnalyzerBase { MonitorElement *h1_recTrackNum_; MonitorElement *h1_recSeedNum_; - MonitorElement *h1_recOfflineVertices_; // new 2015.04.02 + MonitorElement *h1_recOfflineVertices_; MonitorElement *h1_matchingObjectEta; MonitorElement *h1_matchingObjectAbsEta; @@ -232,9 +233,9 @@ class ElectronMcFakeValidator : public ElectronDqmAnalyzerBase { MonitorElement *h1_scl_SigIEtaIEta_; MonitorElement *h1_scl_SigIEtaIEta_barrel_; MonitorElement *h1_scl_SigIEtaIEta_endcaps_; - MonitorElement *h1_scl_full5x5_sigmaIetaIeta_; // new 2014.01.12 - MonitorElement *h1_scl_full5x5_sigmaIetaIeta_barrel_; // new 2014.01.12 - MonitorElement *h1_scl_full5x5_sigmaIetaIeta_endcaps_; // new 2014.01.12 + MonitorElement *h1_scl_full5x5_sigmaIetaIeta_; + MonitorElement *h1_scl_full5x5_sigmaIetaIeta_barrel_; + MonitorElement *h1_scl_full5x5_sigmaIetaIeta_endcaps_; MonitorElement *h1_scl_E1x5_; MonitorElement *h1_scl_E1x5_barrel_; MonitorElement *h1_scl_E1x5_endcaps_; @@ -381,7 +382,6 @@ class ElectronMcFakeValidator : public ElectronDqmAnalyzerBase { MonitorElement *h2_ele_HoEVsEta; MonitorElement *h2_ele_HoEVsPhi; MonitorElement *h2_ele_HoEVsE; - // MonitorElement *h1_scl_ESFrac; MonitorElement *h1_scl_ESFrac_endcaps; MonitorElement *h1_ele_fbrem; diff --git a/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.h b/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.h index 687a3c98d53c0..fbd9d11e02788 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.h +++ b/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.h @@ -3,9 +3,6 @@ #include "DQMOffline/EGamma/interface/ElectronDqmAnalyzerBase.h" -// system include files -//#include - // user include files #include "FWCore/Framework/interface/Event.h" @@ -33,7 +30,7 @@ class ElectronMcSignalValidatorMiniAOD : public ElectronDqmAnalyzerBase { edm::EDGetTokenT > pfSumChargedHadronPtTmp_; edm::EDGetTokenT > pfSumNeutralHadronEtTmp_; - edm::EDGetTokenT > pfSumPhotonEtTmp_; /**/ + edm::EDGetTokenT > pfSumPhotonEtTmp_; float pt_; double maxPt_; @@ -85,6 +82,9 @@ class ElectronMcSignalValidatorMiniAOD : public ElectronDqmAnalyzerBase { double poptrue_max; bool set_EfficiencyFlag; bool set_StatOverflowFlag; + int ele_nbin; + double ele_min; + double ele_max; // histos diff --git a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h index 932d928a6d47c..5a42cbc8f779d 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h +++ b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h @@ -32,6 +32,7 @@ class ElectronMcSignalValidator : public ElectronDqmAnalyzerBase { private: edm::EDGetTokenT mcTruthCollection_; // genParticles edm::EDGetTokenT electronCollection_; // gedGsfElectrons + edm::EDGetTokenT electronCollectionEndcaps_; // gedGsfElectrons edm::EDGetTokenT electronCoreCollection_; // gedGsfElectronCore edm::EDGetTokenT electronTrackCollection_; edm::EDGetTokenT electronSeedCollection_; @@ -178,11 +179,7 @@ class ElectronMcSignalValidator : public ElectronDqmAnalyzerBase { MonitorElement *h1_ele_EseedOP_all_barrel; MonitorElement *h1_ele_EseedOP_all_endcaps; MonitorElement *h1_ele_EoPout_all; - MonitorElement *h1_ele_EoPout_all_barrel; - MonitorElement *h1_ele_EoPout_all_endcaps; MonitorElement *h1_ele_EeleOPout_all; - MonitorElement *h1_ele_EeleOPout_all_barrel; - MonitorElement *h1_ele_EeleOPout_all_endcaps; MonitorElement *h1_ele_dEtaSc_propVtx_all; MonitorElement *h1_ele_dEtaSc_propVtx_all_barrel; MonitorElement *h1_ele_dEtaSc_propVtx_all_endcaps; @@ -267,7 +264,6 @@ class ElectronMcSignalValidator : public ElectronDqmAnalyzerBase { MonitorElement *h2_scl_EtaVsPhi; MonitorElement *h1_scl_Eta; MonitorElement *h1_scl_Phi; - // MonitorElement *h1_scl_ESFrac; MonitorElement *h1_scl_ESFrac_endcaps; MonitorElement *h2_scl_EoEtruePfVsEg; From 11f1a6c4916a7a4fbaa1e51141476238b6f20b8b Mon Sep 17 00:00:00 2001 From: Arnaud Date: Tue, 7 Sep 2021 16:24:16 +0200 Subject: [PATCH 3/8] Phase2_RECO_miniAOD_vectorization_V2 : cpp module part --- .../plugins/ElectronMcFakeValidator.cc | 332 +++++----- .../ElectronMcMiniAODSignalValidator.cc | 119 ++-- .../plugins/ElectronMcSignalValidator.cc | 580 ++++++++---------- 3 files changed, 490 insertions(+), 541 deletions(-) diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc index fc23067113e83..6f87f24e27c48 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc @@ -44,6 +44,8 @@ using namespace reco; ElectronMcFakeValidator::ElectronMcFakeValidator(const edm::ParameterSet &conf) : ElectronDqmAnalyzerBase(conf) { electronCollection_ = consumes(conf.getParameter("electronCollection")); + electronCollectionEndcaps_ = + consumes(conf.getParameter("electronCollectionEndcaps")); electronCoreCollection_ = consumes(conf.getParameter("electronCoreCollection")); electronTrackCollection_ = @@ -257,9 +259,9 @@ ElectronMcFakeValidator::ElectronMcFakeValidator(const edm::ParameterSet &conf) h1_scl_SigIEtaIEta_ = nullptr; h1_scl_SigIEtaIEta_barrel_ = nullptr; h1_scl_SigIEtaIEta_endcaps_ = nullptr; - h1_scl_full5x5_sigmaIetaIeta_ = nullptr; // new 2014.01.12 - h1_scl_full5x5_sigmaIetaIeta_barrel_ = nullptr; // new 2014.01.12 - h1_scl_full5x5_sigmaIetaIeta_endcaps_ = nullptr; // new 2014.01.12 + h1_scl_full5x5_sigmaIetaIeta_ = nullptr; + h1_scl_full5x5_sigmaIetaIeta_barrel_ = nullptr; + h1_scl_full5x5_sigmaIetaIeta_endcaps_ = nullptr; h1_scl_E1x5_ = nullptr; h1_scl_E1x5_barrel_ = nullptr; h1_scl_E1x5_endcaps_ = nullptr; @@ -403,7 +405,6 @@ ElectronMcFakeValidator::ElectronMcFakeValidator(const edm::ParameterSet &conf) h2_ele_HoEVsEta = nullptr; h2_ele_HoEVsPhi = nullptr; h2_ele_HoEVsE = nullptr; - // h1_scl_ESFrac = 0 ; h1_scl_ESFrac_endcaps = nullptr; h1_ele_fbrem = nullptr; @@ -470,7 +471,6 @@ void ElectronMcFakeValidator::bookHistograms(DQMStore::IBooker &iBooker, edm::Ru // matching object type std::string matchingObjectType; - // Emilia matchingObjectType = "GenJet"; std::string htitle = "# " + matchingObjectType + "s", xtitle = "N_{" + matchingObjectType + "}"; @@ -887,7 +887,6 @@ void ElectronMcFakeValidator::bookHistograms(DQMStore::IBooker &iBooker, edm::Ru "#sigma_{i#eta i#eta}", "Events", "ELE_LOGY E1 P"); - // new 2014.01.12 h1_scl_full5x5_sigmaIetaIeta_ = bookH1withSumw2(iBooker, "full5x5_sigietaieta", "ele supercluster full5x5 sigma ieta ieta", @@ -915,7 +914,6 @@ void ElectronMcFakeValidator::bookHistograms(DQMStore::IBooker &iBooker, edm::Ru "#sigma_{i#eta i#eta}", "Events", "ELE_LOGY E1 P"); - // new 2014.01.12 h1_scl_E1x5_ = bookH1withSumw2( iBooker, "E1x5", "ele supercluster energy in 1x5", p_nbin, 0., p_max, "E1x5 (GeV)", "Events", "ELE_LOGY E1 P"); h1_scl_E1x5_barrel_ = bookH1withSumw2(iBooker, @@ -1720,7 +1718,6 @@ void ElectronMcFakeValidator::bookHistograms(DQMStore::IBooker &iBooker, edm::Ru h2_ele_HoEVsE = bookH2(iBooker, "HoEVsE", "ele hadronic energy / em energy vs E", p_nbin, 0., 300., hoe_nbin, hoe_min, hoe_max); setBookPrefix("h_scl"); - // h1_scl_ESFrac = bookH1withSumw2(iBooker, "ESFrac","Preshower over SC raw energy",100,0.,0.8,"E_{PS} / E^{raw}_{SC}","Events","ELE_LOGY E1 P"); h1_scl_ESFrac_endcaps = bookH1withSumw2(iBooker, "ESFrac_endcaps", "Preshower over SC raw energy , endcaps", @@ -2411,10 +2408,18 @@ ElectronMcFakeValidator::~ElectronMcFakeValidator() {} void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // get reco electrons auto gsfElectrons = iEvent.getHandle(electronCollection_); + auto gsfElectronsEndcaps = iEvent.getHandle(electronCollectionEndcaps_); auto gsfElectronCores = iEvent.getHandle(electronCoreCollection_); auto gsfElectronTracks = iEvent.getHandle(electronTrackCollection_); auto gsfElectronSeeds = iEvent.getHandle(electronSeedCollection_); + // get gen jets + auto genJets = iEvent.getHandle(matchingObjectCollection_); + + // get the beamspot from the Event: + auto recoBeamSpotHandle = iEvent.getHandle(beamSpotTag_); + const BeamSpot bs = *recoBeamSpotHandle; + auto isoFromDepsTk03Handle = iEvent.getHandle(isoFromDepsTk03Tag_); auto isoFromDepsTk04Handle = iEvent.getHandle(isoFromDepsTk04Tag_); auto isoFromDepsEcalFull03Handle = iEvent.getHandle(isoFromDepsEcalFull03Tag_); @@ -2424,8 +2429,6 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event auto isoFromDepsHcal03Handle = iEvent.getHandle(isoFromDepsHcal03Tag_); auto isoFromDepsHcal04Handle = iEvent.getHandle(isoFromDepsHcal04Tag_); - /*edm::Handle vertexCollectionHandle; - iEvent.getByToken(offlineVerticesCollection_, vertexCollectionHandle);*/ auto vertexCollectionHandle = iEvent.getHandle(offlineVerticesCollection_); if (!vertexCollectionHandle.isValid()) { edm::LogInfo("ElectronMcFakeValidator::analyze") << "vertexCollectionHandle KO"; @@ -2433,71 +2436,93 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event edm::LogInfo("ElectronMcFakeValidator::analyze") << "vertexCollectionHandle OK"; } - // get gen jets - auto genJets = iEvent.getHandle(matchingObjectCollection_); - - // get the beamspot from the Event: - auto recoBeamSpotHandle = iEvent.getHandle(beamSpotTag_); - const BeamSpot bs = *recoBeamSpotHandle; - edm::LogInfo("ElectronMcFakeValidator::analyze") << "Treating event " << iEvent.id() << " with " << gsfElectrons.product()->size() << " electrons"; + edm::LogInfo("ElectronMcSignalValidator::analyze") + << "Treating event " << iEvent.id() << " with " << gsfElectronsEndcaps.product()->size() << " electrons"; + h1_recEleNum_->Fill((*gsfElectrons).size()); h1_recCoreNum_->Fill((*gsfElectronCores).size()); h1_recTrackNum_->Fill((*gsfElectronTracks).size()); h1_recSeedNum_->Fill((*gsfElectronSeeds).size()); h1_recOfflineVertices_->Fill((*vertexCollectionHandle).size()); - // all rec electrons reco::GsfElectronCollection::const_iterator gsfIter; + std::vector ::const_iterator gsfIter3; + std::vector ::const_iterator gsfIter4; + + //=============================================== + // get a vector with EB & EE + //=============================================== + std::vector localCollection; + int iBarrels = 0; + int iEndcaps = 0; + + // looking for EB for (gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end(); gsfIter++) { + if (gsfIter->isEB()) + { + localCollection.push_back( *gsfIter ); + iBarrels += 1; + } + } + + // looking for EE + for (gsfIter = gsfElectronsEndcaps->begin(); gsfIter != gsfElectronsEndcaps->end(); gsfIter++) { + if (gsfIter->isEE()) + { + localCollection.push_back(*gsfIter); + iEndcaps += 1; + } + } + + // all rec electrons + for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) { // preselect electrons - if (gsfIter->pt() > maxPt_ || std::abs(gsfIter->eta()) > maxAbsEta_) { + if (gsfIter3->pt() > maxPt_ || std::abs(gsfIter3->eta()) > maxAbsEta_) continue; - } - h1_ele_EoverP_all->Fill(gsfIter->eSuperClusterOverP()); - h1_ele_EseedOP_all->Fill(gsfIter->eSeedClusterOverP()); - h1_ele_EoPout_all->Fill(gsfIter->eSeedClusterOverPout()); - h1_ele_EeleOPout_all->Fill(gsfIter->eEleClusterOverPout()); - h1_ele_dEtaSc_propVtx_all->Fill(gsfIter->deltaEtaSuperClusterTrackAtVtx()); - h1_ele_dPhiSc_propVtx_all->Fill(gsfIter->deltaPhiSuperClusterTrackAtVtx()); - h1_ele_dEtaCl_propOut_all->Fill(gsfIter->deltaEtaSeedClusterTrackAtCalo()); - h1_ele_dPhiCl_propOut_all->Fill(gsfIter->deltaPhiSeedClusterTrackAtCalo()); - h1_ele_HoE_all->Fill(gsfIter->hadronicOverEm()); - h1_ele_HoE_bc_all->Fill(gsfIter->hcalOverEcalBc()); - double d = gsfIter->vertex().x() * gsfIter->vertex().x() + gsfIter->vertex().y() * gsfIter->vertex().y(); + h1_ele_EoverP_all->Fill(gsfIter3->eSuperClusterOverP()); + h1_ele_EseedOP_all->Fill(gsfIter3->eSeedClusterOverP()); + h1_ele_EoPout_all->Fill(gsfIter3->eSeedClusterOverPout()); + h1_ele_EeleOPout_all->Fill(gsfIter3->eEleClusterOverPout()); + h1_ele_dEtaSc_propVtx_all->Fill(gsfIter3->deltaEtaSuperClusterTrackAtVtx()); + h1_ele_dPhiSc_propVtx_all->Fill(gsfIter3->deltaPhiSuperClusterTrackAtVtx()); + h1_ele_dEtaCl_propOut_all->Fill(gsfIter3->deltaEtaSeedClusterTrackAtCalo()); + h1_ele_dPhiCl_propOut_all->Fill(gsfIter3->deltaPhiSeedClusterTrackAtCalo()); + h1_ele_HoE_all->Fill(gsfIter3->hadronicOverEm()); + h1_ele_HoE_bc_all->Fill(gsfIter3->hcalOverEcalBc()); + double d = gsfIter3->vertex().x() * gsfIter3->vertex().x() + gsfIter3->vertex().y() * gsfIter3->vertex().y(); h1_ele_TIP_all->Fill(sqrt(d)); - h1_ele_vertexEta_all->Fill(gsfIter->eta()); - h1_ele_vertexPt_all->Fill(gsfIter->pt()); - float enrj1 = gsfIter->ecalEnergy(); + h1_ele_vertexEta_all->Fill(gsfIter3->eta()); + h1_ele_vertexPt_all->Fill(gsfIter3->pt()); + float enrj1 = gsfIter3->ecalEnergy(); // mee - reco::GsfElectronCollection::const_iterator gsfIter2; - for (gsfIter2 = gsfIter + 1; gsfIter2 != gsfElectrons->end(); gsfIter2++) { - math::XYZTLorentzVector p12 = (*gsfIter).p4() + (*gsfIter2).p4(); + for (gsfIter4 = gsfIter3 + 1; gsfIter4 != localCollection.end(); gsfIter4++) { + math::XYZTLorentzVector p12 = (*gsfIter3).p4() + (*gsfIter4).p4(); float mee2 = p12.Dot(p12); h1_ele_mee_all->Fill(sqrt(mee2)); - float enrj2 = gsfIter2->ecalEnergy(); + float enrj2 = gsfIter4->ecalEnergy(); h2_ele_E2mnE1vsMee_all->Fill(sqrt(mee2), enrj2 - enrj1); - if (gsfIter->ecalDrivenSeed() && gsfIter2->ecalDrivenSeed()) { + if (gsfIter3->ecalDrivenSeed() && gsfIter4->ecalDrivenSeed()) { h2_ele_E2mnE1vsMee_egeg_all->Fill(sqrt(mee2), enrj2 - enrj1); } - if (gsfIter->charge() * gsfIter2->charge() < 0.) { + if (gsfIter3->charge() * gsfIter4->charge() < 0.) { h1_ele_mee_os->Fill(sqrt(mee2)); } } // conversion rejection - int flags = gsfIter->convFlags(); + int flags = gsfIter3->convFlags(); if (flags == -9999) { flags = -1; } h1_ele_convFlags_all->Fill(flags); if (flags >= 0.) { - h1_ele_convDist_all->Fill(gsfIter->convDist()); - h1_ele_convDcot_all->Fill(gsfIter->convDcot()); - h1_ele_convRadius_all->Fill(gsfIter->convRadius()); + h1_ele_convDist_all->Fill(gsfIter3->convDist()); + h1_ele_convDcot_all->Fill(gsfIter3->convDcot()); + h1_ele_convRadius_all->Fill(gsfIter3->convRadius()); } } @@ -2512,11 +2537,6 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event continue; } - // suppress the endcaps - //if (std::abs(moIter->eta()) > 1.5) continue; - // select central z - //if ( std::abs((*mcIter)->production_vertex()->position().z())>50.) continue; - h1_matchingObjectEta->Fill(moIter->eta()); h1_matchingObjectAbsEta->Fill(std::abs(moIter->eta())); h1_matchingObjectP->Fill(moIter->energy()); @@ -2527,34 +2547,32 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event // looking for the best matching gsf electron bool okGsfFound = false; double gsfOkRatio = 999999.; + bool isEBflag = false; + bool isEEflag = false; // find best matched electron reco::GsfElectron bestGsfElectron; - reco::GsfElectronRef bestGsfElectronRef; - reco::GsfElectronCollection::const_iterator gsfIter; - reco::GsfElectronCollection::size_type iElectron; - for (gsfIter = gsfElectrons->begin(), iElectron = 0; gsfIter != gsfElectrons->end(); gsfIter++, iElectron++) { - double dphi = gsfIter->phi() - moIter->phi(); + + for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) { + double dphi = gsfIter3->phi() - moIter->phi(); if (std::abs(dphi) > CLHEP::pi) { dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi; } - double deltaR = sqrt(pow((gsfIter->eta() - moIter->eta()), 2) + pow(dphi, 2)); + double deltaR = sqrt(pow((gsfIter3->eta() - moIter->eta()), 2) + pow(dphi, 2)); if (deltaR < deltaR_) { - //if ( (genPc->pdg_id() == 11) && (gsfIter->charge() < 0.) || (genPc->pdg_id() == -11) && - //(gsfIter->charge() > 0.) ){ - double tmpGsfRatio = gsfIter->p() / moIter->energy(); + double tmpGsfRatio = gsfIter3->p() / moIter->energy(); if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) { gsfOkRatio = tmpGsfRatio; - bestGsfElectronRef = reco::GsfElectronRef(gsfElectrons, iElectron); - bestGsfElectron = *gsfIter; + bestGsfElectron = *gsfIter3; okGsfFound = true; } - //} } } // loop over rec ele to look for the best one // analysis when the matching object is matched by a rec electron if (okGsfFound) { + isEBflag = bestGsfElectron.isEB(); + isEEflag = bestGsfElectron.isEE(); // electron related distributions h1_ele_charge->Fill(bestGsfElectron.charge()); h2_ele_chargeVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.charge()); @@ -2597,9 +2615,9 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event h2_ele_PoPmatchingObjectVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.p() / moIter->energy()); h2_ele_PoPmatchingObjectVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.p() / moIter->energy()); h2_ele_PoPmatchingObjectVsPt->Fill(bestGsfElectron.py(), bestGsfElectron.p() / moIter->energy()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_PoPmatchingObject_barrel->Fill(bestGsfElectron.p() / moIter->energy()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_PoPmatchingObject_endcaps->Fill(bestGsfElectron.p() / moIter->energy()); // supercluster related distributions @@ -2613,42 +2631,40 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event h1_scl_Et_->Fill(sclRef->energy() * (Rt / R)); h2_scl_EtVsEta_->Fill(sclRef->eta(), sclRef->energy() * (Rt / R)); h2_scl_EtVsPhi_->Fill(sclRef->phi(), sclRef->energy() * (Rt / R)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_EoEmatchingObject_barrel->Fill(sclRef->energy() / moIter->energy()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_EoEmatchingObject_endcaps->Fill(sclRef->energy() / moIter->energy()); h1_scl_Eta_->Fill(sclRef->eta()); h2_scl_EtaVsPhi_->Fill(sclRef->phi(), sclRef->eta()); h1_scl_Phi_->Fill(sclRef->phi()); - /*New from 06 05 2016*/ - // h1_scl_ESFrac->Fill( sclRef->preshowerEnergy() / sclRef->rawEnergy() ); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_ESFrac_endcaps->Fill(sclRef->preshowerEnergy() / sclRef->rawEnergy()); } h1_scl_SigIEtaIEta_->Fill(bestGsfElectron.scSigmaIEtaIEta()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_SigIEtaIEta_barrel_->Fill(bestGsfElectron.scSigmaIEtaIEta()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_SigIEtaIEta_endcaps_->Fill(bestGsfElectron.scSigmaIEtaIEta()); h1_scl_full5x5_sigmaIetaIeta_->Fill(bestGsfElectron.full5x5_sigmaIetaIeta()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_full5x5_sigmaIetaIeta_barrel_->Fill(bestGsfElectron.full5x5_sigmaIetaIeta()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_full5x5_sigmaIetaIeta_endcaps_->Fill(bestGsfElectron.full5x5_sigmaIetaIeta()); h1_scl_E1x5_->Fill(bestGsfElectron.scE1x5()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_E1x5_barrel_->Fill(bestGsfElectron.scE1x5()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_E1x5_endcaps_->Fill(bestGsfElectron.scE1x5()); h1_scl_E2x5max_->Fill(bestGsfElectron.scE2x5Max()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_E2x5max_barrel_->Fill(bestGsfElectron.scE2x5Max()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_E2x5max_endcaps_->Fill(bestGsfElectron.scE2x5Max()); h1_scl_E5x5_->Fill(bestGsfElectron.scE5x5()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_E5x5_barrel_->Fill(bestGsfElectron.scE5x5()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_E5x5_endcaps_->Fill(bestGsfElectron.scE5x5()); // track related distributions @@ -2734,94 +2750,94 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event } // match distributions h1_ele_EoP->Fill(bestGsfElectron.eSuperClusterOverP()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_EoP_barrel->Fill(bestGsfElectron.eSuperClusterOverP()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_EoP_endcaps->Fill(bestGsfElectron.eSuperClusterOverP()); h2_ele_EoPVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eSuperClusterOverP()); h2_ele_EoPVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eSuperClusterOverP()); h2_ele_EoPVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eSuperClusterOverP()); h1_ele_EseedOP->Fill(bestGsfElectron.eSeedClusterOverP()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_EseedOP_barrel->Fill(bestGsfElectron.eSeedClusterOverP()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_EseedOP_endcaps->Fill(bestGsfElectron.eSeedClusterOverP()); h2_ele_EseedOPVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eSeedClusterOverP()); h2_ele_EseedOPVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eSeedClusterOverP()); h2_ele_EseedOPVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eSeedClusterOverP()); h1_ele_EoPout->Fill(bestGsfElectron.eSeedClusterOverPout()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_EoPout_barrel->Fill(bestGsfElectron.eSeedClusterOverPout()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_EoPout_endcaps->Fill(bestGsfElectron.eSeedClusterOverPout()); h2_ele_EoPoutVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eSeedClusterOverPout()); h2_ele_EoPoutVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eSeedClusterOverPout()); h2_ele_EoPoutVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eSeedClusterOverPout()); h1_ele_EeleOPout->Fill(bestGsfElectron.eEleClusterOverPout()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_EeleOPout_barrel->Fill(bestGsfElectron.eEleClusterOverPout()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_EeleOPout_endcaps->Fill(bestGsfElectron.eEleClusterOverPout()); h2_ele_EeleOPoutVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eEleClusterOverPout()); h2_ele_EeleOPoutVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eEleClusterOverPout()); h2_ele_EeleOPoutVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eEleClusterOverPout()); h1_ele_dEtaSc_propVtx->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dEtaSc_propVtx_barrel->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dEtaSc_propVtx_endcaps->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); h2_ele_dEtaScVsEta_propVtx->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); h2_ele_dEtaScVsPhi_propVtx->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); h2_ele_dEtaScVsPt_propVtx->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); h1_ele_dPhiSc_propVtx->Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dPhiSc_propVtx_barrel->Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dPhiSc_propVtx_endcaps->Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); h2_ele_dPhiScVsEta_propVtx->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); h2_ele_dPhiScVsPhi_propVtx->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); h2_ele_dPhiScVsPt_propVtx->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); h1_ele_dEtaCl_propOut->Fill(bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dEtaCl_propOut_barrel->Fill(bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dEtaCl_propOut_endcaps->Fill(bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); h2_ele_dEtaClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); h2_ele_dEtaClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); h2_ele_dEtaClVsPt_propOut->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); h1_ele_dPhiCl_propOut->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dPhiCl_propOut_barrel->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dPhiCl_propOut_endcaps->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); h2_ele_dPhiClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); h2_ele_dPhiClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); h2_ele_dPhiClVsPt_propOut->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); h1_ele_dEtaEleCl_propOut->Fill(bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dEtaEleCl_propOut_barrel->Fill(bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dEtaEleCl_propOut_endcaps->Fill(bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); h2_ele_dEtaEleClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); h2_ele_dEtaEleClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); h2_ele_dEtaEleClVsPt_propOut->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); h1_ele_dPhiEleCl_propOut->Fill(bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dPhiEleCl_propOut_barrel->Fill(bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dPhiEleCl_propOut_endcaps->Fill(bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); h2_ele_dPhiEleClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); h2_ele_dPhiEleClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); h2_ele_dPhiEleClVsPt_propOut->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); h1_ele_HoE->Fill(bestGsfElectron.hadronicOverEm()); h1_ele_HoE_bc->Fill(bestGsfElectron.hcalOverEcalBc()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_HoE_bc_barrel->Fill(bestGsfElectron.hcalOverEcalBc()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_HoE_bc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_HoE_barrel->Fill(bestGsfElectron.hadronicOverEm()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_HoE_endcaps->Fill(bestGsfElectron.hadronicOverEm()); if (!bestGsfElectron.isEBEtaGap() && !bestGsfElectron.isEBPhiGap() && !bestGsfElectron.isEBEEGap() && !bestGsfElectron.isEERingGap() && !bestGsfElectron.isEEDeeGap()) @@ -2832,7 +2848,7 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event //classes int eleClass = bestGsfElectron.classification(); - if (bestGsfElectron.isEE()) + if (isEEflag) eleClass += 10; h1_ele_classes->Fill(eleClass); @@ -2841,7 +2857,6 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event h1_ele_eta_golden->Fill(std::abs(bestGsfElectron.eta())); if (bestGsfElectron.classification() == GsfElectron::BIGBREM) h1_ele_eta_bbrem->Fill(std::abs(bestGsfElectron.eta())); - //if (bestGsfElectron.classification() == GsfElectron::OLDNARROW) h1_ele_eta_narrow->Fill(std::abs(bestGsfElectron.eta())); if (bestGsfElectron.classification() == GsfElectron::SHOWERING) h1_ele_eta_shower->Fill(std::abs(bestGsfElectron.eta())); @@ -2851,26 +2866,25 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event h1_ele_fbrem->Fill(fbrem_mode); p1_ele_fbremVsEta_mode->Fill(bestGsfElectron.eta(), fbrem_mode); - if (bestGsfElectron.isEB()) { + if (isEBflag) { double fbrem_mode_barrel = bestGsfElectron.fbrem(); h1_ele_fbrem_barrel->Fill(fbrem_mode_barrel); } - if (bestGsfElectron.isEE()) { + if (isEEflag) { double fbrem_mode_endcaps = bestGsfElectron.fbrem(); h1_ele_fbrem_endcaps->Fill(fbrem_mode_endcaps); } - // new 2014/02/12 double superclusterfbrem_mode = bestGsfElectron.superClusterFbrem(); h1_ele_superclusterfbrem->Fill(superclusterfbrem_mode); - if (bestGsfElectron.isEB()) { + if (isEBflag) { double superclusterfbrem_mode_barrel = bestGsfElectron.superClusterFbrem(); h1_ele_superclusterfbrem_barrel->Fill(superclusterfbrem_mode_barrel); } - if (bestGsfElectron.isEE()) { + if (isEEflag) { double superclusterfbrem_mode_endcaps = bestGsfElectron.superClusterFbrem(); h1_ele_superclusterfbrem_endcaps->Fill(superclusterfbrem_mode_endcaps); } @@ -2914,14 +2928,14 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event bestGsfElectron.gsfTrack()->innerMomentum().Rho()); h1_ele_mva->Fill(bestGsfElectron.mva_e_pi()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_mva_barrel->Fill(bestGsfElectron.mva_e_pi()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_mva_endcaps->Fill(bestGsfElectron.mva_e_pi()); h1_ele_mva_isolated->Fill(bestGsfElectron.mva_Isolated()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_mva_barrel_isolated->Fill(bestGsfElectron.mva_Isolated()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_mva_endcaps_isolated->Fill(bestGsfElectron.mva_Isolated()); if (bestGsfElectron.ecalDrivenSeed()) h1_ele_provenance->Fill(1.); @@ -2933,136 +2947,136 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event h1_ele_provenance->Fill(-2.); if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed()) h1_ele_provenance->Fill(2.); - if (bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEB()) + if (bestGsfElectron.ecalDrivenSeed() && isEBflag) h1_ele_provenance_barrel->Fill(1.); - if (bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.isEB()) + if (bestGsfElectron.trackerDrivenSeed() && isEBflag) h1_ele_provenance_barrel->Fill(-1.); - if ((bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) && bestGsfElectron.isEB()) + if ((bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) && isEBflag) h1_ele_provenance_barrel->Fill(0.); - if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEB()) + if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed() && isEBflag) h1_ele_provenance_barrel->Fill(-2.); - if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEB()) + if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed() && isEBflag) h1_ele_provenance_barrel->Fill(2.); - if (bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEE()) + if (bestGsfElectron.ecalDrivenSeed() && isEEflag) h1_ele_provenance_endcaps->Fill(1.); - if (bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.isEE()) + if (bestGsfElectron.trackerDrivenSeed() && isEEflag) h1_ele_provenance_endcaps->Fill(-1.); - if ((bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) && bestGsfElectron.isEE()) + if ((bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) && isEEflag) h1_ele_provenance_endcaps->Fill(0.); - if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEE()) + if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed() && isEEflag) h1_ele_provenance_endcaps->Fill(-2.); - if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEE()) + if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed() && isEEflag) h1_ele_provenance_endcaps->Fill(2.); // Pflow isolation h1_ele_chargedHadronIso->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_chargedHadronIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_chargedHadronIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt); h1_ele_neutralHadronIso->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_neutralHadronIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_neutralHadronIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt); h1_ele_photonIso->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_photonIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_photonIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt); // -- pflow over pT h1_ele_chargedHadronRelativeIso->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt / bestGsfElectron.pt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_chargedHadronRelativeIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt / bestGsfElectron.pt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_chargedHadronRelativeIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt / bestGsfElectron.pt()); h1_ele_neutralHadronRelativeIso->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_neutralHadronRelativeIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_neutralHadronRelativeIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt / bestGsfElectron.pt()); h1_ele_photonRelativeIso->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_photonRelativeIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_photonRelativeIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt()); // isolation h1_ele_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_tkSumPt_dr03_barrel->Fill(bestGsfElectron.dr03TkSumPt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_tkSumPt_dr03_endcaps->Fill(bestGsfElectron.dr03TkSumPt()); h1_ele_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_ecalRecHitSumEt_dr03_barrel->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_ecalRecHitSumEt_dr03_endcaps->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); h1_ele_hcalTowerSumEt_dr03_depth1->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEt_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEt_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); h1_ele_hcalTowerSumEt_dr03_depth2->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); h1_ele_hcalTowerSumEtBc_dr03_depth1->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEtBc_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEtBc_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); h1_ele_hcalTowerSumEtBc_dr03_depth2->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEtBc_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEtBc_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); h1_ele_tkSumPt_dr04->Fill(bestGsfElectron.dr04TkSumPt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_tkSumPt_dr04_barrel->Fill(bestGsfElectron.dr04TkSumPt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_tkSumPt_dr04_endcaps->Fill(bestGsfElectron.dr04TkSumPt()); h1_ele_ecalRecHitSumEt_dr04->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_ecalRecHitSumEt_dr04_barrel->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_ecalRecHitSumEt_dr04_endcaps->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); h1_ele_hcalTowerSumEt_dr04_depth1->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEt_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEt_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); h1_ele_hcalTowerSumEt_dr04_depth2->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); h1_ele_hcalTowerSumEtBc_dr04_depth1->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEtBc_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEtBc_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); h1_ele_hcalTowerSumEtBc_dr04_depth2->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEtBc_dr04_depth2_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEtBc_dr04_depth2_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); h1_ele_hcalDepth1OverEcalBc->Fill(bestGsfElectron.hcalOverEcalBc(1)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalDepth1OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(1)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalDepth1OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(1)); h1_ele_hcalDepth2OverEcalBc->Fill(bestGsfElectron.hcalOverEcalBc(2)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalDepth2OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(2)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalDepth2OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(2)); // conversion rejection diff --git a/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc index ec794937f5f09..dd71ff8650f4c 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc @@ -1,6 +1,3 @@ -// system include files -//#include - // user include files #include "Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.h" #include "CLHEP/Units/GlobalPhysicalConstants.h" @@ -11,8 +8,6 @@ using namespace reco; using namespace pat; -typedef edm::Ptr PatElectronPtr; - ElectronMcSignalValidatorMiniAOD::ElectronMcSignalValidatorMiniAOD(const edm::ParameterSet& iConfig) : ElectronDqmAnalyzerBase(iConfig) { mcTruthCollection_ = consumes >( @@ -79,6 +74,10 @@ ElectronMcSignalValidatorMiniAOD::ElectronMcSignalValidatorMiniAOD(const edm::Pa set_EfficiencyFlag = histosSet.getParameter("EfficiencyFlag"); set_StatOverflowFlag = histosSet.getParameter("StatOverflowFlag"); + ele_nbin = histosSet.getParameter("NbinELE"); + ele_min = histosSet.getParameter("ELE_min"); + ele_max = histosSet.getParameter("ELE_max"); + // so to please coverity... h1_recEleNum = nullptr; @@ -138,7 +137,7 @@ void ElectronMcSignalValidatorMiniAOD::bookHistograms(DQMStore::IBooker& iBooker setBookStatOverflowFlag(set_StatOverflowFlag); // rec event collections sizes - h1_recEleNum = bookH1(iBooker, "recEleNum", "# rec electrons", 11, -0.5, 10.5, "N_{ele}"); + h1_recEleNum = bookH1(iBooker, "recEleNum", "# rec electrons", ele_nbin, ele_min, ele_max, "N_{ele}"); // matched electrons setBookPrefix("h_mc"); setBookPrefix("h_ele"); @@ -156,7 +155,6 @@ void ElectronMcSignalValidatorMiniAOD::bookHistograms(DQMStore::IBooker& iBooker 50, poptrue_min, poptrue_max); - // h2_ele_sigmaIetaIetaVsPt = bookH2(iBooker,"sigmaIetaIetaVsPt","SigmaIetaIeta vs pt",pt_nbin,0.,pt_max,100,0.,0.05); h2_ele_sigmaIetaIetaVsPt = bookH2(iBooker, "sigmaIetaIetaVsPt", "SigmaIetaIeta vs pt", 100, 0., pt_max, 100, 0., 0.05); @@ -431,6 +429,7 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e edm::LogInfo("ElectronMcSignalValidatorMiniAOD::analyze") << "Treating event " << iEvent.id() << " with " << electrons_endcaps.product()->size() << " multi slimmed electrons"; + h1_recEleNum->Fill((*electrons).size()); //=============================================== @@ -438,15 +437,42 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e //=============================================== pat::Electron gsfElectron; - pat::ElectronCollection::const_iterator el1; pat::ElectronCollection::const_iterator el2; + std::vector ::const_iterator el3; + std::vector ::const_iterator el4; + + //=============================================== + // get a vector with EB & EE + //=============================================== + std::vector localCollection; + int iBarrels = 0; + int iEndcaps = 0; + + // looking for EB for (el1 = electrons->begin(); el1 != electrons->end(); el1++) { - for (el2 = el1 + 1; el2 != electrons->end(); el2++) { - math::XYZTLorentzVector p12 = el1->p4() + el2->p4(); + if (el1->isEB()) + { + localCollection.push_back( *el1 ); + iBarrels += 1; + } + } + + // looking for EE + for (el1 = electrons_endcaps->begin(); el1 != electrons_endcaps->end(); el1++) { + if (el1->isEE()) + { + localCollection.push_back(*el1); + iEndcaps += 1; + } + } + + for (el3 = localCollection.begin(); el3 != localCollection.end(); el3++) { + for (el4 = el3 + 1; el4 != localCollection.end(); el4++) { + math::XYZTLorentzVector p12 = el3->p4() + el4->p4(); float mee2 = p12.Dot(p12); h1_ele_mee_all->Fill(sqrt(mee2)); - if (el1->charge() * el2->charge() < 0.) { + if (el3->charge() * el4->charge() < 0.) { h1_ele_mee_os->Fill(sqrt(mee2)); } } @@ -457,7 +483,6 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e //=============================================== int mcNum = 0, gamNum = 0, eleNum = 0; - // bool matchingID;//, matchingMotherID ; bool matchingMotherID; //=============================================== @@ -465,12 +490,6 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e //=============================================== for (size_t i = 0; i < genParticles->size(); i++) { - /* // DEBUG LINES - KEEP IT ! - std::cout << "\nevt ID = " << iEvent.id() ; - std::cout << ", mcIter position : " << i << std::endl; - std::cout << "pdgID : " << (*genParticles)[i].pdgId() << ", Pt : " << (*genParticles)[i].pt() ; - std::cout << ", eta : " << (*genParticles)[i].eta() << ", phi : " << (*genParticles)[i].phi() << std::endl; - // DEBUG LINES - KEEP IT ! */ // number of mc particles mcNum++; @@ -485,33 +504,15 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e const Candidate* mother = (*genParticles)[i].mother(0); matchingMotherID = false; for (unsigned int ii = 0; ii < matchingMotherIDs_.size(); ii++) { - /* // DEBUG LINES - KEEP IT ! - std::cout << "Matching : matchingMotherID[" << ii << "] : "<< matchingMotherIDs_[ii] << ", evt ID = " << iEvent.id() << ", mother : " << mother ; - if (mother != 0) { - std::cout << "mother : " << mother << ", mother pdgID : " << mother->pdgId() << std::endl ; - std::cout << "mother pdgID : " << mother->pdgId() << ", Pt : " << mother->pt() << ", eta : " << mother->eta() << ", phi : " << mother->phi() << std::endl; - } - else { - std::cout << std::endl; - } - // DEBUG LINES - KEEP IT ! */ if (mother == nullptr) { matchingMotherID = true; } else if (mother->pdgId() == matchingMotherIDs_[ii]) { if (mother->numberOfDaughters() <= 2) { matchingMotherID = true; - //std::cout << "evt ID = " << iEvent.id() ; // debug lines - //std::cout << " - nb of Daughters : " << mother->numberOfDaughters() << " - pdgId() : " << mother->pdgId() << std::endl; // debug lines } } // end of mother if test - /* // DEBUG LINES - KEEP IT ! - if (mother != 0) { - std::cout << "mother : " << mother << ", mother pdgID : " << mother->pdgId() << std::endl ; - std::cout << "mother pdgID : " << mother->pdgId() << ", Pt : " << mother->pt() << ", eta : " << mother->eta() << ", phi : " << mother->phi() << std::endl; - } - // DEBUG LINES - KEEP IT ! */ } // end of for loop if (!matchingMotherID) { continue; @@ -527,35 +528,29 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e bool okGsfFound = false; bool passMiniAODSelection = true; double gsfOkRatio = 999999.; + bool isEBflag = false; + bool isEEflag = false; pat::Electron bestGsfElectron; - for (unsigned i_elec = 0; i_elec < 2; ++i_elec) { - mergedElectrons = (i_elec == 0) ? electrons : electrons_endcaps; + for (el3 = localCollection.begin(); el3 != localCollection.end(); el3++) { - for (const pat::Electron& el : *mergedElectrons) { // *electrons - if (i_elec == 0 && !el.isEB()) - continue; - double dphi = el.phi() - (*genParticles)[i].phi(); - if (std::abs(dphi) > CLHEP::pi) { - dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi; - } - double deltaR2 = (el.eta() - (*genParticles)[i].eta()) * (el.eta() - (*genParticles)[i].eta()) + dphi * dphi; - if (deltaR2 < deltaR2_) { - if ((((*genParticles)[i].pdgId() == 11) && (el.charge() < 0.)) || - (((*genParticles)[i].pdgId() == -11) && (el.charge() > 0.))) { - double tmpGsfRatio = el.p() / (*genParticles)[i].p(); - if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) { - gsfOkRatio = tmpGsfRatio; - bestGsfElectron = el; - PatElectronPtr elePtr(electrons, &el - &(*electrons)[0]); - pt_ = elePtr->pt(); - - okGsfFound = true; - } + double dphi = el3->phi() - (*genParticles)[i].phi(); + if (std::abs(dphi) > CLHEP::pi) { + dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi; + } + double deltaR2 = (el3->eta() - (*genParticles)[i].eta()) * (el3->eta() - (*genParticles)[i].eta()) + dphi * dphi; + if (deltaR2 < deltaR2_) { + if ((((*genParticles)[i].pdgId() == 11) && (el3->charge() < 0.)) || + (((*genParticles)[i].pdgId() == -11) && (el3->charge() > 0.))) { + double tmpGsfRatio = el3->p() / (*genParticles)[i].p(); + if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) { + gsfOkRatio = tmpGsfRatio; + bestGsfElectron = *el3; + okGsfFound = true; } } } - } // end loop i_elec + } // end *electrons loop if (okGsfFound) { //------------------------------------ @@ -563,6 +558,8 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e //------------------------------------ passMiniAODSelection = bestGsfElectron.pt() >= 5.; double one_over_pt = 1. / bestGsfElectron.pt(); + isEBflag = bestGsfElectron.isEB(); + isEEflag = bestGsfElectron.isEE(); // electron related distributions h1_ele_vertexPt->Fill(bestGsfElectron.pt()); @@ -600,7 +597,7 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e one_over_pt); h1_ele_photonRelativeIso_mAOD->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt * one_over_pt); - if (bestGsfElectron.isEB()) { + if (isEBflag) { // supercluster related distributions h1_scl_SigIEtaIEta_mAOD_barrel->Fill(bestGsfElectron.scSigmaIEtaIEta()); h1_ele_dEtaSc_propVtx_mAOD_barrel->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); @@ -618,7 +615,7 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e } // supercluster related distributions - if (bestGsfElectron.isEE()) { + if (isEEflag) { h1_scl_SigIEtaIEta_mAOD_endcaps->Fill(bestGsfElectron.scSigmaIEtaIEta()); h1_ele_dEtaSc_propVtx_mAOD_endcaps->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); h1_ele_dPhiCl_propOut_mAOD_endcaps->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); diff --git a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc index 4cbefe3fd6e3d..c5af6bfad9fdd 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc @@ -53,6 +53,8 @@ using namespace reco; ElectronMcSignalValidator::ElectronMcSignalValidator(const edm::ParameterSet &conf) : ElectronDqmAnalyzerBase(conf) { mcTruthCollection_ = consumes(conf.getParameter("mcTruthCollection")); electronCollection_ = consumes(conf.getParameter("electronCollection")); + electronCollectionEndcaps_ = + consumes(conf.getParameter("electronCollectionEndcaps")); electronCoreCollection_ = consumes(conf.getParameter("electronCoreCollection")); electronTrackCollection_ = @@ -220,11 +222,7 @@ ElectronMcSignalValidator::ElectronMcSignalValidator(const edm::ParameterSet &co h1_ele_EseedOP_all_barrel = nullptr; h1_ele_EseedOP_all_endcaps = nullptr; h1_ele_EoPout_all = nullptr; - h1_ele_EoPout_all_barrel = nullptr; - h1_ele_EoPout_all_endcaps = nullptr; h1_ele_EeleOPout_all = nullptr; - h1_ele_EeleOPout_all_barrel = nullptr; - h1_ele_EeleOPout_all_endcaps = nullptr; h1_ele_dEtaSc_propVtx_all = nullptr; h1_ele_dEtaSc_propVtx_all_barrel = nullptr; h1_ele_dEtaSc_propVtx_all_endcaps = nullptr; @@ -295,9 +293,9 @@ ElectronMcSignalValidator::ElectronMcSignalValidator(const edm::ParameterSet &co h1_scl_EoEtrue_barrel_new_phigap = nullptr; h1_scl_EoEtrue_ebeegap_new = nullptr; h1_scl_EoEtrue_endcaps_new_deegap = nullptr; - h2_scl_EoEtrueVsrecOfflineVertices = nullptr; // new 2015.15.05 - h2_scl_EoEtrueVsrecOfflineVertices_barrel = nullptr; // new 2015.15.05 - h2_scl_EoEtrueVsrecOfflineVertices_endcaps = nullptr; // new 2015.15.05 + h2_scl_EoEtrueVsrecOfflineVertices = nullptr; + h2_scl_EoEtrueVsrecOfflineVertices_barrel = nullptr; + h2_scl_EoEtrueVsrecOfflineVertices_endcaps = nullptr; h1_scl_EoEtrue_endcaps_new_ringgap = nullptr; h1_scl_Et = nullptr; h2_scl_EtVsEta = nullptr; @@ -305,7 +303,6 @@ ElectronMcSignalValidator::ElectronMcSignalValidator(const edm::ParameterSet &co h2_scl_EtaVsPhi = nullptr; h1_scl_Eta = nullptr; h1_scl_Phi = nullptr; - // h1_scl_ESFrac = 0 ; h1_scl_ESFrac_endcaps = nullptr; h2_scl_EoEtruePfVsEg = nullptr; @@ -713,24 +710,6 @@ void ElectronMcSignalValidator::bookHistograms(DQMStore::IBooker &iBooker, edm:: "E_{seed}/P_{out}", "Events", "ELE_LOGY E1 P"); - h1_ele_EoPout_all_barrel = bookH1withSumw2(iBooker, - "EoPout_all_barrel", - "ele E_{seed}/P_{out}, all reco electrons barrel", - eop_nbin, - 0., - eop_max, - "E_{seed}/P_{out}", - "Events", - "ELE_LOGY E1 P"); - h1_ele_EoPout_all_endcaps = bookH1withSumw2(iBooker, - "EoPout_all_endcaps", - "ele E_{seed}/P_{out}, all reco electrons endcaps", - eop_nbin, - 0., - eop_max, - "E_{seed}/P_{out}", - "Events", - "ELE_LOGY E1 P"); h1_ele_EeleOPout_all = bookH1withSumw2(iBooker, "EeleOPout_all", "ele E_{ele}/P_{out}, all reco electrons", @@ -740,24 +719,6 @@ void ElectronMcSignalValidator::bookHistograms(DQMStore::IBooker &iBooker, edm:: "E_{ele}/P_{out}", "Events", "ELE_LOGY E1 P"); - h1_ele_EeleOPout_all_barrel = bookH1withSumw2(iBooker, - "EeleOPout_all_barrel", - "ele E_{ele}/P_{out}, all reco electrons barrel", - eop_nbin, - 0., - eop_max, - "E_{ele}/P_{out}", - "Events", - "ELE_LOGY E1 P"); - h1_ele_EeleOPout_all_endcaps = bookH1withSumw2(iBooker, - "EeleOPout_all_endcaps", - "ele E_{ele}/P_{out}, all reco electrons endcaps", - eop_nbin, - 0., - eop_max, - "E_{ele}/P_{out}", - "Events", - "ELE_LOGY E1 P"); h1_ele_dEtaSc_propVtx_all = bookH1withSumw2(iBooker, "dEtaSc_propVtx_all", "ele #eta_{sc} - #eta_{tr}, prop from vertex, all reco electrons", @@ -1172,7 +1133,6 @@ void ElectronMcSignalValidator::bookHistograms(DQMStore::IBooker &iBooker, edm:: poptrue_max); h2_ele_PoPtrueVsPt = bookH2( iBooker, "PoPtrueVsPt", "ele momentum / gen momentum vs eta", pt2D_nbin, 0., pt_max, 50, poptrue_min, poptrue_max); - // h2_ele_sigmaIetaIetaVsPt = bookH2(iBooker,"sigmaIetaIetaVsPt","SigmaIetaIeta vs pt",pt_nbin,0.,pt_max,100,0.,0.05); h2_ele_sigmaIetaIetaVsPt = bookH2(iBooker, "sigmaIetaIetaVsPt", "SigmaIetaIeta vs pt", 100, 0., pt_max, 100, 0., 0.05); h1_ele_PoPtrue_golden_barrel = bookH1withSumw2(iBooker, @@ -1619,7 +1579,6 @@ void ElectronMcSignalValidator::bookHistograms(DQMStore::IBooker &iBooker, edm:: iBooker, "bcl_EtotoEtrue_barrel", "Total basicclusters energy , barrel", 50, 0.2, 1.2, "E/E_{gen}"); h1_scl_bcl_EtotoEtrue_endcaps = bookH1withSumw2( iBooker, "bcl_EtotoEtrue_endcaps", "Total basicclusters energy , endcaps", 50, 0.2, 1.2, "E/E_{gen}"); - // h1_scl_ESFrac = bookH1withSumw2(iBooker, "ESFrac","Preshower over SC raw energy",100,0.,0.8,"E_{PS} / E^{raw}_{SC}","Events","ELE_LOGY E1 P"); h1_scl_ESFrac_endcaps = bookH1withSumw2(iBooker, "ESFrac_endcaps", "Preshower over SC raw energy , endcaps", @@ -3276,6 +3235,7 @@ ElectronMcSignalValidator::~ElectronMcSignalValidator() {} void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::EventSetup &) { // get collections auto gsfElectrons = iEvent.getHandle(electronCollection_); + auto gsfElectronsEndcaps = iEvent.getHandle(electronCollectionEndcaps_); auto gsfElectronCores = iEvent.getHandle(electronCoreCollection_); auto gsfElectronTracks = iEvent.getHandle(electronTrackCollection_); auto gsfElectronSeeds = iEvent.getHandle(electronSeedCollection_); @@ -3299,55 +3259,82 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve edm::LogInfo("ElectronMcSignalValidator::analyze") << "Treating event " << iEvent.id() << " with " << gsfElectrons.product()->size() << " electrons"; + edm::LogInfo("ElectronMcSignalValidator::analyze") + << "Treating event " << iEvent.id() << " with " << gsfElectronsEndcaps.product()->size() << " electrons"; + h1_recEleNum->Fill((*gsfElectrons).size()); h1_recCoreNum->Fill((*gsfElectronCores).size()); h1_recTrackNum->Fill((*gsfElectronTracks).size()); h1_recSeedNum->Fill((*gsfElectronSeeds).size()); h1_recOfflineVertices->Fill((*vertexCollectionHandle).size()); + reco::GsfElectronCollection::const_iterator gsfIter; + std::vector ::const_iterator gsfIter3; + std::vector ::const_iterator gsfIter4; + + //=============================================== + // get a vector with EB & EE + //=============================================== + std::vector localCollection; + int iBarrels = 0; + int iEndcaps = 0; + + // looking for EB + for (gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end(); gsfIter++) { + if (gsfIter->isEB()) + { + localCollection.push_back( *gsfIter ); + iBarrels += 1; + } + } + + // looking for EE + for (gsfIter = gsfElectronsEndcaps->begin(); gsfIter != gsfElectronsEndcaps->end(); gsfIter++) { + if (gsfIter->isEE()) + { + localCollection.push_back(*gsfIter); + iEndcaps += 1; + } + } + //=============================================== // all rec electrons //=============================================== - reco::GsfElectronCollection::const_iterator gsfIter; // mee only - for (gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end(); gsfIter++) { - // preselect electrons - // if (gsfIter->pt()>maxPt_ || std::abs(gsfIter->eta())>maxAbsEta_) continue ; + for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) { - // - float enrj1 = gsfIter->ecalEnergy(); + float enrj1 = gsfIter3->ecalEnergy(); - reco::GsfElectronCollection::const_iterator gsfIter2; - for (gsfIter2 = gsfIter + 1; gsfIter2 != gsfElectrons->end(); gsfIter2++) { - math::XYZTLorentzVector p12 = (*gsfIter).p4() + (*gsfIter2).p4(); + for (gsfIter4 = gsfIter3 + 1; gsfIter4 != localCollection.end(); gsfIter4++) { + math::XYZTLorentzVector p12 = (*gsfIter3).p4() + (*gsfIter4).p4(); float mee2 = p12.Dot(p12); - float enrj2 = gsfIter2->ecalEnergy(); + float enrj2 = gsfIter4->ecalEnergy(); h1_ele_mee_all->Fill(sqrt(mee2)); h2_ele_E2mnE1vsMee_all->Fill(sqrt(mee2), enrj2 - enrj1); - if (gsfIter->ecalDrivenSeed() && gsfIter2->ecalDrivenSeed()) { + if (gsfIter3->ecalDrivenSeed() && gsfIter4->ecalDrivenSeed()) { h2_ele_E2mnE1vsMee_egeg_all->Fill(sqrt(mee2), enrj2 - enrj1); } - if (gsfIter->charge() * gsfIter2->charge() < 0.) { + if (gsfIter3->charge() * gsfIter4->charge() < 0.) { h1_ele_mee_os->Fill(sqrt(mee2)); - if (gsfIter->isEB() && gsfIter2->isEB()) { + if (gsfIter3->isEB() && gsfIter4->isEB()) { h1_ele_mee_os_ebeb->Fill(sqrt(mee2)); } - if ((gsfIter->isEB() && gsfIter2->isEE()) || (gsfIter->isEE() && gsfIter2->isEB())) + if ((gsfIter3->isEB() && gsfIter4->isEE()) || (gsfIter3->isEE() && gsfIter4->isEB())) h1_ele_mee_os_ebee->Fill(sqrt(mee2)); - if (gsfIter->isEE() && gsfIter2->isEE()) { + if (gsfIter3->isEE() && gsfIter4->isEE()) { h1_ele_mee_os_eeee->Fill(sqrt(mee2)); } - if ((gsfIter->classification() == GsfElectron::GOLDEN && gsfIter2->classification() == GsfElectron::GOLDEN) || - (gsfIter->classification() == GsfElectron::GOLDEN && gsfIter2->classification() == GsfElectron::BIGBREM) || - (gsfIter->classification() == GsfElectron::BIGBREM && gsfIter2->classification() == GsfElectron::GOLDEN) || - (gsfIter->classification() == GsfElectron::BIGBREM && gsfIter2->classification() == GsfElectron::BIGBREM)) { + if ((gsfIter3->classification() == GsfElectron::GOLDEN && gsfIter4->classification() == GsfElectron::GOLDEN) || + (gsfIter3->classification() == GsfElectron::GOLDEN && gsfIter4->classification() == GsfElectron::BIGBREM) || + (gsfIter3->classification() == GsfElectron::BIGBREM && gsfIter4->classification() == GsfElectron::GOLDEN) || + (gsfIter3->classification() == GsfElectron::BIGBREM && gsfIter4->classification() == GsfElectron::BIGBREM)) { h1_ele_mee_os_gg->Fill(sqrt(mee2)); - } else if ((gsfIter->classification() == GsfElectron::SHOWERING && - gsfIter2->classification() == GsfElectron::SHOWERING) || - (gsfIter->classification() == GsfElectron::SHOWERING && gsfIter2->isGap()) || - (gsfIter->isGap() && gsfIter2->classification() == GsfElectron::SHOWERING) || - (gsfIter->isGap() && gsfIter2->isGap())) { + } else if ((gsfIter3->classification() == GsfElectron::SHOWERING && + gsfIter4->classification() == GsfElectron::SHOWERING) || + (gsfIter3->classification() == GsfElectron::SHOWERING && gsfIter4->isGap()) || + (gsfIter3->isGap() && gsfIter4->classification() == GsfElectron::SHOWERING) || + (gsfIter3->isGap() && gsfIter4->isGap())) { h1_ele_mee_os_bb->Fill(sqrt(mee2)); } else { h1_ele_mee_os_gb->Fill(sqrt(mee2)); @@ -3356,37 +3343,36 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve } } - for (gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end(); gsfIter++) { + for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) { // preselect electrons - if (gsfIter->pt() > maxPt_ || std::abs(gsfIter->eta()) > maxAbsEta_) + if (gsfIter3->pt() > maxPt_ || std::abs(gsfIter3->eta()) > maxAbsEta_) continue; - // - h1_ele_EoverP_all->Fill(gsfIter->eSuperClusterOverP()); - h1_ele_EseedOP_all->Fill(gsfIter->eSeedClusterOverP()); - h1_ele_EoPout_all->Fill(gsfIter->eSeedClusterOverPout()); - h1_ele_EeleOPout_all->Fill(gsfIter->eEleClusterOverPout()); - h1_ele_dEtaSc_propVtx_all->Fill(gsfIter->deltaEtaSuperClusterTrackAtVtx()); - h1_ele_dPhiSc_propVtx_all->Fill(gsfIter->deltaPhiSuperClusterTrackAtVtx()); - h1_ele_dEtaCl_propOut_all->Fill(gsfIter->deltaEtaSeedClusterTrackAtCalo()); - h1_ele_dPhiCl_propOut_all->Fill(gsfIter->deltaPhiSeedClusterTrackAtCalo()); - h1_ele_HoE_all->Fill(gsfIter->hcalOverEcal()); - h1_ele_HoE_bc_all->Fill(gsfIter->hcalOverEcalBc()); - h1_ele_TIP_all->Fill(EleRelPoint(gsfIter->vertex(), theBeamSpot->position()).perp()); - h1_ele_vertexEta_all->Fill(gsfIter->eta()); - h1_ele_vertexPt_all->Fill(gsfIter->pt()); - h1_ele_Et_all->Fill(gsfIter->ecalEnergy() / cosh(gsfIter->superCluster()->eta())); + h1_ele_EoverP_all->Fill(gsfIter3->eSuperClusterOverP()); + h1_ele_EseedOP_all->Fill(gsfIter3->eSeedClusterOverP()); + h1_ele_EoPout_all->Fill(gsfIter3->eSeedClusterOverPout()); + h1_ele_EeleOPout_all->Fill(gsfIter3->eEleClusterOverPout()); + h1_ele_dEtaSc_propVtx_all->Fill(gsfIter3->deltaEtaSuperClusterTrackAtVtx()); + h1_ele_dPhiSc_propVtx_all->Fill(gsfIter3->deltaPhiSuperClusterTrackAtVtx()); + h1_ele_dEtaCl_propOut_all->Fill(gsfIter3->deltaEtaSeedClusterTrackAtCalo()); + h1_ele_dPhiCl_propOut_all->Fill(gsfIter3->deltaPhiSeedClusterTrackAtCalo()); + h1_ele_HoE_all->Fill(gsfIter3->hcalOverEcal()); + h1_ele_HoE_bc_all->Fill(gsfIter3->hcalOverEcalBc()); + h1_ele_TIP_all->Fill(EleRelPoint(gsfIter3->vertex(), theBeamSpot->position()).perp()); + h1_ele_vertexEta_all->Fill(gsfIter3->eta()); + h1_ele_vertexPt_all->Fill(gsfIter3->pt()); + h1_ele_Et_all->Fill(gsfIter3->ecalEnergy() / cosh(gsfIter3->superCluster()->eta())); // conversion rejection - int flags = gsfIter->convFlags(); + int flags = gsfIter3->convFlags(); if (flags == -9999) { flags = -1; } h1_ele_convFlags_all->Fill(flags); if (flags >= 0.) { - h1_ele_convDist_all->Fill(gsfIter->convDist()); - h1_ele_convDcot_all->Fill(gsfIter->convDcot()); - h1_ele_convRadius_all->Fill(gsfIter->convRadius()); + h1_ele_convDist_all->Fill(gsfIter3->convDist()); + h1_ele_convDcot_all->Fill(gsfIter3->convDcot()); + h1_ele_convRadius_all->Fill(gsfIter3->convRadius()); } } @@ -3399,21 +3385,12 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve reco::GenParticleCollection::const_iterator mcIter; for (mcIter = genParticles->begin(); mcIter != genParticles->end(); mcIter++) { - /* // DEBUG LINES - KEEP IT ! - std::cout << "\nevt ID = " << iEvent.id() ; - std::cout << ", mcIter position : " << mcIter - genParticles->begin() << std::endl ; - std::cout << "pdgID : " << mcIter->pdgId() << ", Pt : " << mcIter->pt() << ", eta : " << mcIter->eta() << ", phi : " << mcIter->phi() << std::endl; - // DEBUG LINES - KEEP IT ! */ // select requested matching gen particle matchingID = false; for (unsigned int i = 0; i < matchingIDs_.size(); i++) { if (mcIter->pdgId() == matchingIDs_[i]) { matchingID = true; - /* // DEBUG LINES - KEEP IT ! - std::cout << "\nMatching mis-reco : matchingIDs_.size() = " << matchingIDs_.size() << ", evt ID = " << iEvent.id() ; - std::cout << ", mcIter pdgID : " << mcIter->pdgId() << ", matchingID : " << matchingID << std::endl ; - // DEBUG LINES - KEEP IT ! */ } } if (matchingID) { @@ -3422,27 +3399,12 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve const Candidate *mother = mcIter->mother(); matchingMotherID = false; for (unsigned int i = 0; i < matchingMotherIDs_.size(); i++) { - /* // DEBUG LINES - KEEP IT ! - std::cout << "Matching : matchingMotherID[" << ii << "] : "<< matchingMotherIDs_[ii] << ", evt ID = " << iEvent.id() << ", mother : " << mother ; - if (mother != 0) { - std::cout << "mother : " << mother << ", mother pdgID : " << mother->pdgId() << std::endl ; - std::cout << "mother pdgID : " << mother->pdgId() << ", Pt : " << mother->pt() << ", eta : " << mother->eta() << ", phi : " << mother->phi() << std::endl; - } - else { - std::cout << std::endl; - } - // DEBUG LINES - KEEP IT ! */ if (mother == nullptr) { matchingMotherID = true; } else if (mother->pdgId() == matchingMotherIDs_[i]) { if (mother->numberOfDaughters() <= 2) { matchingMotherID = true; - /* // DEBUG LINES - KEEP IT ! - std::cout << "Matching mis-reco : matchingMotherID[" << i << "] : " << matchingMotherIDs_[i] << ", evt ID = " << iEvent.id() << ", mother : " << mother ; // debug lines - std::cout << "evt ID = " << iEvent.id() ; // debug lines - std::cout << " - nb of Daughters : " << mother->numberOfDaughters() << " - pdgId() : " << mother->pdgId() << std::endl; // debug lines - // DEBUG LINES - KEEP IT ! */ } } // end of mother if test } @@ -3450,10 +3412,6 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve if (mcIter->pt() > maxPt_ || std::abs(mcIter->eta()) > maxAbsEta_) { continue; } - // suppress the endcaps - //if (std::abs(mcIter->eta()) > 1.5) continue; - // select central z - //if ( std::abs(mcIter->production_vertex()->position().z())>50.) continue; // looking for the best matching gsf electron bool okGsfFound = false; @@ -3461,23 +3419,22 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve // find best matched electron reco::GsfElectron bestGsfElectron; - reco::GsfElectronCollection::const_iterator gsfIter; - for (gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end(); gsfIter++) { - double dphi = gsfIter->phi() - mcIter->phi(); + for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) { + double dphi = gsfIter3->phi() - mcIter->phi(); if (std::abs(dphi) > CLHEP::pi) { dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi; } - double deltaR2 = (gsfIter->eta() - mcIter->eta()) * (gsfIter->eta() - mcIter->eta()) + dphi * dphi; + double deltaR2 = (gsfIter3->eta() - mcIter->eta()) * (gsfIter3->eta() - mcIter->eta()) + dphi * dphi; if (deltaR2 < deltaR2_) { double mc_charge = mcIter->pdgId() == 11 ? -1. : 1.; - h1_ele_ChargeMnChargeTrue->Fill(std::abs(gsfIter->charge() - mc_charge)); + h1_ele_ChargeMnChargeTrue->Fill(std::abs(gsfIter3->charge() - mc_charge)); // require here a charge mismatch - if (((mcIter->pdgId() == 11) && (gsfIter->charge() > 0.)) || - ((mcIter->pdgId() == -11) && (gsfIter->charge() < 0.))) { - double tmpGsfRatio = gsfIter->p() / mcIter->p(); + if (((mcIter->pdgId() == 11) && (gsfIter3->charge() > 0.)) || + ((mcIter->pdgId() == -11) && (gsfIter3->charge() < 0.))) { + double tmpGsfRatio = gsfIter3->p() / mcIter->p(); if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) { gsfOkRatio = tmpGsfRatio; - bestGsfElectron = *gsfIter; + bestGsfElectron = *gsfIter3; okGsfFound = true; } } @@ -3527,15 +3484,6 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve for (unsigned int i = 0; i < matchingMotherIDs_.size(); i++) { if ((mother == nullptr) || ((mother != nullptr) && mother->pdgId() == matchingMotherIDs_[i])) { matchingMotherID = true; - /* // DEBUG LINES - KEEP IT ! - std::cout << "Matching mc-reco : matchingMotherID[" << i << "] : " << matchingMotherIDs_[i] << ", evt ID = " << iEvent.id() << ", mother : " << mother ; - if (mother != 0) { - std::cout << ", mother pdgID : " << mother->pdgId() << std::endl ; - } - else { - std::cout << std::endl ; - } - // DEBUG LINES - KEEP IT ! */ } } if (!matchingMotherID) @@ -3546,11 +3494,6 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve continue; } - // suppress the endcaps - //if (std::abs(mcIter->eta()) > 1.5) continue; - // select central z - //if ( std::abs(mcIter->production_vertex()->position().z())>50.) continue; - eleNum++; h1_mc_Eta->Fill(mcIter->eta()); h1_mc_AbsEta->Fill(std::abs(mcIter->eta())); @@ -3564,32 +3507,31 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve bool okGsfFound = false; bool passMiniAODSelection = true; double gsfOkRatio = 999999.; + bool isEBflag = false; + bool isEEflag = false; + reco::GsfElectron bestGsfElectron; - reco::GsfElectronRef bestGsfElectronRef; - reco::GsfElectronCollection::const_iterator gsfIter; - reco::GsfElectronCollection::size_type iElectron; - for (gsfIter = gsfElectrons->begin(), iElectron = 0; gsfIter != gsfElectrons->end(); gsfIter++, iElectron++) { + for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) { // temporary cut for pt < 5. - double dphi = gsfIter->phi() - mcIter->phi(); + double dphi = gsfIter3->phi() - mcIter->phi(); if (std::abs(dphi) > CLHEP::pi) { dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi; } - double deltaR2 = (gsfIter->eta() - mcIter->eta()) * (gsfIter->eta() - mcIter->eta()) + dphi * dphi; + double deltaR2 = (gsfIter3->eta() - mcIter->eta()) * (gsfIter3->eta() - mcIter->eta()) + dphi * dphi; if (deltaR2 < deltaR2_) { - if (((mcIter->pdgId() == 11) && (gsfIter->charge() < 0.)) || - ((mcIter->pdgId() == -11) && (gsfIter->charge() > 0.))) { - double tmpGsfRatio = gsfIter->p() / mcIter->p(); + if (((mcIter->pdgId() == 11) && (gsfIter3->charge() < 0.)) || + ((mcIter->pdgId() == -11) && (gsfIter3->charge() > 0.))) { + double tmpGsfRatio = gsfIter3->p() / mcIter->p(); if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) { gsfOkRatio = tmpGsfRatio; - bestGsfElectron = *gsfIter; - bestGsfElectronRef = reco::GsfElectronRef(gsfElectrons, iElectron); + bestGsfElectron = *gsfIter3; okGsfFound = true; - //std::cout << "evt ID : " << iEvent.id() << " - Pt : " << bestGsfElectron.pt() << " - eta : " << bestGsfElectron.eta() << " - phi : " << bestGsfElectron.phi() << std::endl; // debug lines } } } } // loop over rec ele to look for the best one + if (!okGsfFound) continue; @@ -3597,6 +3539,8 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve // analysis when the mc track is found //------------------------------------ passMiniAODSelection = bestGsfElectron.pt() >= 5.; + isEBflag = bestGsfElectron.isEB(); + isEEflag = bestGsfElectron.isEE(); // electron related distributions h1_ele_charge->Fill(bestGsfElectron.charge()); @@ -3614,10 +3558,10 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve h2_scl_EoEtrueVsrecOfflineVertices->Fill((*vertexCollectionHandle).size(), bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEB()) + if (isEBflag) h2_scl_EoEtrueVsrecOfflineVertices_barrel->Fill((*vertexCollectionHandle).size(), bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEE()) + if (isEEflag) h2_scl_EoEtrueVsrecOfflineVertices_endcaps->Fill((*vertexCollectionHandle).size(), bestGsfElectron.ecalEnergy() / mcIter->p()); @@ -3641,17 +3585,17 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve h2_ele_vertexTIPVsPhi->Fill(bestGsfElectron.phi(), d); h2_ele_vertexTIPVsPt->Fill(bestGsfElectron.pt(), d); h1_ele_EtaMnEtaTrue->Fill(bestGsfElectron.eta() - mcIter->eta()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_EtaMnEtaTrue_barrel->Fill(bestGsfElectron.eta() - mcIter->eta()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_EtaMnEtaTrue_endcaps->Fill(bestGsfElectron.eta() - mcIter->eta()); h2_ele_EtaMnEtaTrueVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eta() - mcIter->eta()); h2_ele_EtaMnEtaTrueVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eta() - mcIter->eta()); h2_ele_EtaMnEtaTrueVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.eta() - mcIter->eta()); h1_ele_PhiMnPhiTrue->Fill(bestGsfElectron.phi() - mcIter->phi()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_PhiMnPhiTrue_barrel->Fill(bestGsfElectron.phi() - mcIter->phi()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_PhiMnPhiTrue_endcaps->Fill(bestGsfElectron.phi() - mcIter->phi()); h1_ele_PhiMnPhiTrue2->Fill(bestGsfElectron.phi() - mcIter->phi()); h2_ele_PhiMnPhiTrueVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.phi() - mcIter->phi()); @@ -3662,67 +3606,66 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve h2_ele_PoPtrueVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.p() / mcIter->p()); h2_ele_PoPtrueVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.p() / mcIter->p()); h2_ele_PoPtrueVsPt->Fill(bestGsfElectron.py(), bestGsfElectron.p() / mcIter->p()); - // if (passMiniAODSelection) { // Pt > 5. h2_ele_sigmaIetaIetaVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.scSigmaIEtaIEta()); - // } - if (bestGsfElectron.isEB()) + + if (isEBflag) h1_ele_PoPtrue_barrel->Fill(bestGsfElectron.p() / mcIter->p()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_PoPtrue_endcaps->Fill(bestGsfElectron.p() / mcIter->p()); - if (bestGsfElectron.isEB() && bestGsfElectron.classification() == GsfElectron::GOLDEN) + if (isEBflag && bestGsfElectron.classification() == GsfElectron::GOLDEN) h1_ele_PoPtrue_golden_barrel->Fill(bestGsfElectron.p() / mcIter->p()); - if (bestGsfElectron.isEE() && bestGsfElectron.classification() == GsfElectron::GOLDEN) + if (isEEflag && bestGsfElectron.classification() == GsfElectron::GOLDEN) h1_ele_PoPtrue_golden_endcaps->Fill(bestGsfElectron.p() / mcIter->p()); - if (bestGsfElectron.isEB() && bestGsfElectron.classification() == GsfElectron::SHOWERING) + if (isEBflag && bestGsfElectron.classification() == GsfElectron::SHOWERING) h1_ele_PoPtrue_showering_barrel->Fill(bestGsfElectron.p() / mcIter->p()); - if (bestGsfElectron.isEE() && bestGsfElectron.classification() == GsfElectron::SHOWERING) + if (isEEflag && bestGsfElectron.classification() == GsfElectron::SHOWERING) h1_ele_PoPtrue_showering_endcaps->Fill(bestGsfElectron.p() / mcIter->p()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_PtoPttrue_barrel->Fill(bestGsfElectron.pt() / mcIter->pt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_PtoPttrue_endcaps->Fill(bestGsfElectron.pt() / mcIter->pt()); h1_ele_ecalEnergyError->Fill(bestGsfElectron.correctedEcalEnergyError()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_ecalEnergyError_barrel->Fill(bestGsfElectron.correctedEcalEnergyError()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_ecalEnergyError_endcaps->Fill(bestGsfElectron.correctedEcalEnergyError()); h1_ele_combinedP4Error->Fill(bestGsfElectron.p4Error(bestGsfElectron.P4_COMBINATION)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_combinedP4Error_barrel->Fill(bestGsfElectron.p4Error(bestGsfElectron.P4_COMBINATION)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_combinedP4Error_endcaps->Fill(bestGsfElectron.p4Error(bestGsfElectron.P4_COMBINATION)); // supercluster related distributions reco::SuperClusterRef sclRef = bestGsfElectron.superCluster(); h1_scl_En->Fill(bestGsfElectron.ecalEnergy()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_EoEtrue_barrel->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_EoEtrue_endcaps->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEB() && bestGsfElectron.isEBEtaGap()) + if (isEBflag && bestGsfElectron.isEBEtaGap()) h1_scl_EoEtrue_barrel_etagap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEB() && bestGsfElectron.isEBPhiGap()) + if (isEBflag && bestGsfElectron.isEBPhiGap()) h1_scl_EoEtrue_barrel_phigap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); if (bestGsfElectron.isEBEEGap()) h1_scl_EoEtrue_ebeegap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEE() && bestGsfElectron.isEEDeeGap()) + if (isEEflag && bestGsfElectron.isEEDeeGap()) h1_scl_EoEtrue_endcaps_deegap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEE() && bestGsfElectron.isEERingGap()) + if (isEEflag && bestGsfElectron.isEERingGap()) h1_scl_EoEtrue_endcaps_ringgap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_EoEtrue_barrel_new->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_EoEtrue_endcaps_new->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEB() && bestGsfElectron.isEBEtaGap()) + if (isEBflag && bestGsfElectron.isEBEtaGap()) h1_scl_EoEtrue_barrel_new_etagap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEB() && bestGsfElectron.isEBPhiGap()) + if (isEBflag && bestGsfElectron.isEBPhiGap()) h1_scl_EoEtrue_barrel_new_phigap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); if (bestGsfElectron.isEBEEGap()) h1_scl_EoEtrue_ebeegap_new->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEE() && bestGsfElectron.isEEDeeGap()) + if (isEEflag && bestGsfElectron.isEEDeeGap()) h1_scl_EoEtrue_endcaps_new_deegap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); - if (bestGsfElectron.isEE() && bestGsfElectron.isEERingGap()) + if (isEEflag && bestGsfElectron.isEERingGap()) h1_scl_EoEtrue_endcaps_new_ringgap->Fill(bestGsfElectron.ecalEnergy() / mcIter->p()); double R = TMath::Sqrt(sclRef->x() * sclRef->x() + sclRef->y() * sclRef->y() + sclRef->z() * sclRef->z()); @@ -3734,48 +3677,47 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve h2_scl_EtaVsPhi->Fill(sclRef->phi(), sclRef->eta()); h1_scl_Phi->Fill(sclRef->phi()); h1_scl_SigEtaEta->Fill(bestGsfElectron.scSigmaEtaEta()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_SigEtaEta_barrel->Fill(bestGsfElectron.scSigmaEtaEta()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_SigEtaEta_endcaps->Fill(bestGsfElectron.scSigmaEtaEta()); h1_scl_SigIEtaIEta->Fill(bestGsfElectron.scSigmaIEtaIEta()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_SigIEtaIEta_barrel->Fill(bestGsfElectron.scSigmaIEtaIEta()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_SigIEtaIEta_endcaps->Fill(bestGsfElectron.scSigmaIEtaIEta()); if (passMiniAODSelection) { // Pt > 5. h1_scl_SigIEtaIEta_mAOD->Fill(bestGsfElectron.scSigmaIEtaIEta()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_SigIEtaIEta_mAOD_barrel->Fill(bestGsfElectron.scSigmaIEtaIEta()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_SigIEtaIEta_mAOD_endcaps->Fill(bestGsfElectron.scSigmaIEtaIEta()); } h1_scl_full5x5_sigmaIetaIeta->Fill(bestGsfElectron.full5x5_sigmaIetaIeta()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_full5x5_sigmaIetaIeta_barrel->Fill(bestGsfElectron.full5x5_sigmaIetaIeta()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_full5x5_sigmaIetaIeta_endcaps->Fill(bestGsfElectron.full5x5_sigmaIetaIeta()); h1_scl_E1x5->Fill(bestGsfElectron.scE1x5()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_E1x5_barrel->Fill(bestGsfElectron.scE1x5()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_E1x5_endcaps->Fill(bestGsfElectron.scE1x5()); h1_scl_E2x5max->Fill(bestGsfElectron.scE2x5Max()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_E2x5max_barrel->Fill(bestGsfElectron.scE2x5Max()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_E2x5max_endcaps->Fill(bestGsfElectron.scE2x5Max()); h1_scl_E5x5->Fill(bestGsfElectron.scE5x5()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_E5x5_barrel->Fill(bestGsfElectron.scE5x5()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_E5x5_endcaps->Fill(bestGsfElectron.scE5x5()); float pfEnergy = 0.; if (!bestGsfElectron.parentSuperCluster().isNull()) pfEnergy = bestGsfElectron.parentSuperCluster()->energy(); h2_scl_EoEtruePfVsEg->Fill(bestGsfElectron.ecalEnergy() / mcIter->p(), pfEnergy / mcIter->p()); - // h1_scl_ESFrac->Fill( sclRef->preshowerEnergy() / sclRef->rawEnergy() ); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_ESFrac_endcaps->Fill(sclRef->preshowerEnergy() / sclRef->rawEnergy()); float Etot = 0.; @@ -3785,9 +3727,9 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve Etot += (*it)->energy(); } h1_scl_bcl_EtotoEtrue->Fill(Etot / mcIter->p()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_scl_bcl_EtotoEtrue_barrel->Fill(Etot / mcIter->p()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_scl_bcl_EtotoEtrue_endcaps->Fill(Etot / mcIter->p()); // track related distributions @@ -3798,9 +3740,9 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve if (!readAOD_) // track extra does not exist in AOD { h1_ele_foundHits->Fill(bestGsfElectron.gsfTrack()->numberOfValidHits()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_foundHits_barrel->Fill(bestGsfElectron.gsfTrack()->numberOfValidHits()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_foundHits_endcaps->Fill(bestGsfElectron.gsfTrack()->numberOfValidHits()); h2_ele_foundHitsVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->numberOfValidHits()); if (passMiniAODSelection) { // Pt > 5. @@ -3809,17 +3751,17 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve h2_ele_foundHitsVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.gsfTrack()->numberOfValidHits()); h2_ele_foundHitsVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.gsfTrack()->numberOfValidHits()); h1_ele_lostHits->Fill(bestGsfElectron.gsfTrack()->numberOfLostHits()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_lostHits_barrel->Fill(bestGsfElectron.gsfTrack()->numberOfLostHits()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_lostHits_endcaps->Fill(bestGsfElectron.gsfTrack()->numberOfLostHits()); h2_ele_lostHitsVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->numberOfLostHits()); h2_ele_lostHitsVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.gsfTrack()->numberOfLostHits()); h2_ele_lostHitsVsPt->Fill(bestGsfElectron.pt(), bestGsfElectron.gsfTrack()->numberOfLostHits()); h1_ele_chi2->Fill(bestGsfElectron.gsfTrack()->normalizedChi2()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_chi2_barrel->Fill(bestGsfElectron.gsfTrack()->normalizedChi2()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_chi2_endcaps->Fill(bestGsfElectron.gsfTrack()->normalizedChi2()); h2_ele_chi2VsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.gsfTrack()->normalizedChi2()); h2_ele_chi2VsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.gsfTrack()->normalizedChi2()); @@ -3895,33 +3837,33 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve // match distributions h1_ele_EoP->Fill(bestGsfElectron.eSuperClusterOverP()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_EoP_barrel->Fill(bestGsfElectron.eSuperClusterOverP()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_EoP_endcaps->Fill(bestGsfElectron.eSuperClusterOverP()); h2_ele_EoPVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eSuperClusterOverP()); h2_ele_EoPVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eSuperClusterOverP()); h2_ele_EoPVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eSuperClusterOverP()); h1_ele_EseedOP->Fill(bestGsfElectron.eSeedClusterOverP()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_EseedOP_barrel->Fill(bestGsfElectron.eSeedClusterOverP()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_EseedOP_endcaps->Fill(bestGsfElectron.eSeedClusterOverP()); h2_ele_EseedOPVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eSeedClusterOverP()); h2_ele_EseedOPVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eSeedClusterOverP()); h2_ele_EseedOPVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eSeedClusterOverP()); h1_ele_EoPout->Fill(bestGsfElectron.eSeedClusterOverPout()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_EoPout_barrel->Fill(bestGsfElectron.eSeedClusterOverPout()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_EoPout_endcaps->Fill(bestGsfElectron.eSeedClusterOverPout()); h2_ele_EoPoutVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eSeedClusterOverPout()); h2_ele_EoPoutVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eSeedClusterOverPout()); h2_ele_EoPoutVsE->Fill(bestGsfElectron.caloEnergy(), bestGsfElectron.eSeedClusterOverPout()); h1_ele_EeleOPout->Fill(bestGsfElectron.eEleClusterOverPout()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_EeleOPout_barrel->Fill(bestGsfElectron.eEleClusterOverPout()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_EeleOPout_endcaps->Fill(bestGsfElectron.eEleClusterOverPout()); h2_ele_EeleOPoutVsEta->Fill(bestGsfElectron.eta(), bestGsfElectron.eEleClusterOverPout()); h2_ele_EeleOPoutVsPhi->Fill(bestGsfElectron.phi(), bestGsfElectron.eEleClusterOverPout()); @@ -3930,31 +3872,31 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve if (passMiniAODSelection) { // Pt > 5. h1_ele_dEtaSc_propVtx_mAOD->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); } - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dEtaSc_propVtx_barrel->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dEtaSc_propVtx_endcaps->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); if (passMiniAODSelection) { // Pt > 5. - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dEtaSc_propVtx_mAOD_barrel->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dEtaSc_propVtx_mAOD_endcaps->Fill(bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); } h2_ele_dEtaScVsEta_propVtx->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); h2_ele_dEtaScVsPhi_propVtx->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); h2_ele_dEtaScVsPt_propVtx->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaEtaSuperClusterTrackAtVtx()); h1_ele_dPhiSc_propVtx->Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dPhiSc_propVtx_barrel->Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dPhiSc_propVtx_endcaps->Fill(bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); h2_ele_dPhiScVsEta_propVtx->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); h2_ele_dPhiScVsPhi_propVtx->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); h2_ele_dPhiScVsPt_propVtx->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaPhiSuperClusterTrackAtVtx()); h1_ele_dEtaCl_propOut->Fill(bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dEtaCl_propOut_barrel->Fill(bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dEtaCl_propOut_endcaps->Fill(bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); h2_ele_dEtaClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); h2_ele_dEtaClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaEtaSeedClusterTrackAtCalo()); @@ -3963,31 +3905,31 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve if (passMiniAODSelection) { // Pt > 5. h1_ele_dPhiCl_propOut_mAOD->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); } - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dPhiCl_propOut_barrel->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dPhiCl_propOut_endcaps->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); if (passMiniAODSelection) { // Pt > 5. - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dPhiCl_propOut_mAOD_barrel->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dPhiCl_propOut_mAOD_endcaps->Fill(bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); } h2_ele_dPhiClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); h2_ele_dPhiClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); h2_ele_dPhiClVsPt_propOut->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaPhiSeedClusterTrackAtCalo()); h1_ele_dEtaEleCl_propOut->Fill(bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dEtaEleCl_propOut_barrel->Fill(bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dEtaEleCl_propOut_endcaps->Fill(bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); h2_ele_dEtaEleClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); h2_ele_dEtaEleClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); h2_ele_dEtaEleClVsPt_propOut->Fill(bestGsfElectron.pt(), bestGsfElectron.deltaEtaEleClusterTrackAtCalo()); h1_ele_dPhiEleCl_propOut->Fill(bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_dPhiEleCl_propOut_barrel->Fill(bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_dPhiEleCl_propOut_endcaps->Fill(bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); h2_ele_dPhiEleClVsEta_propOut->Fill(bestGsfElectron.eta(), bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); h2_ele_dPhiEleClVsPhi_propOut->Fill(bestGsfElectron.phi(), bestGsfElectron.deltaPhiEleClusterTrackAtCalo()); @@ -3997,18 +3939,18 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve h1_ele_HoE_mAOD->Fill(bestGsfElectron.hcalOverEcal()); } h1_ele_HoE_bc->Fill(bestGsfElectron.hcalOverEcalBc()); - if (bestGsfElectron.isEB()) + if (isEBflag) { h1_ele_HoE_bc_barrel->Fill(bestGsfElectron.hcalOverEcalBc()); - if (bestGsfElectron.isEE()) - h1_ele_HoE_bc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc()); - if (bestGsfElectron.isEB()) h1_ele_HoE_barrel->Fill(bestGsfElectron.hcalOverEcal()); - if (bestGsfElectron.isEE()) + } + if (isEEflag) { + h1_ele_HoE_bc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc()); h1_ele_HoE_endcaps->Fill(bestGsfElectron.hcalOverEcal()); + } if (passMiniAODSelection) { // Pt > 5. - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_HoE_mAOD_barrel->Fill(bestGsfElectron.hcalOverEcal()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_HoE_mAOD_endcaps->Fill(bestGsfElectron.hcalOverEcal()); } if (!bestGsfElectron.isEBEtaGap() && !bestGsfElectron.isEBPhiGap() && !bestGsfElectron.isEBEEGap() && @@ -4020,17 +3962,17 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve //classes int eleClass = bestGsfElectron.classification(); - if (bestGsfElectron.isEE()) + if (isEEflag) eleClass += 10; h1_ele_classes->Fill(eleClass); - if (bestGsfElectron.classification() == GsfElectron::GOLDEN && bestGsfElectron.isEB()) + if (bestGsfElectron.classification() == GsfElectron::GOLDEN && isEBflag) h1_scl_EoEtrueGolden_barrel->Fill(sclRef->energy() / mcIter->p()); - if (bestGsfElectron.classification() == GsfElectron::GOLDEN && bestGsfElectron.isEE()) + if (bestGsfElectron.classification() == GsfElectron::GOLDEN && isEEflag) h1_scl_EoEtrueGolden_endcaps->Fill(sclRef->energy() / mcIter->p()); - if (bestGsfElectron.classification() == GsfElectron::SHOWERING && bestGsfElectron.isEB()) + if (bestGsfElectron.classification() == GsfElectron::SHOWERING && isEBflag) h1_scl_EoEtrueShowering_barrel->Fill(sclRef->energy() / mcIter->p()); - if (bestGsfElectron.classification() == GsfElectron::SHOWERING && bestGsfElectron.isEE()) + if (bestGsfElectron.classification() == GsfElectron::SHOWERING && isEEflag) h1_scl_EoEtrueShowering_endcaps->Fill(sclRef->energy() / mcIter->p()); //eleClass = eleClass%100; // get rid of barrel/endcap distinction @@ -4049,7 +3991,7 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve if (passMiniAODSelection) { // Pt > 5. h1_ele_fbrem_mAOD->Fill(fbrem_mode); } - if (bestGsfElectron.isEB()) { + if (isEBflag) { double fbrem_mode_barrel = bestGsfElectron.fbrem(); h1_ele_fbrem_barrel->Fill(fbrem_mode_barrel); if (passMiniAODSelection) { // Pt > 5. @@ -4057,7 +3999,7 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve } } - if (bestGsfElectron.isEE()) { + if (isEEflag) { double fbrem_mode_endcaps = bestGsfElectron.fbrem(); h1_ele_fbrem_endcaps->Fill(fbrem_mode_endcaps); if (passMiniAODSelection) { // Pt > 5. @@ -4068,12 +4010,12 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve double superclusterfbrem_mode = bestGsfElectron.superClusterFbrem(); h1_ele_superclusterfbrem->Fill(superclusterfbrem_mode); - if (bestGsfElectron.isEB()) { + if (isEBflag) { double superclusterfbrem_mode_barrel = bestGsfElectron.superClusterFbrem(); h1_ele_superclusterfbrem_barrel->Fill(superclusterfbrem_mode_barrel); } - if (bestGsfElectron.isEE()) { + if (isEEflag) { double superclusterfbrem_mode_endcaps = bestGsfElectron.superClusterFbrem(); h1_ele_superclusterfbrem_endcaps->Fill(superclusterfbrem_mode_endcaps); } @@ -4122,14 +4064,14 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve // provenance and pflow data h1_ele_mva->Fill(bestGsfElectron.mva_e_pi()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_mva_barrel->Fill(bestGsfElectron.mva_e_pi()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_mva_endcaps->Fill(bestGsfElectron.mva_e_pi()); h1_ele_mva_isolated->Fill(bestGsfElectron.mva_Isolated()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_mva_barrel_isolated->Fill(bestGsfElectron.mva_Isolated()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_mva_endcaps_isolated->Fill(bestGsfElectron.mva_Isolated()); if (bestGsfElectron.ecalDrivenSeed()) h1_ele_provenance->Fill(1.); @@ -4142,25 +4084,25 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed()) h1_ele_provenance->Fill(2.); - if (bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEB()) + if (bestGsfElectron.ecalDrivenSeed() && isEBflag) h1_ele_provenance_barrel->Fill(1.); - if (bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.isEB()) + if (bestGsfElectron.trackerDrivenSeed() && isEBflag) h1_ele_provenance_barrel->Fill(-1.); - if ((bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) && bestGsfElectron.isEB()) + if ((bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) && isEBflag) h1_ele_provenance_barrel->Fill(0.); - if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEB()) + if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed() && isEBflag) h1_ele_provenance_barrel->Fill(-2.); - if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEB()) + if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed() && isEBflag) h1_ele_provenance_barrel->Fill(2.); - if (bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEE()) + if (bestGsfElectron.ecalDrivenSeed() && isEEflag) h1_ele_provenance_endcaps->Fill(1.); - if (bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.isEE()) + if (bestGsfElectron.trackerDrivenSeed() && isEEflag) h1_ele_provenance_endcaps->Fill(-1.); - if ((bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) && bestGsfElectron.isEE()) + if ((bestGsfElectron.trackerDrivenSeed() || bestGsfElectron.ecalDrivenSeed()) && isEEflag) h1_ele_provenance_endcaps->Fill(0.); - if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEE()) + if (bestGsfElectron.trackerDrivenSeed() && !bestGsfElectron.ecalDrivenSeed() && isEEflag) h1_ele_provenance_endcaps->Fill(-2.); - if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed() && bestGsfElectron.isEE()) + if (!bestGsfElectron.trackerDrivenSeed() && bestGsfElectron.ecalDrivenSeed() && isEEflag) h1_ele_provenance_endcaps->Fill(2.); if (bestGsfElectron.isGsfCtfScPixChargeConsistent()) @@ -4172,151 +4114,147 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve // Pflow isolation h1_ele_chargedHadronIso->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt); - if (bestGsfElectron.isEB()) - h1_ele_chargedHadronIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt); - if (bestGsfElectron.isEE()) - h1_ele_chargedHadronIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt); - h1_ele_neutralHadronIso->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt); - if (bestGsfElectron.isEB()) - h1_ele_neutralHadronIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt); - if (bestGsfElectron.isEE()) - h1_ele_neutralHadronIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt); - h1_ele_photonIso->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt); - if (bestGsfElectron.isEB()) + if (isEBflag) { + h1_ele_chargedHadronIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt); + h1_ele_neutralHadronIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt); h1_ele_photonIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt); - if (bestGsfElectron.isEE()) + } + + if (isEEflag) { + h1_ele_chargedHadronIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt); + h1_ele_neutralHadronIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt); h1_ele_photonIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt); + } // -- pflow over pT h1_ele_chargedHadronRelativeIso->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt / bestGsfElectron.pt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_chargedHadronRelativeIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt / bestGsfElectron.pt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_chargedHadronRelativeIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt / bestGsfElectron.pt()); if (passMiniAODSelection) { // Pt > 5. h1_ele_chargedHadronRelativeIso_mAOD->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt / bestGsfElectron.pt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_chargedHadronRelativeIso_mAOD_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt / bestGsfElectron.pt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_chargedHadronRelativeIso_mAOD_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumChargedHadronPt / bestGsfElectron.pt()); } h1_ele_neutralHadronRelativeIso->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_neutralHadronRelativeIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_neutralHadronRelativeIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt / bestGsfElectron.pt()); if (passMiniAODSelection) { // Pt > 5. h1_ele_neutralHadronRelativeIso_mAOD->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_neutralHadronRelativeIso_mAOD_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_neutralHadronRelativeIso_mAOD_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumNeutralHadronEt / bestGsfElectron.pt()); } h1_ele_photonRelativeIso->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_photonRelativeIso_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_photonRelativeIso_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt()); if (passMiniAODSelection) { // Pt > 5. h1_ele_photonRelativeIso_mAOD->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_photonRelativeIso_mAOD_barrel->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_photonRelativeIso_mAOD_endcaps->Fill(bestGsfElectron.pfIsolationVariables().sumPhotonEt / bestGsfElectron.pt()); } // isolation h1_ele_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_tkSumPt_dr03_barrel->Fill(bestGsfElectron.dr03TkSumPt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_tkSumPt_dr03_endcaps->Fill(bestGsfElectron.dr03TkSumPt()); h1_ele_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_ecalRecHitSumEt_dr03_barrel->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_ecalRecHitSumEt_dr03_endcaps->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); h1_ele_hcalTowerSumEt_dr03_depth1->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEt_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEt_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); h1_ele_hcalTowerSumEt_dr03_depth2->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEt_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEt_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); h1_ele_hcalTowerSumEtBc_dr03_depth1->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEtBc_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEtBc_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); h1_ele_hcalTowerSumEtBc_dr03_depth2->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEtBc_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEtBc_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); h1_ele_tkSumPt_dr04->Fill(bestGsfElectron.dr04TkSumPt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_tkSumPt_dr04_barrel->Fill(bestGsfElectron.dr04TkSumPt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_tkSumPt_dr04_endcaps->Fill(bestGsfElectron.dr04TkSumPt()); h1_ele_ecalRecHitSumEt_dr04->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_ecalRecHitSumEt_dr04_barrel->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_ecalRecHitSumEt_dr04_endcaps->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); h1_ele_hcalTowerSumEt_dr04_depth1->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEt_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEt_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); h1_ele_hcalTowerSumEt_dr04_depth2->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); - if (bestGsfElectron.isEB()) + if (isEBflag) h1_ele_hcalTowerSumEt_dr04_depth2_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); - if (bestGsfElectron.isEE()) + if (isEEflag) h1_ele_hcalTowerSumEt_dr04_depth2_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); h1_ele_hcalTowerSumEtBc_dr04_depth1->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); - if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEtBc_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); - if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEtBc_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); h1_ele_hcalTowerSumEtBc_dr04_depth2->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); - if (bestGsfElectron.isEB()) + if (isEBflag) { + h1_ele_hcalTowerSumEtBc_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); h1_ele_hcalTowerSumEtBc_dr04_depth2_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); - if (bestGsfElectron.isEE()) + } + if (isEEflag) { + h1_ele_hcalTowerSumEtBc_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); h1_ele_hcalTowerSumEtBc_dr04_depth2_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); + } h1_ele_hcalDepth1OverEcalBc->Fill(bestGsfElectron.hcalOverEcalBc(1)); - if (bestGsfElectron.isEB()) - h1_ele_hcalDepth1OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(1)); - if (bestGsfElectron.isEE()) - h1_ele_hcalDepth1OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(1)); h1_ele_hcalDepth2OverEcalBc->Fill(bestGsfElectron.hcalOverEcalBc(2)); - if (bestGsfElectron.isEB()) + if (isEBflag) { + h1_ele_hcalDepth1OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(1)); h1_ele_hcalDepth2OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(2)); - if (bestGsfElectron.isEE()) + } + if (isEEflag) { + h1_ele_hcalDepth1OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(1)); h1_ele_hcalDepth2OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(2)); - + } // conversion rejection int flags = bestGsfElectron.convFlags(); if (flags == -9999) { From ae5bf791c470fc55bbf89029447841eafd5f814f Mon Sep 17 00:00:00 2001 From: Arnaud Date: Wed, 8 Sep 2021 11:51:28 +0200 Subject: [PATCH 4/8] scram build code-format corrections --- .../plugins/ElectronMcFakeValidator.cc | 16 ++++++------ .../ElectronMcMiniAODSignalValidator.cc | 21 ++++++---------- .../plugins/ElectronMcSignalValidator.cc | 25 ++++++++----------- 3 files changed, 25 insertions(+), 37 deletions(-) diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc index 6f87f24e27c48..27767c11932e1 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc @@ -2448,29 +2448,27 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event h1_recOfflineVertices_->Fill((*vertexCollectionHandle).size()); reco::GsfElectronCollection::const_iterator gsfIter; - std::vector ::const_iterator gsfIter3; - std::vector ::const_iterator gsfIter4; + std::vector::const_iterator gsfIter3; + std::vector::const_iterator gsfIter4; //=============================================== // get a vector with EB & EE //=============================================== - std::vector localCollection; + std::vector localCollection; int iBarrels = 0; int iEndcaps = 0; // looking for EB for (gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end(); gsfIter++) { - if (gsfIter->isEB()) - { - localCollection.push_back( *gsfIter ); + if (gsfIter->isEB()) { + localCollection.push_back(*gsfIter); iBarrels += 1; } } // looking for EE for (gsfIter = gsfElectronsEndcaps->begin(); gsfIter != gsfElectronsEndcaps->end(); gsfIter++) { - if (gsfIter->isEE()) - { + if (gsfIter->isEE()) { localCollection.push_back(*gsfIter); iEndcaps += 1; } @@ -2548,7 +2546,7 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event bool okGsfFound = false; double gsfOkRatio = 999999.; bool isEBflag = false; - bool isEEflag = false; + bool isEEflag = false; // find best matched electron reco::GsfElectron bestGsfElectron; diff --git a/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc index dd71ff8650f4c..28e9fe903cd07 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc @@ -439,29 +439,27 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e pat::Electron gsfElectron; pat::ElectronCollection::const_iterator el1; pat::ElectronCollection::const_iterator el2; - std::vector ::const_iterator el3; - std::vector ::const_iterator el4; + std::vector::const_iterator el3; + std::vector::const_iterator el4; //=============================================== // get a vector with EB & EE //=============================================== - std::vector localCollection; + std::vector localCollection; int iBarrels = 0; int iEndcaps = 0; // looking for EB for (el1 = electrons->begin(); el1 != electrons->end(); el1++) { - if (el1->isEB()) - { - localCollection.push_back( *el1 ); + if (el1->isEB()) { + localCollection.push_back(*el1); iBarrels += 1; } } // looking for EE for (el1 = electrons_endcaps->begin(); el1 != electrons_endcaps->end(); el1++) { - if (el1->isEE()) - { + if (el1->isEE()) { localCollection.push_back(*el1); iEndcaps += 1; } @@ -490,7 +488,6 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e //=============================================== for (size_t i = 0; i < genParticles->size(); i++) { - // number of mc particles mcNum++; @@ -504,7 +501,6 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e const Candidate* mother = (*genParticles)[i].mother(0); matchingMotherID = false; for (unsigned int ii = 0; ii < matchingMotherIDs_.size(); ii++) { - if (mother == nullptr) { matchingMotherID = true; } else if (mother->pdgId() == matchingMotherIDs_[ii]) { @@ -529,11 +525,10 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e bool passMiniAODSelection = true; double gsfOkRatio = 999999.; bool isEBflag = false; - bool isEEflag = false; + bool isEEflag = false; pat::Electron bestGsfElectron; for (el3 = localCollection.begin(); el3 != localCollection.end(); el3++) { - double dphi = el3->phi() - (*genParticles)[i].phi(); if (std::abs(dphi) > CLHEP::pi) { dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi; @@ -550,7 +545,7 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e } } } - } // end *electrons loop + } // end *electrons loop if (okGsfFound) { //------------------------------------ diff --git a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc index c5af6bfad9fdd..d4d04c744bcd2 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc @@ -3269,29 +3269,27 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve h1_recOfflineVertices->Fill((*vertexCollectionHandle).size()); reco::GsfElectronCollection::const_iterator gsfIter; - std::vector ::const_iterator gsfIter3; - std::vector ::const_iterator gsfIter4; + std::vector::const_iterator gsfIter3; + std::vector::const_iterator gsfIter4; //=============================================== // get a vector with EB & EE //=============================================== - std::vector localCollection; + std::vector localCollection; int iBarrels = 0; int iEndcaps = 0; // looking for EB for (gsfIter = gsfElectrons->begin(); gsfIter != gsfElectrons->end(); gsfIter++) { - if (gsfIter->isEB()) - { - localCollection.push_back( *gsfIter ); + if (gsfIter->isEB()) { + localCollection.push_back(*gsfIter); iBarrels += 1; } } // looking for EE for (gsfIter = gsfElectronsEndcaps->begin(); gsfIter != gsfElectronsEndcaps->end(); gsfIter++) { - if (gsfIter->isEE()) - { + if (gsfIter->isEE()) { localCollection.push_back(*gsfIter); iEndcaps += 1; } @@ -3303,7 +3301,6 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve // mee only for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) { - float enrj1 = gsfIter3->ecalEnergy(); for (gsfIter4 = gsfIter3 + 1; gsfIter4 != localCollection.end(); gsfIter4++) { @@ -3328,7 +3325,8 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve if ((gsfIter3->classification() == GsfElectron::GOLDEN && gsfIter4->classification() == GsfElectron::GOLDEN) || (gsfIter3->classification() == GsfElectron::GOLDEN && gsfIter4->classification() == GsfElectron::BIGBREM) || (gsfIter3->classification() == GsfElectron::BIGBREM && gsfIter4->classification() == GsfElectron::GOLDEN) || - (gsfIter3->classification() == GsfElectron::BIGBREM && gsfIter4->classification() == GsfElectron::BIGBREM)) { + (gsfIter3->classification() == GsfElectron::BIGBREM && + gsfIter4->classification() == GsfElectron::BIGBREM)) { h1_ele_mee_os_gg->Fill(sqrt(mee2)); } else if ((gsfIter3->classification() == GsfElectron::SHOWERING && gsfIter4->classification() == GsfElectron::SHOWERING) || @@ -3385,7 +3383,6 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve reco::GenParticleCollection::const_iterator mcIter; for (mcIter = genParticles->begin(); mcIter != genParticles->end(); mcIter++) { - // select requested matching gen particle matchingID = false; for (unsigned int i = 0; i < matchingIDs_.size(); i++) { @@ -3399,7 +3396,6 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve const Candidate *mother = mcIter->mother(); matchingMotherID = false; for (unsigned int i = 0; i < matchingMotherIDs_.size(); i++) { - if (mother == nullptr) { matchingMotherID = true; } else if (mother->pdgId() == matchingMotherIDs_[i]) { @@ -3508,10 +3504,10 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve bool passMiniAODSelection = true; double gsfOkRatio = 999999.; bool isEBflag = false; - bool isEEflag = false; + bool isEEflag = false; reco::GsfElectron bestGsfElectron; - for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) { + for (gsfIter3 = localCollection.begin(); gsfIter3 != localCollection.end(); gsfIter3++) { // temporary cut for pt < 5. double dphi = gsfIter3->phi() - mcIter->phi(); if (std::abs(dphi) > CLHEP::pi) { @@ -3526,7 +3522,6 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve gsfOkRatio = tmpGsfRatio; bestGsfElectron = *gsfIter3; okGsfFound = true; - } } } From 9162a3af182e6160b9883cbae04ff0b8aac9fbe5 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Wed, 8 Sep 2021 15:36:11 +0200 Subject: [PATCH 5/8] remove unused variable not detected with code-checks nor code-format --- .../RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc index 28e9fe903cd07..d4f530bca4316 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc @@ -438,7 +438,6 @@ void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const e pat::Electron gsfElectron; pat::ElectronCollection::const_iterator el1; - pat::ElectronCollection::const_iterator el2; std::vector::const_iterator el3; std::vector::const_iterator el4; From e2d53f40367865e2cdf05fed0b79a0fe790faeff Mon Sep 17 00:00:00 2001 From: Arnaud Date: Mon, 13 Sep 2021 12:47:54 +0200 Subject: [PATCH 6/8] add deltaR2 in FakeValidator --- Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc | 5 +++-- Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc index 27767c11932e1..3cc0d3c5269c8 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc @@ -76,6 +76,7 @@ ElectronMcFakeValidator::ElectronMcFakeValidator(const edm::ParameterSet &conf) maxPt_ = conf.getParameter("MaxPt"); maxAbsEta_ = conf.getParameter("MaxAbsEta"); deltaR_ = conf.getParameter("DeltaR"); + deltaR2_ = deltaR_ * deltaR_; inputFile_ = conf.getParameter("InputFile"); outputFile_ = conf.getParameter("OutputFile"); inputInternalPath_ = conf.getParameter("InputFolderName"); @@ -2556,8 +2557,8 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event if (std::abs(dphi) > CLHEP::pi) { dphi = dphi < 0 ? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi; } - double deltaR = sqrt(pow((gsfIter3->eta() - moIter->eta()), 2) + pow(dphi, 2)); - if (deltaR < deltaR_) { + double deltaR2 = (gsfIter3->eta() - moIter->eta()) * (gsfIter3->eta() - moIter->eta()) + dphi * dphi; + if (deltaR2 < deltaR2_) { double tmpGsfRatio = gsfIter3->p() / moIter->energy(); if (std::abs(tmpGsfRatio - 1) < std::abs(gsfOkRatio - 1)) { gsfOkRatio = tmpGsfRatio; diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h index b7cb107b0b083..bb46dac5ac933 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h @@ -67,7 +67,7 @@ class ElectronMcFakeValidator : public ElectronDqmAnalyzerBase { double maxPt_; double maxAbsEta_; - double deltaR_; + double deltaR_, deltaR2_; std::string inputFile_; std::string outputFile_; From 77e71b43664c5f22886ebc673525773a15fa05ae Mon Sep 17 00:00:00 2001 From: Arnaud Date: Mon, 13 Sep 2021 12:48:57 +0200 Subject: [PATCH 7/8] remove type specification into HGCal modifications part --- ...lectronMcFakeValidator_gedGsfElectrons_cfi.py | 15 +++++++-------- .../ElectronMcSignalValidatorMiniAOD_cfi.py | 4 ++-- ...cSignalValidatorPt1000_gedGsfElectrons_cfi.py | 14 ++++++-------- ...ctronMcSignalValidator_gedGsfElectrons_cfi.py | 16 ++++++++-------- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py index b06c58fbfb5ea..6f6b626f8f9c5 100644 --- a/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcFakeValidator_gedGsfElectrons_cfi.py @@ -1,4 +1,3 @@ - import FWCore.ParameterSet.Config as cms electronMcFakeHistosCfg = cms.PSet( @@ -67,17 +66,17 @@ electronMcFakeValidator, electronCollectionEndcaps = 'ecalDrivenGsfElectronsHGC', electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', - MaxAbsEta = cms.double(3.0), + MaxAbsEta = 3.0, histosCfg = dict( Nbineta = 60 , Nbineta2D = 60 , Etamin = -3.0 , Etamax = 3.0 , - NbinOPV = cms.int32(125), OPV_min = cms.double(-0.5), OPV_max = cms.double(249.5) , - NbinELE = cms.int32(100), ELE_min = cms.double(-0.5), ELE_max = cms.double(999.5) , - NbinCORE = cms.int32(100), CORE_min = cms.double(-0.5), CORE_max = cms.double(999.5) , - NbinTRACK = cms.int32(100), TRACK_min = cms.double(-0.5), TRACK_max = cms.double(999.5) , - NbinSEED = cms.int32(100), SEED_min = cms.double(-0.5), SEED_max = cms.double(9999.5) , + NbinOPV = 125, OPV_min = -0.5, OPV_max = 249.5, + NbinELE = 100, ELE_min = -0.5, ELE_max = 999.5, + NbinCORE = 100, CORE_min = -0.5, CORE_max = 999.5, + NbinTRACK = 100, TRACK_min = -0.5, TRACK_max = 999.5, + NbinSEED = 100, SEED_min = -0.5, SEED_max = 9999.5, ), -) +) \ No newline at end of file diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py index fc47bee9d7a08..7b3244bebb3b0 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidatorMiniAOD_cfi.py @@ -58,11 +58,11 @@ phase2_hgcal.toModify( electronMcSignalValidatorMiniAOD, electrons_endcaps=cms.InputTag("slimmedElectronsHGC"), - MaxAbsEta=cms.double(3.0), + MaxAbsEta=3.0, histosCfg=dict( Nbineta=60, Nbineta2D=60, Etamin=-3.0, Etamax=3.0, ), -) \ No newline at end of file +) diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py index b0f9897874206..f150f31312adb 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidatorPt1000_gedGsfElectrons_cfi.py @@ -71,19 +71,17 @@ electronMcSignalValidatorPt1000, electronCollectionEndcaps = cms.InputTag("ecalDrivenGsfElectronsHGC"), electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', - MaxAbsEta = cms.double(3.0), + MaxAbsEta = 3.0, histosCfg = dict( Nbineta = 60 , Nbineta2D = 60 , Etamin = -3.0 , Etamax = 3.0 , - NbinOPV = cms.int32(125), OPV_min = cms.double(-0.5), OPV_max = cms.double(249.5) , - NbinELE = cms.int32(100), ELE_min = cms.double(-0.5), ELE_max = cms.double(999.5) , - NbinCORE = cms.int32(100), CORE_min = cms.double(-0.5), CORE_max = cms.double(999.5) , - NbinTRACK = cms.int32(100), TRACK_min = cms.double(-0.5), TRACK_max = cms.double(999.5) , - NbinSEED = cms.int32(100), SEED_min = cms.double(-0.5), SEED_max = cms.double(9999.5) , + NbinOPV = 125, OPV_min = -0.5, OPV_max = 249.5, + NbinELE = 100, ELE_min = -0.5, ELE_max = 999.5, + NbinCORE = 100, CORE_min = -0.5, CORE_max = 999.5, + NbinTRACK = 100, TRACK_min = -0.5, TRACK_max = 999.5, + NbinSEED = 100, SEED_min = -0.5, SEED_max = 9999.5, ), ) - - diff --git a/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py b/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py index d4b533cbf7d73..a7a509f9ea1dc 100644 --- a/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py +++ b/Validation/RecoEgamma/python/ElectronMcSignalValidator_gedGsfElectrons_cfi.py @@ -3,10 +3,10 @@ electronMcSignalHistosCfg = cms.PSet( Nbinxyz = cms.int32(50), Nbinp = cms.int32(50), Nbinp2D = cms.int32(50), Pmax = cms.double(300.0), - Nbinpt = cms.int32(50), Nbinpt2D = cms.int32(50), Nbinpteff = cms.int32(19),Ptmax = cms.double(100.0), + Nbinpt = cms.int32(50), Nbinpt2D = cms.int32(50), Nbinpteff = cms.int32(19), Ptmax = cms.double(100.0), Nbinfhits = cms.int32(30), Fhitsmax = cms.double(30.0), Nbinlhits = cms.int32(5), Lhitsmax = cms.double(10.0), - Nbineta = cms.int32(50), Nbineta2D = cms.int32(50),Etamin = cms.double(-2.5), Etamax = cms.double(2.5), + Nbineta = cms.int32(50), Nbineta2D = cms.int32(50), Etamin = cms.double(-2.5), Etamax = cms.double(2.5), Nbindeta = cms.int32(100), Detamin = cms.double(-0.005), Detamax = cms.double(0.005), Nbindetamatch = cms.int32(100), Nbindetamatch2D = cms.int32(50), Detamatchmin = cms.double(-0.05), Detamatchmax = cms.double(0.05), Nbinphi = cms.int32(64), Nbinphi2D = cms.int32(32), Phimin = cms.double(-3.2), Phimax = cms.double(3.2), @@ -67,17 +67,17 @@ electronMcSignalValidator, electronCollectionEndcaps = 'ecalDrivenGsfElectronsHGC', electronCoreCollection = 'ecalDrivenGsfElectronCoresHGC', - MaxAbsEta = cms.double(3.0), + MaxAbsEta = 3.0, histosCfg = dict( Nbineta = 60 , Nbineta2D = 60 , Etamin = -3.0 , Etamax = 3.0 , - NbinOPV = cms.int32(125), OPV_min = cms.double(-0.5), OPV_max = cms.double(249.5) , - NbinELE = cms.int32(100), ELE_min = cms.double(-0.5), ELE_max = cms.double(999.5) , - NbinCORE = cms.int32(100), CORE_min = cms.double(-0.5), CORE_max = cms.double(999.5) , - NbinTRACK = cms.int32(100), TRACK_min = cms.double(-0.5), TRACK_max = cms.double(999.5) , - NbinSEED = cms.int32(100), SEED_min = cms.double(-0.5), SEED_max = cms.double(9999.5) , + NbinOPV = 125, OPV_min = -0.5, OPV_max = 249.5 , + NbinELE = 100, ELE_min = -0.5, ELE_max = 999.5, + NbinCORE = 100, CORE_min = -0.5, CORE_max = 999.5, + NbinTRACK = 100, TRACK_min = -0.5, TRACK_max = 999.5, + NbinSEED = 100, SEED_min = -0.5, SEED_max = 9999.5, ), ) From 006bbaef4c9f225020045a70fcc69410476b850a Mon Sep 17 00:00:00 2001 From: Arnaud Date: Mon, 13 Sep 2021 15:19:34 +0200 Subject: [PATCH 8/8] remove deltaR_ --- Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc | 3 +-- Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h | 2 +- Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc | 3 +-- Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc index 3cc0d3c5269c8..2b286619100f9 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc @@ -75,8 +75,7 @@ ElectronMcFakeValidator::ElectronMcFakeValidator(const edm::ParameterSet &conf) maxPt_ = conf.getParameter("MaxPt"); maxAbsEta_ = conf.getParameter("MaxAbsEta"); - deltaR_ = conf.getParameter("DeltaR"); - deltaR2_ = deltaR_ * deltaR_; + deltaR2_ = conf.getParameter("DeltaR") * conf.getParameter("DeltaR"); inputFile_ = conf.getParameter("InputFile"); outputFile_ = conf.getParameter("OutputFile"); inputInternalPath_ = conf.getParameter("InputFolderName"); diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h index bb46dac5ac933..1d946e107e96e 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.h @@ -67,7 +67,7 @@ class ElectronMcFakeValidator : public ElectronDqmAnalyzerBase { double maxPt_; double maxAbsEta_; - double deltaR_, deltaR2_; + double deltaR2_; std::string inputFile_; std::string outputFile_; diff --git a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc index d4d04c744bcd2..2ad72414b2d13 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc @@ -82,8 +82,7 @@ ElectronMcSignalValidator::ElectronMcSignalValidator(const edm::ParameterSet &co maxPt_ = conf.getParameter("MaxPt"); maxAbsEta_ = conf.getParameter("MaxAbsEta"); - deltaR_ = conf.getParameter("DeltaR"); - deltaR2_ = deltaR_ * deltaR_; + deltaR2_ = conf.getParameter("DeltaR") * conf.getParameter("DeltaR"); matchingIDs_ = conf.getParameter >("MatchingID"); matchingMotherIDs_ = conf.getParameter >("MatchingMotherID"); inputFile_ = conf.getParameter("InputFile"); diff --git a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h index 5a42cbc8f779d..7b7433b1992d4 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h +++ b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.h @@ -58,7 +58,7 @@ class ElectronMcSignalValidator : public ElectronDqmAnalyzerBase { double maxPt_; double maxAbsEta_; - double deltaR_, deltaR2_; + double deltaR2_; std::vector matchingIDs_; std::vector matchingMotherIDs_; std::string inputFile_;