CMS 3D CMS Logo

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 
64 private:
65  bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
66 
69  int eid_;
70  // ----------member data ---------------------------
71 };
72 
74  : recoGsfElectronCollectionToken_(
75  consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("src"))),
76  edmValueMapFloatToken_(consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::InputTag>("eidsrc"))),
77  eid_(iConfig.getParameter<int>("eid")) {
78  produces<reco::GsfElectronCollection>();
79 }
80 
81 // ------------ method called to produce the data ------------
82 
84  //cout << "NonVertexingLeptonFilter:: entering filter" << endl;
85 
88 
90  iEvent.getByToken(edmValueMapFloatToken_, eIDValueMap);
91  const edm::ValueMap<float>& eIDmap = *eIDValueMap;
93 
94  // Loop over electrons
95  for (unsigned int i = 0; i < electrons->size(); i++) {
97  if ((eIDmap[electronRef]) == eid_)
98  product->push_back((*electrons)[i]);
99  }
100 
101  //cout << "Putting in the event" << endl;
102  std::unique_ptr<reco::GsfElectronCollection> collection(product);
104  return true;
105 }
106 
edm::EDGetTokenT< edm::ValueMap< float > > edmValueMapFloatToken_
Definition: Selectors.cc:68
SingleObjectSelector< reco::MuonCollection, StringCutObjectSelector< reco::Muon > > TauValMuonSelector
Definition: Selectors.cc:42
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:73
SingleObjectSelector< reco::GenParticleCollection, StringCutObjectSelector< reco::GenParticle > > TauValGenPSelector
Definition: Selectors.cc:44
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SingleObjectSelector< std::vector< reco::Jet >, StringCutObjectSelector< reco::Jet > > TauValJetSelector
Definition: Selectors.cc:41
SingleObjectSelector< reco::GenParticleRefVector, StringCutObjectSelector< reco::GenParticleRef > > TauValGenPRefSelector
Definition: Selectors.cc:46
fixed size matrix
HLT enums.
SingleObjectSelector< edm::View< reco::GsfElectron >, StringCutObjectSelector< reco::GsfElectron >, reco::GsfElectronCollection > TauValElectronSelector
Definition: Selectors.cc:51
bool filter(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: Selectors.cc:83
edm::EDGetTokenT< reco::GsfElectronCollection > recoGsfElectronCollectionToken_
Definition: Selectors.cc:67
def move(src, dest)
Definition: eostools.py:511