diff --git a/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc index b6e86b50afe00..ff2d52516d782 100644 --- a/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc @@ -131,10 +131,7 @@ pat::PATElectronSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iS if (dropRecHits_(electron)) { electron.recHits_ = EcalRecHitCollection(); electron.embeddedRecHits_ = false; } if (dropCorrections_(electron)) { electron.setCorrections(reco::GsfElectron::Corrections()); } if (dropIsolations_(electron)) { electron.setDr03Isolation(reco::GsfElectron::IsolationVariables()); electron.setDr04Isolation(reco::GsfElectron::IsolationVariables()); electron.setPfIsolationVariables(reco::GsfElectron::PflowIsolationVariables()); electron.setEcalPFClusterIso(0); electron.setHcalPFClusterIso(0); } - if (dropShapes_(electron)) { - electron.setShowerShape(reco::GsfElectron::ShowerShape()); - electron.setExtraShowerShapes(reco::GsfElectron::ExtraShowerShapes()); - } + if (dropShapes_(electron)) { electron.setShowerShape(reco::GsfElectron::ShowerShape()); } if (dropExtrapolations_(electron)) { electron.setTrackExtrapolations(reco::GsfElectron::TrackExtrapolations()); } if (dropClassifications_(electron)) { electron.setClassificationVariables(reco::GsfElectron::ClassificationVariables()); electron.setClassification(reco::GsfElectron::Classification()); } if (linkToPackedPF_) { diff --git a/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h b/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h index 875a268fe7deb..e820ca9ee2076 100644 --- a/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h +++ b/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h @@ -250,9 +250,9 @@ class GsfElectronAlgo { void setPflowPreselectionFlag( reco::GsfElectron * ele ) ; bool isPreselected( reco::GsfElectron * ele ) ; void calculateShowerShape( const reco::SuperClusterRef &, bool pflow, - reco::GsfElectron::ShowerShape & , reco::GsfElectron::ExtraShowerShapes & ) ; + reco::GsfElectron::ShowerShape & ) ; void calculateShowerShape_full5x5( const reco::SuperClusterRef &, bool pflow, - reco::GsfElectron::ShowerShape &, reco::GsfElectron::ExtraShowerShapes & ) ; + reco::GsfElectron::ShowerShape & ) ; // associations diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index 841a544950731..1e7e80042ceb8 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -538,7 +538,7 @@ Candidate::LorentzVector GsfElectronAlgo::ElectronData::calculateMomentum() } void GsfElectronAlgo::calculateShowerShape( const reco::SuperClusterRef & theClus, bool pflow, - reco::GsfElectron::ShowerShape & showerShape, reco::GsfElectron::ExtraShowerShapes & exShowerShape ) + reco::GsfElectron::ShowerShape & showerShape ) { const reco::CaloCluster & seedCluster = *(theClus->seed()) ; // temporary, till CaloCluster->seed() is made available @@ -593,23 +593,22 @@ void GsfElectronAlgo::calculateShowerShape( const reco::SuperClusterRef & theClu // extra shower shapes const float see_by_spp = showerShape.sigmaIetaIeta*showerShape.sigmaIphiIphi; if( see_by_spp > 0 ) { - exShowerShape.sigmaIetaIphi = localCovariances[1] / see_by_spp; + showerShape.sigmaIetaIphi = localCovariances[1] / see_by_spp; } else if ( localCovariances[1] > 0 ) { - exShowerShape.sigmaIetaIphi = 1.f; + showerShape.sigmaIetaIphi = 1.f; } else { - exShowerShape.sigmaIetaIphi = -1.f; + showerShape.sigmaIetaIphi = -1.f; } - exShowerShape.eMax = EcalClusterTools::eMax(seedCluster,recHits); - exShowerShape.e2nd = EcalClusterTools::e2nd(seedCluster,recHits); - exShowerShape.eTop = EcalClusterTools::eTop(seedCluster,recHits,topology); - exShowerShape.eLeft = EcalClusterTools::eLeft(seedCluster,recHits,topology); - exShowerShape.eRight = EcalClusterTools::eRight(seedCluster,recHits,topology); - exShowerShape.eBottom = EcalClusterTools::eBottom(seedCluster,recHits,topology); - + showerShape.eMax = EcalClusterTools::eMax(seedCluster,recHits); + showerShape.e2nd = EcalClusterTools::e2nd(seedCluster,recHits); + showerShape.eTop = EcalClusterTools::eTop(seedCluster,recHits,topology); + showerShape.eLeft = EcalClusterTools::eLeft(seedCluster,recHits,topology); + showerShape.eRight = EcalClusterTools::eRight(seedCluster,recHits,topology); + showerShape.eBottom = EcalClusterTools::eBottom(seedCluster,recHits,topology); } void GsfElectronAlgo::calculateShowerShape_full5x5( const reco::SuperClusterRef & theClus, bool pflow, - reco::GsfElectron::ShowerShape & showerShape, reco::GsfElectron::ExtraShowerShapes & exShowerShape ) + reco::GsfElectron::ShowerShape & showerShape ) { const reco::CaloCluster & seedCluster = *(theClus->seed()) ; // temporary, till CaloCluster->seed() is made available @@ -664,19 +663,18 @@ void GsfElectronAlgo::calculateShowerShape_full5x5( const reco::SuperClusterRef // extra shower shapes const float see_by_spp = showerShape.sigmaIetaIeta*showerShape.sigmaIphiIphi; if( see_by_spp > 0 ) { - exShowerShape.sigmaIetaIphi = localCovariances[1] / see_by_spp; + showerShape.sigmaIetaIphi = localCovariances[1] / see_by_spp; } else if ( localCovariances[1] > 0 ) { - exShowerShape.sigmaIetaIphi = 1.f; + showerShape.sigmaIetaIphi = 1.f; } else { - exShowerShape.sigmaIetaIphi = -1.f; + showerShape.sigmaIetaIphi = -1.f; } - exShowerShape.eMax = noZS::EcalClusterTools::eMax(seedCluster,recHits); - exShowerShape.e2nd = noZS::EcalClusterTools::e2nd(seedCluster,recHits); - exShowerShape.eTop = noZS::EcalClusterTools::eTop(seedCluster,recHits,topology); - exShowerShape.eLeft = noZS::EcalClusterTools::eLeft(seedCluster,recHits,topology); - exShowerShape.eRight = noZS::EcalClusterTools::eRight(seedCluster,recHits,topology); - exShowerShape.eBottom = noZS::EcalClusterTools::eBottom(seedCluster,recHits,topology); - + showerShape.eMax = noZS::EcalClusterTools::eMax(seedCluster,recHits); + showerShape.e2nd = noZS::EcalClusterTools::e2nd(seedCluster,recHits); + showerShape.eTop = noZS::EcalClusterTools::eTop(seedCluster,recHits,topology); + showerShape.eLeft = noZS::EcalClusterTools::eLeft(seedCluster,recHits,topology); + showerShape.eRight = noZS::EcalClusterTools::eRight(seedCluster,recHits,topology); + showerShape.eBottom = noZS::EcalClusterTools::eBottom(seedCluster,recHits,topology); } @@ -1362,12 +1360,10 @@ void GsfElectronAlgo::createElectron(const gsfAlgoHelpers::HeavyObjectCache* hoc //==================================================== reco::GsfElectron::ShowerShape showerShape ; - reco::GsfElectron::ExtraShowerShapes exShowerShapes ; - calculateShowerShape(electronData_->superClusterRef,!(electronData_->coreRef->ecalDrivenSeed()),showerShape, exShowerShapes) ; + calculateShowerShape(electronData_->superClusterRef,!(electronData_->coreRef->ecalDrivenSeed()),showerShape) ; reco::GsfElectron::ShowerShape full5x5_showerShape ; - reco::GsfElectron::ExtraShowerShapes full5x5_exShowerShapes ; - calculateShowerShape_full5x5(electronData_->superClusterRef,!(electronData_->coreRef->ecalDrivenSeed()),full5x5_showerShape, full5x5_exShowerShapes) ; + calculateShowerShape_full5x5(electronData_->superClusterRef,!(electronData_->coreRef->ecalDrivenSeed()),full5x5_showerShape) ; //==================================================== // ConversionRejection @@ -1413,11 +1409,7 @@ void GsfElectronAlgo::createElectron(const gsfAlgoHelpers::HeavyObjectCache* hoc // Will be overwritten later in the case of the regression ele->setCorrectedEcalEnergyError(generalData_->superClusterErrorFunction->getValue(*(ele->superCluster()),0)) ; ele->setP4(GsfElectron::P4_FROM_SUPER_CLUSTER,momentum,0,true) ; - - // set the extra shower shapes - ele->setExtraShowerShapes(exShowerShapes); - ele->full5x5_setExtraShowerShapes(full5x5_exShowerShapes); - + //==================================================== // brems fractions //==================================================== diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 74f311ed4c473..01d88fe034e3d 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -566,29 +566,29 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, showerShape.hcalDepth1OverEcalBc = hcalDepth1OverEcalBc; showerShape.hcalDepth2OverEcalBc = hcalDepth2OverEcalBc; showerShape.hcalTowersBehindClusters = TowersBehindClus; - newCandidate.setShowerShapeVariables ( showerShape ); - /// fill extra shower shapes const float spp = (edm::isFinite(locCov[2]) ? 0. : sqrt(locCov[2])); const float sep = locCov[1]; - - reco::Photon::ExtraShowerShapes exShowerShape; - exShowerShape.sigmaIetaIphi = spp; - exShowerShape.sigmaIphiIphi = sep; - exShowerShape.e2nd = EcalClusterTools::e2nd(*(scRef->seed()),&(*hits)); - exShowerShape.eTop = EcalClusterTools::eTop(*(scRef->seed()), &(*hits), &(*topology)); - exShowerShape.eLeft = EcalClusterTools::eLeft(*(scRef->seed()), &(*hits), &(*topology)); - exShowerShape.eRight = EcalClusterTools::eRight(*(scRef->seed()), &(*hits), &(*topology)); - exShowerShape.eBottom = EcalClusterTools::eBottom(*(scRef->seed()), &(*hits), &(*topology)); - exShowerShape.e1x3 = EcalClusterTools::e1x3(*(scRef->seed()), &(*hits), &(*topology)); - exShowerShape.e2x2 = EcalClusterTools::e2x2(*(scRef->seed()), &(*hits), &(*topology)); - exShowerShape.e2x5Max = EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology)); - exShowerShape.e2x5Left = EcalClusterTools::e2x5Left(*(scRef->seed()), &(*hits), &(*topology)); - exShowerShape.e2x5Right = EcalClusterTools::e2x5Right(*(scRef->seed()), &(*hits), &(*topology)); - exShowerShape.e2x5Top = EcalClusterTools::e2x5Top(*(scRef->seed()), &(*hits), &(*topology)); - exShowerShape.e2x5Bottom = EcalClusterTools::e2x5Bottom(*(scRef->seed()), &(*hits), &(*topology)); - newCandidate.setExtraShowerShapes( exShowerShape ); - + showerShape.sigmaIetaIphi = spp; + showerShape.sigmaIphiIphi = sep; + showerShape.e2nd = EcalClusterTools::e2nd(*(scRef->seed()),&(*hits)); + showerShape.eTop = EcalClusterTools::eTop(*(scRef->seed()), &(*hits), &(*topology)); + showerShape.eLeft = EcalClusterTools::eLeft(*(scRef->seed()), &(*hits), &(*topology)); + showerShape.eRight = EcalClusterTools::eRight(*(scRef->seed()), &(*hits), &(*topology)); + showerShape.eBottom = EcalClusterTools::eBottom(*(scRef->seed()), &(*hits), &(*topology)); + showerShape.e1x3 = EcalClusterTools::e1x3(*(scRef->seed()), &(*hits), &(*topology)); + showerShape.e2x2 = EcalClusterTools::e2x2(*(scRef->seed()), &(*hits), &(*topology)); + showerShape.e2x5Max = EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology)); + showerShape.e2x5Left = EcalClusterTools::e2x5Left(*(scRef->seed()), &(*hits), &(*topology)); + showerShape.e2x5Right = EcalClusterTools::e2x5Right(*(scRef->seed()), &(*hits), &(*topology)); + showerShape.e2x5Top = EcalClusterTools::e2x5Top(*(scRef->seed()), &(*hits), &(*topology)); + showerShape.e2x5Bottom = EcalClusterTools::e2x5Bottom(*(scRef->seed()), &(*hits), &(*topology)); + // fill preshower shapes + EcalClusterLazyTools toolsforES(evt, es, barrelEcalHits_, endcapEcalHits_, preshowerHits_); + const float sigmaRR = toolsforES.eseffsirir( *scRef ); + showerShape.effSigmaRR = sigmaRR; + newCandidate.setShowerShapeVariables ( showerShape ); + /// fill full5x5 shower shape block reco::Photon::ShowerShape full5x5_showerShape; full5x5_showerShape.e1x5= full5x5_e1x5; @@ -598,34 +598,28 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, full5x5_showerShape.maxEnergyXtal = full5x5_maxXtal; full5x5_showerShape.sigmaEtaEta = full5x5_sigmaEtaEta; full5x5_showerShape.sigmaIetaIeta = full5x5_sigmaIetaIeta; - newCandidate.full5x5_setShowerShapeVariables ( full5x5_showerShape ); - /// fill extra full5x5 shower shapes const float full5x5_spp = (edm::isFinite(full5x5_locCov[2]) ? 0. : sqrt(full5x5_locCov[2])); const float full5x5_sep = full5x5_locCov[1]; - reco::Photon::ExtraShowerShapes full5x5_exShowerShape; - full5x5_exShowerShape.sigmaIetaIphi = full5x5_spp; - full5x5_exShowerShape.sigmaIphiIphi = full5x5_sep; - full5x5_exShowerShape.e2nd = noZS::EcalClusterTools::e2nd(*(scRef->seed()),&(*hits)); - full5x5_exShowerShape.eTop = noZS::EcalClusterTools::eTop(*(scRef->seed()), &(*hits), &(*topology)); - full5x5_exShowerShape.eLeft = noZS::EcalClusterTools::eLeft(*(scRef->seed()), &(*hits), &(*topology)); - full5x5_exShowerShape.eRight = noZS::EcalClusterTools::eRight(*(scRef->seed()), &(*hits), &(*topology)); - full5x5_exShowerShape.eBottom = noZS::EcalClusterTools::eBottom(*(scRef->seed()), &(*hits), &(*topology)); - full5x5_exShowerShape.e1x3 = noZS::EcalClusterTools::e1x3(*(scRef->seed()), &(*hits), &(*topology)); - full5x5_exShowerShape.e2x2 = noZS::EcalClusterTools::e2x2(*(scRef->seed()), &(*hits), &(*topology)); - full5x5_exShowerShape.e2x5Max = noZS::EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology)); - full5x5_exShowerShape.e2x5Left = noZS::EcalClusterTools::e2x5Left(*(scRef->seed()), &(*hits), &(*topology)); - full5x5_exShowerShape.e2x5Right = noZS::EcalClusterTools::e2x5Right(*(scRef->seed()), &(*hits), &(*topology)); - full5x5_exShowerShape.e2x5Top = noZS::EcalClusterTools::e2x5Top(*(scRef->seed()), &(*hits), &(*topology)); - full5x5_exShowerShape.e2x5Bottom = noZS::EcalClusterTools::e2x5Bottom(*(scRef->seed()), &(*hits), &(*topology)); - newCandidate.full5x5_setExtraShowerShapes(full5x5_exShowerShape); - - // fill preshower shapes - EcalClusterLazyTools toolsforES(evt, es, barrelEcalHits_, endcapEcalHits_, preshowerHits_); - reco::Photon::PreshowerShapes esShowerShape; - esShowerShape.effSigmaRR = toolsforES.eseffsirir( *scRef ); - - newCandidate.setPreshowerShapes(esShowerShape); + full5x5_showerShape.sigmaIetaIphi = full5x5_spp; + full5x5_showerShape.sigmaIphiIphi = full5x5_sep; + full5x5_showerShape.e2nd = noZS::EcalClusterTools::e2nd(*(scRef->seed()),&(*hits)); + full5x5_showerShape.eTop = noZS::EcalClusterTools::eTop(*(scRef->seed()), &(*hits), &(*topology)); + full5x5_showerShape.eLeft = noZS::EcalClusterTools::eLeft(*(scRef->seed()), &(*hits), &(*topology)); + full5x5_showerShape.eRight = noZS::EcalClusterTools::eRight(*(scRef->seed()), &(*hits), &(*topology)); + full5x5_showerShape.eBottom = noZS::EcalClusterTools::eBottom(*(scRef->seed()), &(*hits), &(*topology)); + full5x5_showerShape.e1x3 = noZS::EcalClusterTools::e1x3(*(scRef->seed()), &(*hits), &(*topology)); + full5x5_showerShape.e2x2 = noZS::EcalClusterTools::e2x2(*(scRef->seed()), &(*hits), &(*topology)); + full5x5_showerShape.e2x5Max = noZS::EcalClusterTools::e2x5Max(*(scRef->seed()), &(*hits), &(*topology)); + full5x5_showerShape.e2x5Left = noZS::EcalClusterTools::e2x5Left(*(scRef->seed()), &(*hits), &(*topology)); + full5x5_showerShape.e2x5Right = noZS::EcalClusterTools::e2x5Right(*(scRef->seed()), &(*hits), &(*topology)); + full5x5_showerShape.e2x5Top = noZS::EcalClusterTools::e2x5Top(*(scRef->seed()), &(*hits), &(*topology)); + full5x5_showerShape.e2x5Bottom = noZS::EcalClusterTools::e2x5Bottom(*(scRef->seed()), &(*hits), &(*topology)); + // fill preshower shapes + full5x5_showerShape.effSigmaRR = sigmaRR; + newCandidate.full5x5_setShowerShapeVariables ( full5x5_showerShape ); + + /// get ecal photon specific corrected energy /// plus values from regressions and store them in the Photon diff --git a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc index f8699b7937e92..77c0a11394a30 100644 --- a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc +++ b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc @@ -393,7 +393,7 @@ void EGExtraInfoModifierFromDB::modifyObject(reco::GsfElectron& ele) const { std::array eval; const double raw_energy = the_sc->rawEnergy(); - const auto& ess = ele.extraShowerShapes(); + const auto& ess = ele.showerShape(); // SET INPUTS eval[0] = nVtx_; @@ -402,15 +402,15 @@ void EGExtraInfoModifierFromDB::modifyObject(reco::GsfElectron& ele) const { eval[3] = the_sc->phi(); eval[4] = the_sc->etaWidth(); eval[5] = the_sc->phiWidth(); - eval[6] = ele.r9(); + eval[6] = ess.r9; eval[7] = theseed->energy()/raw_energy; eval[8] = ess.eMax/raw_energy; eval[9] = ess.e2nd/raw_energy; eval[10] = (ess.eLeft + ess.eRight != 0.f ? (ess.eLeft-ess.eRight)/(ess.eLeft+ess.eRight) : 0.f); eval[11] = (ess.eTop + ess.eBottom != 0.f ? (ess.eTop-ess.eBottom)/(ess.eTop+ess.eBottom) : 0.f); - eval[12] = ele.sigmaIetaIeta(); + eval[12] = ess.sigmaIetaIeta; eval[13] = ess.sigmaIetaIphi; - eval[14] = ele.sigmaIphiIphi(); + eval[14] = ess.sigmaIphiIphi; eval[15] = std::max(0,numberOfClusters-1); // calculate sub-cluster variables @@ -590,7 +590,7 @@ void EGExtraInfoModifierFromDB::modifyObject(reco::Photon& pho) const { if( missing_clusters ) return ; // do not apply corrections in case of missing info (slimmed MiniAOD electrons) const double raw_energy = the_sc->rawEnergy(); - const auto& ess = pho.extraShowerShapes(); + const auto& ess = pho.showerShapeVariables(); // SET INPUTS eval[0] = raw_energy; @@ -606,21 +606,21 @@ void EGExtraInfoModifierFromDB::modifyObject(reco::Photon& pho) const { eval[8] = theseed->eta()-the_sc->position().Eta(); eval[9] = reco::deltaPhi(theseed->phi(),the_sc->position().Phi()); eval[10] = theseed->energy()/raw_energy; - eval[11] = pho.e3x3()/pho.e5x5(); - eval[12] = pho.sigmaIetaIeta(); + eval[11] = ess.e3x3/ess.e5x5; + eval[12] = ess.sigmaIetaIeta; eval[13] = ess.sigmaIphiIphi; eval[14] = ess.sigmaIetaIphi; - eval[15] = pho.maxEnergyXtal()/pho.e5x5(); - eval[16] = ess.e2nd/pho.e5x5(); - eval[17] = ess.eTop/pho.e5x5(); - eval[18] = ess.eBottom/pho.e5x5(); - eval[19] = ess.eLeft/pho.e5x5(); - eval[20] = ess.eRight/pho.e5x5(); - eval[21] = ess.e2x5Max/pho.e5x5(); - eval[22] = ess.e2x5Left/pho.e5x5(); - eval[23] = ess.e2x5Right/pho.e5x5(); - eval[24] = ess.e2x5Top/pho.e5x5(); - eval[25] = ess.e2x5Bottom/pho.e5x5(); + eval[15] = ess.maxEnergyXtal/ess.e5x5; + eval[16] = ess.e2nd/ess.e5x5; + eval[17] = ess.eTop/ess.e5x5; + eval[18] = ess.eBottom/ess.e5x5; + eval[19] = ess.eLeft/ess.e5x5; + eval[20] = ess.eRight/ess.e5x5; + eval[21] = ess.e2x5Max/ess.e5x5; + eval[22] = ess.e2x5Left/ess.e5x5; + eval[23] = ess.e2x5Right/ess.e5x5; + eval[24] = ess.e2x5Top/ess.e5x5; + eval[25] = ess.e2x5Bottom/ess.e5x5; const bool iseb = pho.isEB(); if (iseb) {