58 dropSuperClusters_(iConfig.getParameter<
std::
string>(
"dropSuperCluster")),
59 dropBasicClusters_(iConfig.getParameter<
std::
string>(
"dropBasicClusters")),
60 dropPFlowClusters_(iConfig.getParameter<
std::
string>(
"dropPFlowClusters")),
61 dropPreshowerClusters_(iConfig.getParameter<
std::
string>(
"dropPreshowerClusters")),
62 dropSeedCluster_(iConfig.getParameter<
std::
string>(
"dropSeedCluster")),
63 dropRecHits_(iConfig.getParameter<
std::
string>(
"dropRecHits")),
64 dropCorrections_(iConfig.getParameter<
std::
string>(
"dropCorrections")),
65 dropIsolations_(iConfig.getParameter<
std::
string>(
"dropIsolations")),
66 dropShapes_(iConfig.getParameter<
std::
string>(
"dropShapes")),
67 dropSaturation_(iConfig.getParameter<
std::
string>(
"dropSaturation")),
68 dropExtrapolations_(iConfig.getParameter<
std::
string>(
"dropExtrapolations")),
69 dropClassifications_(iConfig.getParameter<
std::
string>(
"dropClassifications")),
71 iConfig.getParameter<
edm::
InputTag>(
"recoToPFMap"))),
73 iConfig.getParameter<
edm::
InputTag>(
"packedPFCandidates"))),
75 linkToPackedPF_(iConfig.getParameter<
bool>(
"linkToPackedPFCandidates")),
76 saveNonZSClusterShapes_(iConfig.getParameter<
std::
string>(
"saveNonZSClusterShapes")),
77 reducedBarrelRecHitCollectionToken_(
78 consumes(iConfig.getParameter<
edm::
InputTag>(
"reducedBarrelRecHitCollection"))),
79 reducedEndcapRecHitCollectionToken_(
80 consumes(iConfig.getParameter<
edm::
InputTag>(
"reducedEndcapRecHitCollection"))),
81 ecalClusterToolsESGetTokens_{consumesCollector()},
82 modifyElectron_(iConfig.getParameter<
bool>(
"modifyElectrons")) {
83 if (modifyElectron_) {
85 electronModifier_ = std::make_unique<pat::ObjectModifier<pat::Electron>>(mod_config, consumesCollector());
88 mayConsume<EcalRecHitCollection>(
edm::InputTag(
"reducedEcalRecHitsEB"));
89 mayConsume<EcalRecHitCollection>(
edm::InputTag(
"reducedEcalRecHitsEE"));
91 produces<std::vector<pat::Electron>>();
106 if (linkToPackedPF_) {
107 iEvent.getByToken(reco2pf_, reco2pf);
108 iEvent.getByToken(pf2pc_, pf2pc);
109 iEvent.getByToken(pc_, pc);
112 ecalClusterToolsESGetTokens_.get(iSetup),
113 reducedBarrelRecHitCollectionToken_,
114 reducedEndcapRecHitCollectionToken_);
116 auto out = std::make_unique<std::vector<pat::Electron>>();
117 out->reserve(
src->size());
119 if (modifyElectron_) {
120 electronModifier_->setEvent(
iEvent);
123 electronModifier_->setEventContent(iSetup);
125 std::vector<unsigned int>
keys;
130 if (modifyElectron_) {
131 electronModifier_->modify(
electron);
136 electron.embeddedSuperCluster_ =
false;
142 electron.pflowSuperCluster_.clear();
143 electron.embeddedPflowSuperCluster_ =
false;
146 electron.pflowBasicClusters_.clear();
148 if (dropPreshowerClusters_(
electron)) {
149 electron.preshowerClusters_.clear();
152 electron.pflowPreshowerClusters_.clear();
156 electron.embeddedSeedCluster_ =
false;
176 if (dropExtrapolations_(
electron)) {
179 if (dropClassifications_(
electron)) {
183 if (linkToPackedPF_) {
186 for (
auto const&
pf : (*reco2pf)[
electron.refToOrig_]) {
187 if (pf2pc->contains(
pf.id())) {
191 electron.setAssociatedPackedPFCandidates(
195 if (
keys.size() == 1) {
201 if (saveNonZSClusterShapes_(
electron)) {
202 const auto& vCov = lazyToolsNoZS.localCovariances(*(
electron.superCluster()->seed()));
203 electron.full5x5_setSigmaIetaIphi(vCov[1]);
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
const StringCutObjectSelector< pat::Electron > dropRecHits_
T getParameter(std::string const &) const
const StringCutObjectSelector< pat::Electron > dropIsolations_
const bool linkToPackedPF_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > reco2pf_
const StringCutObjectSelector< pat::Electron > dropSuperClusters_
std::vector< pat::PackedCandidate > PackedCandidateCollection
const StringCutObjectSelector< pat::Electron > dropCorrections_
Slimmer of PAT Electrons.
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) final
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
std::unique_ptr< pat::ObjectModifier< pat::Electron > > electronModifier_
const StringCutObjectSelector< pat::Electron > dropBasicClusters_
PATElectronSlimmer(const edm::ParameterSet &iConfig)
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
const StringCutObjectSelector< pat::Electron > dropPreshowerClusters_
const StringCutObjectSelector< pat::Electron > dropClassifications_
const StringCutObjectSelector< pat::Electron > dropShapes_
const StringCutObjectSelector< pat::Electron > dropExtrapolations_
const StringCutObjectSelector< pat::Electron > saveNonZSClusterShapes_
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) final
#define DEFINE_FWK_MODULE(type)
const StringCutObjectSelector< pat::Electron > dropSeedCluster_
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
~PATElectronSlimmer() override
const StringCutObjectSelector< pat::Electron > dropPFlowClusters_
Analysis-level electron class.
const StringCutObjectSelector< pat::Electron > dropSaturation_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::Ref< l1t::PFCandidateCollection > PFCandidateRef
const edm::EDGetTokenT< edm::View< pat::Electron > > src_
const edm::EDGetTokenT< pat::PackedCandidateCollection > pc_
const bool modifyElectron_
edm::SortedCollection< EcalRecHit > EcalRecHitCollection