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  {
38  selected_.clear();
39  select_.newEvent(iEvent, iEs);
40  // Loop over electrons
41  unsigned int i = 0 ;
42  for ( reco::GsfElectronCollection::const_iterator eleIt = electrons->begin () ;
43  eleIt != electrons->end () ;
44  ++eleIt )
45  {
46  edm::Ref<reco::GsfElectronCollection> electronRef(electrons,i);
47  if (select_((*eleIt),iEvent,iEs) > threshold_)
48  selected_.push_back (electronRef) ;
49  //selected_.push_back ( & * eleIt) ;
50  ++i;
51  }
52  }
53 
54  private:
57  double threshold_ ;
58 
59 };
60 
61 #endif
int i
Definition: DBlmapReader.cc:9
void select(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)
LimitAlgo * algo
Definition: Combine.cc:60
const_iterator begin() const