CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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),
19  threshold_(iConfig.getParameter<double>("threshold"))
20  {
21  }
22 
23  virtual ~ElectronIDSelector() {};
24 
25  // Collections to be selected
27  typedef std::vector<reco::GsfElectronRef> container ;
28  //typedef std::vector<reco::GsfElectron> container ;
29  typedef container::const_iterator const_iterator;
30 
31  //define iterators with above typedef
32  const_iterator begin () const { return selected_.begin () ; }
33  const_iterator end () const { return selected_.end () ; }
34 
36  const edm::Event& iEvent ,
37  const edm::EventSetup& iEs)
38  {
40  selected_.clear();
41  select_.newEvent(iEvent, iEs);
42  // Loop over electrons
43  unsigned int i = 0 ;
44  for ( reco::GsfElectronCollection::const_iterator eleIt = electrons->begin () ;
45  eleIt != electrons->end () ;
46  ++eleIt )
47  {
48  edm::Ref<reco::GsfElectronCollection> electronRef(electrons,i);
49  if (select_((*eleIt),iEvent,iEs) > threshold_)
50  selected_.push_back (electronRef) ;
51  //selected_.push_back ( & * eleIt) ;
52  ++i;
53  }
54  }
55 
56  private:
58  algo select_ ;
59  double threshold_ ;
60 
61 };
62 
63 #endif
int i
Definition: DBlmapReader.cc:9
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:243
ElectronIDSelector(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
reco::GsfElectronCollection collection
const_iterator begin() const