CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
16 
18 
23 
26 
29 
32 
35 
38 
39 #include <vector>
40 #include <iostream>
41 
48 
55 
57 public:
58  explicit ElectronIdFilter(const edm::ParameterSet&);
60 
61 private:
62  virtual void beginJob() ;
63  virtual bool filter(edm::Event&, const edm::EventSetup&);
64  virtual void endJob() ;
65 
67  int eid_;
68  // ----------member data ---------------------------
69 };
70 
72  src_(iConfig.getParameter<edm::InputTag>("src")),
73  eidsrc_(iConfig.getParameter<edm::InputTag>("eidsrc")),
74  eid_(iConfig.getParameter<int>("eid"))
75 {
76  produces< reco::GsfElectronCollection >();
77 }
79 {
80 }
81 // ------------ method called to produce the data ------------
82 
83 bool
85 {
86  //cout << "NonVertexingLeptonFilter:: entering filter" << endl;
87  using namespace reco;
88  using namespace std;
89 
91  iEvent.getByLabel(src_,electrons);
92 
94  iEvent.getByLabel(eidsrc_, eIDValueMap);
95  const edm::ValueMap<float> & eIDmap = * eIDValueMap;
97 
98  // Loop over electrons
99  for (unsigned int i = 0; i < electrons->size(); i++){
101  if((eIDmap[electronRef]) == eid_)
102  product->push_back((*electrons)[i]);
103  }
104 
105  //cout << "Putting in the event" << endl;
106  std::auto_ptr<GsfElectronCollection> collection(product);
107  iEvent.put(collection);
108  return true;
109 }
110 
111 void
113 }
114 void
116 }
117 
int i
Definition: DBlmapReader.cc:9
edm::InputTag eidsrc_
Definition: Selectors.cc:66
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
SingleObjectSelector< reco::GenParticleCollection, StringCutObjectSelector< reco::GenParticle > > TauValGenPSelector
Definition: Selectors.cc:44
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
virtual bool filter(edm::Event &, const edm::EventSetup &)
Definition: Selectors.cc:84
SingleObjectSelector< edm::View< reco::GsfElectron >, StringCutObjectSelector< reco::GsfElectron >, reco::GsfElectronCollection > TauValElectronSelector
Definition: Selectors.cc:47
edm::InputTag src_
Definition: Selectors.cc:66
ElectronIdFilter(const edm::ParameterSet &)
Definition: Selectors.cc:71
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
SingleObjectSelector< reco::GenParticleRefVector, StringCutObjectSelector< reco::GenParticleRef > > TauValGenPRefSelector
Definition: Selectors.cc:45
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
SingleObjectSelector< std::vector< reco::Jet >, StringCutObjectSelector< reco::Jet > > TauValJetSelector
Definition: Selectors.cc:42
SingleObjectSelector< reco::MuonCollection, StringCutObjectSelector< reco::Muon > > TauValMuonSelector
Definition: Selectors.cc:43
virtual void endJob()
Definition: Selectors.cc:115
virtual void beginJob()
Definition: Selectors.cc:112
SingleObjectSelector< reco::PFJetCollection, StringCutObjectSelector< reco::PFJet > > TauValPFJetSelector
Definition: Selectors.cc:46