CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::PATElectronSlimmer Class Reference

Slimmer of PAT Electrons. More...

Inheritance diagram for pat::PATElectronSlimmer:
edm::stream::EDProducer<>

Public Member Functions

void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) final
 
 PATElectronSlimmer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) final
 
 ~PATElectronSlimmer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

const StringCutObjectSelector< pat::ElectrondropBasicClusters_
 
const StringCutObjectSelector< pat::ElectrondropClassifications_
 
const StringCutObjectSelector< pat::ElectrondropCorrections_
 
const StringCutObjectSelector< pat::ElectrondropExtrapolations_
 
const StringCutObjectSelector< pat::ElectrondropIsolations_
 
const StringCutObjectSelector< pat::ElectrondropPFlowClusters_
 
const StringCutObjectSelector< pat::ElectrondropPreshowerClusters_
 
const StringCutObjectSelector< pat::ElectrondropRecHits_
 
const StringCutObjectSelector< pat::ElectrondropSaturation_
 
const StringCutObjectSelector< pat::ElectrondropSeedCluster_
 
const StringCutObjectSelector< pat::ElectrondropShapes_
 
const StringCutObjectSelector< pat::ElectrondropSuperClusters_
 
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
 
std::unique_ptr< pat::ObjectModifier< pat::Electron > > electronModifier_
 
const bool linkToPackedPF_
 
const bool modifyElectron_
 
const edm::EDGetTokenT< pat::PackedCandidateCollectionpc_
 
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
 
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > reco2pf_
 
const edm::EDGetTokenT< EcalRecHitCollectionreducedBarrelRecHitCollectionToken_
 
const edm::EDGetTokenT< EcalRecHitCollectionreducedEndcapRecHitCollectionToken_
 
const StringCutObjectSelector< pat::ElectronsaveNonZSClusterShapes_
 
const edm::EDGetTokenT< edm::View< pat::Electron > > src_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Slimmer of PAT Electrons.

Definition at line 26 of file PATElectronSlimmer.cc.

Constructor & Destructor Documentation

◆ PATElectronSlimmer()

pat::PATElectronSlimmer::PATElectronSlimmer ( const edm::ParameterSet iConfig)
explicit

Definition at line 56 of file PATElectronSlimmer.cc.

57  : src_(consumes<edm::View<pat::Electron>>(iConfig.getParameter<edm::InputTag>("src"))),
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")),
70  reco2pf_(mayConsume<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(
71  iConfig.getParameter<edm::InputTag>("recoToPFMap"))),
73  iConfig.getParameter<edm::InputTag>("packedPFCandidates"))),
74  pc_(mayConsume<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("packedPFCandidates"))),
75  linkToPackedPF_(iConfig.getParameter<bool>("linkToPackedPFCandidates")),
76  saveNonZSClusterShapes_(iConfig.getParameter<std::string>("saveNonZSClusterShapes")),
78  consumes(iConfig.getParameter<edm::InputTag>("reducedBarrelRecHitCollection"))),
80  consumes(iConfig.getParameter<edm::InputTag>("reducedEndcapRecHitCollection"))),
81  ecalClusterToolsESGetTokens_{consumesCollector()},
82  modifyElectron_(iConfig.getParameter<bool>("modifyElectrons")) {
83  if (modifyElectron_) {
84  const edm::ParameterSet& mod_config = iConfig.getParameter<edm::ParameterSet>("modifierConfig");
85  electronModifier_ = std::make_unique<pat::ObjectModifier<pat::Electron>>(mod_config, consumesCollector());
86  }
87 
88  mayConsume<EcalRecHitCollection>(edm::InputTag("reducedEcalRecHitsEB"));
89  mayConsume<EcalRecHitCollection>(edm::InputTag("reducedEcalRecHitsEE"));
90 
91  produces<std::vector<pat::Electron>>();
92 }

◆ ~PATElectronSlimmer()

pat::PATElectronSlimmer::~PATElectronSlimmer ( )
inlineoverride

Definition at line 29 of file PATElectronSlimmer.cc.

29 {}

Member Function Documentation

◆ beginLuminosityBlock()

void pat::PATElectronSlimmer::beginLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup iSetup 
)
final

Definition at line 94 of file PATElectronSlimmer.cc.

94 {}

◆ produce()

void pat::PATElectronSlimmer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
final

Definition at line 96 of file PATElectronSlimmer.cc.

96  {
97  using namespace edm;
98  using namespace std;
99 
101  iEvent.getByToken(src_, src);
102 
106  if (linkToPackedPF_) {
107  iEvent.getByToken(reco2pf_, reco2pf);
108  iEvent.getByToken(pf2pc_, pf2pc);
109  iEvent.getByToken(pc_, pc);
110  }
111  noZS::EcalClusterLazyTools lazyToolsNoZS(iEvent,
115 
116  auto out = std::make_unique<std::vector<pat::Electron>>();
117  out->reserve(src->size());
118 
119  if (modifyElectron_) {
120  electronModifier_->setEvent(iEvent);
121  }
122  if (modifyElectron_)
123  electronModifier_->setEventContent(iSetup);
124 
125  std::vector<unsigned int> keys;
126  for (View<pat::Electron>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
127  out->push_back(*it);
128  pat::Electron& electron = out->back();
129 
130  if (modifyElectron_) {
131  electronModifier_->modify(electron);
132  }
133 
135  electron.superCluster_.clear();
136  electron.embeddedSuperCluster_ = false;
137  }
139  electron.basicClusters_.clear();
140  }
142  electron.pflowSuperCluster_.clear();
143  electron.embeddedPflowSuperCluster_ = false;
144  }
146  electron.pflowBasicClusters_.clear();
147  }
149  electron.preshowerClusters_.clear();
150  }
152  electron.pflowPreshowerClusters_.clear();
153  }
154  if (dropSeedCluster_(electron)) {
155  electron.seedCluster_.clear();
156  electron.embeddedSeedCluster_ = false;
157  }
158  if (dropRecHits_(electron)) {
159  electron.recHits_ = EcalRecHitCollection();
160  electron.embeddedRecHits_ = false;
161  }
162  if (dropCorrections_(electron)) {
163  electron.setCorrections(reco::GsfElectron::Corrections());
164  }
165  if (dropIsolations_(electron)) {
168  electron.setPfIsolationVariables(reco::GsfElectron::PflowIsolationVariables());
169  }
170  if (dropShapes_(electron)) {
171  electron.setShowerShape(reco::GsfElectron::ShowerShape());
172  }
173  if (dropSaturation_(electron)) {
174  electron.setSaturationInfo(reco::GsfElectron::SaturationInfo());
175  }
177  electron.setTrackExtrapolations(reco::GsfElectron::TrackExtrapolations());
178  }
180  electron.setClassificationVariables(reco::GsfElectron::ClassificationVariables());
181  electron.setClassification(reco::GsfElectron::Classification());
182  }
183  if (linkToPackedPF_) {
184  //std::cout << " PAT electron in " << src.id() << " comes from " << electron.refToOrig_.id() << ", " << electron.refToOrig_.key() << std::endl;
185  keys.clear();
186  for (auto const& pf : (*reco2pf)[electron.refToOrig_]) {
187  if (pf2pc->contains(pf.id())) {
188  keys.push_back((*pf2pc)[pf].key());
189  }
190  }
191  electron.setAssociatedPackedPFCandidates(
193  //std::cout << "Electron with pt " << electron.pt() << " associated to " << electron.associatedPackedFCandidateIndices_.size() << " PF Candidates\n";
194  //if there's just one PF Cand then it's me, otherwise I have no univoque parent so my ref will be null
195  if (keys.size() == 1) {
196  electron.refToOrig_ = electron.sourceCandidatePtr(0);
197  } else {
198  electron.refToOrig_ = reco::CandidatePtr(pc.id());
199  }
200  }
202  std::vector<float> vCov = lazyToolsNoZS.localCovariances(*(electron.superCluster()->seed()));
203  electron.full5x5_setSigmaIetaIphi(vCov[1]);
204  }
205  }
206 
207  iEvent.put(std::move(out));
208 }

References metsig::electron, edm::HandleBase::id(), iEvent, crabWrapper::key, relativeConstraints::keys, eostools::move(), MillePedeFileConverter_cfg::out, packedPFCandidateRefMixer_cfi::pf, and TrackRefitter_38T_cff::src.

Member Data Documentation

◆ dropBasicClusters_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropBasicClusters_
private

Definition at line 37 of file PATElectronSlimmer.cc.

◆ dropClassifications_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropClassifications_
private

Definition at line 39 of file PATElectronSlimmer.cc.

◆ dropCorrections_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropCorrections_
private

Definition at line 39 of file PATElectronSlimmer.cc.

◆ dropExtrapolations_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropExtrapolations_
private

Definition at line 39 of file PATElectronSlimmer.cc.

◆ dropIsolations_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropIsolations_
private

Definition at line 39 of file PATElectronSlimmer.cc.

◆ dropPFlowClusters_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropPFlowClusters_
private

Definition at line 37 of file PATElectronSlimmer.cc.

◆ dropPreshowerClusters_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropPreshowerClusters_
private

Definition at line 37 of file PATElectronSlimmer.cc.

◆ dropRecHits_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropRecHits_
private

Definition at line 37 of file PATElectronSlimmer.cc.

◆ dropSaturation_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropSaturation_
private

Definition at line 39 of file PATElectronSlimmer.cc.

◆ dropSeedCluster_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropSeedCluster_
private

Definition at line 37 of file PATElectronSlimmer.cc.

◆ dropShapes_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropShapes_
private

Definition at line 39 of file PATElectronSlimmer.cc.

◆ dropSuperClusters_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::dropSuperClusters_
private

Definition at line 37 of file PATElectronSlimmer.cc.

◆ ecalClusterToolsESGetTokens_

const EcalClusterLazyTools::ESGetTokens pat::PATElectronSlimmer::ecalClusterToolsESGetTokens_
private

Definition at line 49 of file PATElectronSlimmer.cc.

◆ electronModifier_

std::unique_ptr<pat::ObjectModifier<pat::Electron> > pat::PATElectronSlimmer::electronModifier_
private

Definition at line 51 of file PATElectronSlimmer.cc.

◆ linkToPackedPF_

const bool pat::PATElectronSlimmer::linkToPackedPF_
private

Definition at line 45 of file PATElectronSlimmer.cc.

◆ modifyElectron_

const bool pat::PATElectronSlimmer::modifyElectron_
private

Definition at line 50 of file PATElectronSlimmer.cc.

◆ pc_

const edm::EDGetTokenT<pat::PackedCandidateCollection> pat::PATElectronSlimmer::pc_
private

Definition at line 44 of file PATElectronSlimmer.cc.

◆ pf2pc_

const edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection> > pat::PATElectronSlimmer::pf2pc_
private

Definition at line 43 of file PATElectronSlimmer.cc.

◆ reco2pf_

const edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef> > > pat::PATElectronSlimmer::reco2pf_
private

Definition at line 42 of file PATElectronSlimmer.cc.

◆ reducedBarrelRecHitCollectionToken_

const edm::EDGetTokenT<EcalRecHitCollection> pat::PATElectronSlimmer::reducedBarrelRecHitCollectionToken_
private

Definition at line 47 of file PATElectronSlimmer.cc.

◆ reducedEndcapRecHitCollectionToken_

const edm::EDGetTokenT<EcalRecHitCollection> pat::PATElectronSlimmer::reducedEndcapRecHitCollectionToken_
private

Definition at line 47 of file PATElectronSlimmer.cc.

◆ saveNonZSClusterShapes_

const StringCutObjectSelector<pat::Electron> pat::PATElectronSlimmer::saveNonZSClusterShapes_
private

Definition at line 46 of file PATElectronSlimmer.cc.

◆ src_

const edm::EDGetTokenT<edm::View<pat::Electron> > pat::PATElectronSlimmer::src_
private

Definition at line 35 of file PATElectronSlimmer.cc.

pat::PATElectronSlimmer::dropPFlowClusters_
const StringCutObjectSelector< pat::Electron > dropPFlowClusters_
Definition: PATElectronSlimmer.cc:37
edm::RefProd< pat::PackedCandidateCollection >
pat::PATElectronSlimmer::reco2pf_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > reco2pf_
Definition: PATElectronSlimmer.cc:42
pat::PATElectronSlimmer::dropCorrections_
const StringCutObjectSelector< pat::Electron > dropCorrections_
Definition: PATElectronSlimmer.cc:39
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::GsfElectron::PflowIsolationVariables
Definition: GsfElectron.h:606
pat::PATElectronSlimmer::dropIsolations_
const StringCutObjectSelector< pat::Electron > dropIsolations_
Definition: PATElectronSlimmer.cc:39
pat::PATElectronSlimmer::saveNonZSClusterShapes_
const StringCutObjectSelector< pat::Electron > saveNonZSClusterShapes_
Definition: PATElectronSlimmer.cc:46
pat::PATElectronSlimmer::pc_
const edm::EDGetTokenT< pat::PackedCandidateCollection > pc_
Definition: PATElectronSlimmer.cc:44
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
edm::Handle
Definition: AssociativeIterator.h:50
pat::PATElectronSlimmer::modifyElectron_
const bool modifyElectron_
Definition: PATElectronSlimmer.cc:50
reco::GsfElectron::Classification
Classification
Definition: GsfElectron.h:724
pat::PATElectronSlimmer::dropPreshowerClusters_
const StringCutObjectSelector< pat::Electron > dropPreshowerClusters_
Definition: PATElectronSlimmer.cc:37
pat::PATElectronSlimmer::linkToPackedPF_
const bool linkToPackedPF_
Definition: PATElectronSlimmer.cc:45
pat::PATElectronSlimmer::src_
const edm::EDGetTokenT< edm::View< pat::Electron > > src_
Definition: PATElectronSlimmer.cc:35
reco::GsfElectron::ShowerShape
Definition: GsfElectron.h:366
metsig::electron
Definition: SignAlgoResolutions.h:48
reco::GsfElectron::IsolationVariables
Definition: GsfElectron.h:510
pat::PATElectronSlimmer::dropSuperClusters_
const StringCutObjectSelector< pat::Electron > dropSuperClusters_
Definition: PATElectronSlimmer.cc:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalRecHitCollection
edm::SortedCollection< EcalRecHit > EcalRecHitCollection
Definition: EcalRecHitCollections.h:10
edm::View
Definition: CaloClusterFwd.h:14
EcalClusterLazyToolsT
Definition: EcalClusterLazyTools.h:135
pat::PATElectronSlimmer::reducedEndcapRecHitCollectionToken_
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
Definition: PATElectronSlimmer.cc:47
edm::ParameterSet
Definition: ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
reco::GsfElectron::TrackExtrapolations
Definition: GsfElectron.h:260
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::PATElectronSlimmer::dropSaturation_
const StringCutObjectSelector< pat::Electron > dropSaturation_
Definition: PATElectronSlimmer.cc:39
pat::PATElectronSlimmer::reducedBarrelRecHitCollectionToken_
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
Definition: PATElectronSlimmer.cc:47
edm::Association
Definition: Association.h:18
reco::GsfElectron::ClassificationVariables
Definition: GsfElectron.h:718
pat::PATElectronSlimmer::electronModifier_
std::unique_ptr< pat::ObjectModifier< pat::Electron > > electronModifier_
Definition: PATElectronSlimmer.cc:51
EcalClusterLazyToolsBase::ESGetTokens::get
ESData get(edm::EventSetup const &eventSetup) const
Definition: EcalClusterLazyTools.h:62
pat::PATElectronSlimmer::dropRecHits_
const StringCutObjectSelector< pat::Electron > dropRecHits_
Definition: PATElectronSlimmer.cc:37
pat::PATElectronSlimmer::dropBasicClusters_
const StringCutObjectSelector< pat::Electron > dropBasicClusters_
Definition: PATElectronSlimmer.cc:37
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
pat::PATElectronSlimmer::dropShapes_
const StringCutObjectSelector< pat::Electron > dropShapes_
Definition: PATElectronSlimmer.cc:39
pat::PATElectronSlimmer::dropExtrapolations_
const StringCutObjectSelector< pat::Electron > dropExtrapolations_
Definition: PATElectronSlimmer.cc:39
edm::ValueMap
Definition: ValueMap.h:107
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
reco::CandidatePtr
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
pat::Electron
Analysis-level electron class.
Definition: Electron.h:51
pat::PATElectronSlimmer::ecalClusterToolsESGetTokens_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
Definition: PATElectronSlimmer.cc:49
reco::GsfElectron::SaturationInfo
Definition: GsfElectron.h:490
crabWrapper.key
key
Definition: crabWrapper.py:19
edm::HandleBase::id
ProductID id() const
Definition: HandleBase.cc:29
pat::PATElectronSlimmer::dropSeedCluster_
const StringCutObjectSelector< pat::Electron > dropSeedCluster_
Definition: PATElectronSlimmer.cc:37
edm::InputTag
Definition: InputTag.h:15
pat::PATElectronSlimmer::dropClassifications_
const StringCutObjectSelector< pat::Electron > dropClassifications_
Definition: PATElectronSlimmer.cc:39
reco::GsfElectron::Corrections
Definition: GsfElectron.h:771
pat::PATElectronSlimmer::pf2pc_
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
Definition: PATElectronSlimmer.cc:43