CMS 3D CMS Logo

ElectronIDSelector.h
Go to the documentation of this file.
1 #ifndef ELECTRONIDSELECTOR
2 #define ELECTRONIDSELECTOR
3 
4 #include <memory>
10 
13 
14 template <class algo>
16 public:
18  : select_(iConfig, iC), threshold_(iConfig.getParameter<double>("threshold")) {}
19 
20  virtual ~ElectronIDSelector(){};
21 
22  // Collections to be selected
24  typedef std::vector<reco::GsfElectronRef> container;
25  //typedef std::vector<reco::GsfElectron> container ;
26  typedef container::const_iterator const_iterator;
27 
28  //define iterators with above typedef
29  const_iterator begin() const { return selected_.begin(); }
30  const_iterator end() const { return selected_.end(); }
31 
33  const edm::Event& iEvent,
34  const edm::EventSetup& iEs) {
36  selected_.clear();
37  select_.newEvent(iEvent, iEs);
38  // Loop over electrons
39  unsigned int i = 0;
40  for (reco::GsfElectronCollection::const_iterator eleIt = electrons->begin(); eleIt != electrons->end(); ++eleIt) {
41  edm::Ref<reco::GsfElectronCollection> electronRef(electrons, i);
42  if (select_((*eleIt), iEvent, iEs) > threshold_)
43  selected_.push_back(electronRef);
44  //selected_.push_back ( & * eleIt) ;
45  ++i;
46  }
47  }
48 
49 private:
50  container selected_;
52  double threshold_;
53 };
54 
55 #endif
void select(const edm::Handle< reco::GsfElectronCollection > &_electrons, const edm::Event &iEvent, const edm::EventSetup &iEs)
const_iterator end() const
std::vector< reco::GsfElectronRef > container
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
container::const_iterator const_iterator
int iEvent
Definition: GenABIO.cc:224
ElectronIDSelector(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
reco::GsfElectronCollection collection
const_iterator begin() const