RecoEgamma
ElectronIdentification
plugins
ElectronIDSelector.h
Go to the documentation of this file.
1
#ifndef ELECTRONIDSELECTOR
2
#define ELECTRONIDSELECTOR
3
4
#include <memory>
5
#include "
FWCore/Framework/interface/Event.h
"
6
#include "
FWCore/Framework/interface/EventSetup.h
"
7
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
8
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
9
#include "
FWCore/Utilities/interface/InputTag.h
"
10
11
#include "
DataFormats/EgammaCandidates/interface/GsfElectron.h
"
12
#include "
DataFormats/EgammaCandidates/interface/GsfElectronFwd.h
"
13
14
template
<
class
algo>
15
struct
ElectronIDSelector
{
16
public
:
17
explicit
ElectronIDSelector
(
const
edm::ParameterSet
& iConfig,
edm::ConsumesCollector
&& iC)
18
:
select_
(iConfig, iC),
threshold_
(iConfig.getParameter<double>(
"threshold"
)) {}
19
20
virtual
~ElectronIDSelector
(){};
21
22
// Collections to be selected
23
typedef
reco::GsfElectronCollection
collection
;
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
32
void
select
(
const
edm::Handle<reco::GsfElectronCollection>
& _electrons,
33
const
edm::Event
&
iEvent
,
34
const
edm::EventSetup
& iEs) {
35
const
edm::Handle<reco::GsfElectronCollection>
&
electrons
= _electrons;
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_
;
51
algo
select_
;
52
double
threshold_
;
53
};
54
55
#endif
mps_fire.i
i
Definition:
mps_fire.py:428
ElectronIDSelector::end
const_iterator end() const
Definition:
ElectronIDSelector.h:30
ElectronIDSelector::selected_
container selected_
Definition:
ElectronIDSelector.h:50
ElectronIDSelector::~ElectronIDSelector
virtual ~ElectronIDSelector()
Definition:
ElectronIDSelector.h:20
ElectronIDSelector
Definition:
ElectronIDSelector.h:15
reco::GsfElectronCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
Definition:
GsfElectronFwd.h:14
edm::Handle< reco::GsfElectronCollection >
edm::Ref
Definition:
AssociativeIterator.h:58
cmsdt::algo
algo
Definition:
constants.h:165
ElectronIDSelector::threshold_
double threshold_
Definition:
ElectronIDSelector.h:52
ElectronIDSelector::select
void select(const edm::Handle< reco::GsfElectronCollection > &_electrons, const edm::Event &iEvent, const edm::EventSetup &iEs)
Definition:
ElectronIDSelector.h:32
GsfElectron.h
ElectronIDSelector::begin
const_iterator begin() const
Definition:
ElectronIDSelector.h:29
GsfElectronFwd.h
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
ElectronIDSelector::ElectronIDSelector
ElectronIDSelector(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
Definition:
ElectronIDSelector.h:17
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:58
InputTag.h
ElectronIDSelector::select_
algo select_
Definition:
ElectronIDSelector.h:51
ElectronIDSelector::const_iterator
container::const_iterator const_iterator
Definition:
ElectronIDSelector.h:26
pwdgSkimBPark_cfi.electrons
electrons
Definition:
pwdgSkimBPark_cfi.py:6
EventSetup.h
ElectronIDSelector::container
std::vector< reco::GsfElectronRef > container
Definition:
ElectronIDSelector.h:24
ConsumesCollector.h
ParameterSet.h
ElectronIDSelector::collection
reco::GsfElectronCollection collection
Definition:
ElectronIDSelector.h:20
edm::Event
Definition:
Event.h:73
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
Generated for CMSSW Reference Manual by
1.8.16