CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Selectors.cc
Go to the documentation of this file.
3 
4 // system include files
5 #include <memory>
6 
7 // user include files
10 
13 
15 
17 
22 
25 
28 
31 
34 
37 
38 #include <vector>
39 #include <iostream>
40 
52 
59 
61 public:
62  explicit ElectronIdFilter(const edm::ParameterSet&);
63  ~ElectronIdFilter() override;
64 
65 private:
66  void beginJob() override;
67  bool filter(edm::Event&, const edm::EventSetup&) override;
68  void endJob() override;
69 
72  int eid_;
73  // ----------member data ---------------------------
74 };
75 
77  : recoGsfElectronCollectionToken_(
78  consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("src"))),
79  edmValueMapFloatToken_(consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("eidsrc"))),
80  eid_(iConfig.getParameter<int>("eid")) {
81  produces<reco::GsfElectronCollection>();
82 }
84 // ------------ method called to produce the data ------------
85 
87  //cout << "NonVertexingLeptonFilter:: entering filter" << endl;
88 
91 
93  iEvent.getByToken(edmValueMapFloatToken_, eIDValueMap);
94  const edm::ValueMap<float>& eIDmap = *eIDValueMap;
96 
97  // Loop over electrons
98  for (unsigned int i = 0; i < electrons->size(); i++) {
99  edm::Ref<reco::GsfElectronCollection> electronRef(electrons, i);
100  if ((eIDmap[electronRef]) == eid_)
101  product->push_back((*electrons)[i]);
102  }
103 
104  //cout << "Putting in the event" << endl;
105  std::unique_ptr<reco::GsfElectronCollection> collection(product);
106  iEvent.put(std::move(collection));
107  return true;
108 }
109 
112 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
~ElectronIdFilter() override
Definition: Selectors.cc:83
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< edm::ValueMap< float > > edmValueMapFloatToken_
Definition: Selectors.cc:71
SingleObjectSelector< reco::MuonCollection, StringCutObjectSelector< reco::Muon > > TauValMuonSelector
Definition: Selectors.cc:42
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void beginJob() override
Definition: Selectors.cc:110
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
SingleObjectSelector< reco::PFJetCollection, StringCutObjectSelector< reco::PFJet > > TauValPFJetSelector
Definition: Selectors.cc:47
ElectronIdFilter(const edm::ParameterSet &)
Definition: Selectors.cc:76
SingleObjectSelector< reco::GenParticleCollection, StringCutObjectSelector< reco::GenParticle > > TauValGenPSelector
Definition: Selectors.cc:44
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
void endJob() override
Definition: Selectors.cc:111
SingleObjectSelector< std::vector< reco::Jet >, StringCutObjectSelector< reco::Jet > > TauValJetSelector
Definition: Selectors.cc:41
SingleObjectSelector< reco::GenParticleRefVector, StringCutObjectSelector< reco::GenParticleRef > > TauValGenPRefSelector
Definition: Selectors.cc:46
SingleObjectSelector< edm::View< reco::GsfElectron >, StringCutObjectSelector< reco::GsfElectron >, reco::GsfElectronCollection > TauValElectronSelector
Definition: Selectors.cc:51
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: Selectors.cc:86
edm::EDGetTokenT< reco::GsfElectronCollection > recoGsfElectronCollectionToken_
Definition: Selectors.cc:70