RecoEgamma
Examples
plugins
ElectronIDAnalyzer.cc
Go to the documentation of this file.
1
#include "
DataFormats/Common/interface/Handle.h
"
2
#include "
DataFormats/Common/interface/ValueMap.h
"
3
#include "
DataFormats/EgammaCandidates/interface/GsfElectron.h
"
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/Framework/interface/EventSetup.h
"
6
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
7
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
8
9
class
ElectronIDAnalyzer
:
public
edm::one::EDAnalyzer
<> {
10
public
:
11
explicit
ElectronIDAnalyzer
(
const
edm::ParameterSet
& conf);
12
~ElectronIDAnalyzer
()
override
{};
13
14
void
analyze
(
const
edm::Event
&
e
,
const
edm::EventSetup
&
c
)
override
;
15
16
private
:
17
edm::ParameterSet
conf_
;
18
19
std::string
electronProducer_
;
20
21
std::string
electronLabelRobustLoose_
;
22
std::string
electronLabelRobustTight_
;
23
std::string
electronLabelLoose_
;
24
std::string
electronLabelTight_
;
25
};
26
27
#include "
FWCore/Framework/interface/MakerMacros.h
"
28
DEFINE_FWK_MODULE
(
ElectronIDAnalyzer
);
29
30
ElectronIDAnalyzer::ElectronIDAnalyzer
(
const
edm::ParameterSet
& conf) : conf_(conf) {
31
electronProducer_
= conf.
getParameter
<
std::string
>(
"electronProducer"
);
32
electronLabelRobustLoose_
= conf.
getParameter
<
std::string
>(
"electronLabelRobustLoose"
);
33
electronLabelRobustTight_
= conf.
getParameter
<
std::string
>(
"electronLabelRobustTight"
);
34
electronLabelLoose_
= conf.
getParameter
<
std::string
>(
"electronLabelLoose"
);
35
electronLabelTight_
= conf.
getParameter
<
std::string
>(
"electronLabelTight"
);
36
}
37
38
void
ElectronIDAnalyzer::analyze
(
const
edm::Event
&
e
,
const
edm::EventSetup
&
c
) {
39
//Read selectrons
40
edm::Handle<reco::GsfElectronCollection>
electrons
;
41
e
.getByLabel(
electronProducer_
,
electrons
);
42
43
//Read eID results
44
std::vector<edm::Handle<edm::ValueMap<float> > > eIDValueMap(4);
45
//Robust-Loose
46
e
.getByLabel(
electronLabelRobustLoose_
, eIDValueMap[0]);
47
const
edm::ValueMap<float>
& eIDmapRL = *eIDValueMap[0];
48
//Robust-Tight
49
e
.getByLabel(
electronLabelRobustTight_
, eIDValueMap[1]);
50
const
edm::ValueMap<float>
& eIDmapRT = *eIDValueMap[1];
51
//Loose
52
e
.getByLabel(
electronLabelLoose_
, eIDValueMap[2]);
53
const
edm::ValueMap<float>
& eIDmapL = *eIDValueMap[2];
54
//Tight
55
e
.getByLabel(
electronLabelTight_
, eIDValueMap[3]);
56
const
edm::ValueMap<float>
& eIDmapT = *eIDValueMap[3];
57
58
// Loop over electrons
59
for
(
unsigned
int
i
= 0;
i
<
electrons
->size();
i
++) {
60
edm::Ref<reco::GsfElectronCollection>
electronRef(
electrons
,
i
);
61
std::cout
<<
"Event "
<<
e
.id() <<
" , electron "
<<
i
+ 1 <<
" , Robust Loose = "
<< eIDmapRL[electronRef]
62
<<
" , Robust Tight = "
<< eIDmapRT[electronRef] <<
" , Loose = "
<< eIDmapL[electronRef]
63
<<
" , Tight = "
<< eIDmapT[electronRef] << std::endl;
64
}
65
}
Handle.h
EDAnalyzer.h
mps_fire.i
i
Definition:
mps_fire.py:428
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
edm::Handle< reco::GsfElectronCollection >
edm::Ref
Definition:
AssociativeIterator.h:58
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
ElectronIDAnalyzer::ElectronIDAnalyzer
ElectronIDAnalyzer(const edm::ParameterSet &conf)
Definition:
ElectronIDAnalyzer.cc:30
ElectronIDAnalyzer::electronLabelRobustTight_
std::string electronLabelRobustTight_
Definition:
ElectronIDAnalyzer.cc:22
GsfElectron.h
ElectronIDAnalyzer::conf_
edm::ParameterSet conf_
Definition:
ElectronIDAnalyzer.cc:17
ElectronIDAnalyzer::electronLabelTight_
std::string electronLabelTight_
Definition:
ElectronIDAnalyzer.cc:24
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
ElectronIDAnalyzer::electronProducer_
std::string electronProducer_
Definition:
ElectronIDAnalyzer.cc:19
ElectronIDAnalyzer::electronLabelRobustLoose_
std::string electronLabelRobustLoose_
Definition:
ElectronIDAnalyzer.cc:21
edm::EventSetup
Definition:
EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
ElectronIDAnalyzer::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition:
ElectronIDAnalyzer.cc:38
ValueMap.h
pwdgSkimBPark_cfi.electrons
electrons
Definition:
pwdgSkimBPark_cfi.py:6
edm::ValueMap< float >
ElectronIDAnalyzer::electronLabelLoose_
std::string electronLabelLoose_
Definition:
ElectronIDAnalyzer.cc:23
EventSetup.h
ElectronIDAnalyzer
Definition:
ElectronIDAnalyzer.cc:9
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
ElectronIDAnalyzer::~ElectronIDAnalyzer
~ElectronIDAnalyzer() override
Definition:
ElectronIDAnalyzer.cc:12
ParameterSet.h
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:56
edm::Event
Definition:
Event.h:73
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16