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>
9 
12 
13 template<class algo>
15  public:
16  explicit ElectronIDSelector(const edm::ParameterSet& iConfig) :
17  select_(iConfig),
18  threshold_(iConfig.getParameter<double>("threshold"))
19  {
20  }
21 
22  virtual ~ElectronIDSelector() {};
23 
24  // Collections to be selected
26  typedef std::vector<reco::GsfElectronRef> container ;
27  //typedef std::vector<reco::GsfElectron> container ;
28  typedef container::const_iterator const_iterator;
29 
30  //define iterators with above typedef
31  const_iterator begin () const { return selected_.begin () ; }
32  const_iterator end () const { return selected_.end () ; }
33 
35  const edm::Event& iEvent ,
36  const edm::EventSetup& iEs)
37  {
39  selected_.clear();
40  select_.newEvent(iEvent, iEs);
41  // Loop over electrons
42  unsigned int i = 0 ;
43  for ( reco::GsfElectronCollection::const_iterator eleIt = electrons->begin () ;
44  eleIt != electrons->end () ;
45  ++eleIt )
46  {
47  edm::Ref<reco::GsfElectronCollection> electronRef(electrons,i);
48  if (select_((*eleIt),iEvent,iEs) > threshold_)
49  selected_.push_back (electronRef) ;
50  //selected_.push_back ( & * eleIt) ;
51  ++i;
52  }
53  }
54 
55  private:
57  algo select_ ;
58  double threshold_ ;
59 
60 };
61 
62 #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
reco::GsfElectronCollection collection
ElectronIDSelector(const edm::ParameterSet &iConfig)
const_iterator begin() const