Calibration
Tools
plugins
ElectronSqPtTkIsolationProducer.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/Event.h
"
2
#include "
FWCore/Framework/interface/EventSetup.h
"
3
#include "
DataFormats/Common/interface/Handle.h
"
4
#include "
FWCore/Framework/interface/ESHandle.h
"
5
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
6
#include "
FWCore/Utilities/interface/Exception.h
"
7
8
#include "
DataFormats/EgammaCandidates/interface/GsfElectronFwd.h
"
9
#include "
DataFormats/Candidate/interface/CandAssociation.h
"
10
#include "
DataFormats/Candidate/interface/CandidateFwd.h
"
11
12
#include "
Calibration/Tools/plugins/ElectronSqPtTkIsolationProducer.h
"
13
#include "
Calibration/Tools/plugins/ElectronSqPtTkIsolation.h
"
14
15
ElectronSqPtTkIsolationProducer::ElectronSqPtTkIsolationProducer
(
const
edm::ParameterSet
&
config
) : conf_(
config
) {
16
// use configuration file to setup input/output collection names
17
electronProducer_
=
conf_
.
getParameter
<
edm::InputTag
>(
"electronProducer"
);
18
19
trackProducer_
=
conf_
.
getParameter
<
edm::InputTag
>(
"trackProducer"
);
20
21
ptMin_
=
conf_
.
getParameter
<
double
>(
"ptMin"
);
22
intRadius_
=
conf_
.
getParameter
<
double
>(
"intRadius"
);
23
extRadius_
=
conf_
.
getParameter
<
double
>(
"extRadius"
);
24
maxVtxDist_
=
conf_
.
getParameter
<
double
>(
"maxVtxDist"
);
25
26
absolut_
=
conf_
.
getParameter
<
bool
>(
"absolut"
);
27
28
//register your products
29
produces<reco::CandViewDoubleAssociations>();
30
}
31
32
ElectronSqPtTkIsolationProducer::~ElectronSqPtTkIsolationProducer
() {}
33
34
void
ElectronSqPtTkIsolationProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
35
// Get the filtered objects
36
edm::Handle<reco::GsfElectronCollection>
electronHandle;
37
iEvent
.getByLabel(
electronProducer_
, electronHandle);
38
39
//get the tracks
40
edm::Handle<reco::TrackCollection>
tracks
;
41
iEvent
.getByLabel(
trackProducer_
,
tracks
);
42
const
reco::TrackCollection
*
trackCollection
=
tracks
.product();
43
44
reco::CandViewDoubleAssociations
* isoMap =
45
new
reco::CandViewDoubleAssociations
(
reco::CandidateBaseRefProd
(
reco::GsfElectronRefProd
(electronHandle)));
46
47
ElectronSqPtTkIsolation
myTkIsolation(
extRadius_
,
intRadius_
,
ptMin_
,
maxVtxDist_
,
trackCollection
);
48
49
for
(
unsigned
int
i
= 0;
i
< electronHandle->size(); ++
i
) {
50
double
isoValue = myTkIsolation.
getPtTracks
(&(electronHandle->at(
i
)));
51
if
(
absolut_
==
true
) {
52
isoMap->
setValue
(
i
, isoValue);
53
}
else
{
54
reco::SuperClusterRef
sc = (electronHandle->at(
i
)).superCluster();
55
double
et
= sc.
get
()->energy() *
sin
(2 * atan(
exp
(-sc.
get
()->eta())));
56
isoMap->
setValue
(
i
, isoValue /
et
);
57
}
58
}
59
60
std::unique_ptr<reco::CandViewDoubleAssociations> isolMap(isoMap);
61
iEvent
.put(
std::move
(isolMap));
62
}
edm::RefProd
Definition:
EDProductfwd.h:25
Handle.h
PDWG_EXOHSCP_cff.tracks
tracks
Definition:
PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition:
mps_fire.py:355
MessageLogger.h
ElectronSqPtTkIsolationProducer::~ElectronSqPtTkIsolationProducer
~ElectronSqPtTkIsolationProducer() override
Definition:
ElectronSqPtTkIsolationProducer.cc:32
ElectronSqPtTkIsolationProducer::conf_
edm::ParameterSet conf_
Definition:
ElectronSqPtTkIsolationProducer.h:30
ESHandle.h
ElectronSqPtTkIsolation.h
reco::CandViewDoubleAssociations
edm::AssociationVector< CandidateBaseRefProd, std::vector< double > > CandViewDoubleAssociations
Definition:
CandAssociation.h:36
ElectronSqPtTkIsolationProducer.h
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition:
Ref.h:232
edm::Handle< reco::GsfElectronCollection >
edm::Ref< SuperClusterCollection >
funct::sin
Sin< T >::type sin(const T &t)
Definition:
Sin.h:22
CandidateFwd.h
config
Definition:
config.py:1
ElectronSqPtTkIsolationProducer::electronProducer_
edm::InputTag electronProducer_
Definition:
ElectronSqPtTkIsolationProducer.h:20
edm::AssociationVector::setValue
void setValue(size_type i, typename CVal::value_type const &val)
Definition:
AssociationVector.h:216
ElectronSqPtTkIsolationProducer::ElectronSqPtTkIsolationProducer
ElectronSqPtTkIsolationProducer(const edm::ParameterSet &)
Definition:
ElectronSqPtTkIsolationProducer.cc:15
edm::AssociationVector
Definition:
AssociationVector.h:67
ElectronSqPtTkIsolationProducer::ptMin_
double ptMin_
Definition:
ElectronSqPtTkIsolationProducer.h:23
GsfElectronFwd.h
edm::ParameterSet
Definition:
ParameterSet.h:36
CandAssociation.h
duplicaterechits_cfi.trackCollection
trackCollection
Definition:
duplicaterechits_cfi.py:4
Event.h
ElectronSqPtTkIsolationProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
ElectronSqPtTkIsolationProducer.cc:34
iEvent
int iEvent
Definition:
GenABIO.cc:224
EgHLTOffHistBins_cfi.et
et
Definition:
EgHLTOffHistBins_cfi.py:8
ElectronSqPtTkIsolationProducer::trackProducer_
edm::InputTag trackProducer_
Definition:
ElectronSqPtTkIsolationProducer.h:21
edm::EventSetup
Definition:
EventSetup.h:57
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ElectronSqPtTkIsolationProducer::extRadius_
double extRadius_
Definition:
ElectronSqPtTkIsolationProducer.h:25
eostools.move
def move(src, dest)
Definition:
eostools.py:511
ElectronSqPtTkIsolationProducer::absolut_
bool absolut_
Definition:
ElectronSqPtTkIsolationProducer.h:28
ElectronSqPtTkIsolationProducer::intRadius_
double intRadius_
Definition:
ElectronSqPtTkIsolationProducer.h:24
ElectronSqPtTkIsolation::getPtTracks
double getPtTracks(const reco::GsfElectron *) const
Definition:
ElectronSqPtTkIsolation.cc:60
EventSetup.h
Exception.h
ElectronSqPtTkIsolation
Definition:
ElectronSqPtTkIsolation.h:16
JetChargeProducer_cfi.exp
exp
Definition:
JetChargeProducer_cfi.py:6
edm::Event
Definition:
Event.h:73
ElectronSqPtTkIsolationProducer::maxVtxDist_
double maxVtxDist_
Definition:
ElectronSqPtTkIsolationProducer.h:26
edm::InputTag
Definition:
InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition:
TrackFwd.h:14
edm::RefToBaseProd
Definition:
RefToBase.h:65
Generated for CMSSW Reference Manual by
1.8.16