PhysicsTools
IsolationAlgos
plugins
IsolationProducerForTracks.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/EDProducer.h
"
2
#include "
FWCore/Utilities/interface/InputTag.h
"
3
#include "
FWCore/Framework/interface/Event.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
5
#include "
DataFormats/Common/interface/ValueMap.h
"
6
#include "
DataFormats/Candidate/interface/Candidate.h
"
7
#include "
DataFormats/Candidate/interface/CandidateFwd.h
"
8
#include "
DataFormats/RecoCandidate/interface/IsoDeposit.h
"
9
#include "
DataFormats/RecoCandidate/interface/IsoDepositFwd.h
"
10
11
class
IsolationProducerForTracks
:
public
edm::EDProducer
{
12
public
:
13
IsolationProducerForTracks
(
const
edm::ParameterSet
&);
14
15
private
:
16
void
produce
(
edm::Event
&
event
,
const
edm::EventSetup
&
setup
)
override
;
17
18
edm::EDGetTokenT<reco::CandidateView>
tracksToken_
;
19
edm::EDGetTokenT<reco::CandidateView>
highPtTracksToken_
;
20
edm::EDGetTokenT<reco::IsoDepositMap>
isoDepsToken_
;
21
double
trackPtMin_
;
22
double
coneSize_
;
23
};
24
25
#include "
DataFormats/Common/interface/Handle.h
"
26
#include "
DataFormats/Common/interface/Association.h
"
27
#include "
DataFormats/Common/interface/Ref.h
"
28
#include "
DataFormats/Candidate/interface/OverlapChecker.h
"
29
#include <iostream>
30
#include <iterator>
31
#include <vector>
32
33
using namespace
edm
;
34
using namespace
reco
;
35
36
typedef
edm::ValueMap<float>
TkIsoMap
;
37
38
IsolationProducerForTracks::IsolationProducerForTracks
(
const
ParameterSet
&
pset
)
39
: tracksToken_(consumes<
CandidateView
>(
pset
.getParameter<
InputTag
>(
"tracks"
))),
40
highPtTracksToken_(consumes<
CandidateView
>(
pset
.getParameter<
InputTag
>(
"highPtTracks"
))),
41
isoDepsToken_(consumes<
IsoDepositMap
>(
pset
.getParameter<
InputTag
>(
"isoDeps"
))),
42
trackPtMin_(
pset
.getParameter<double>(
"trackPtMin"
)),
43
coneSize_(
pset
.getParameter<double>(
"coneSize"
)) {
44
produces<TkIsoMap>();
45
}
46
47
void
IsolationProducerForTracks::produce
(
Event
&
event
,
const
EventSetup
&
setup
) {
48
auto
caloIsolations = std::make_unique<TkIsoMap>();
49
TkIsoMap::Filler
filler
(*caloIsolations);
50
{
51
Handle<CandidateView>
tracks
;
52
event
.getByToken(
tracksToken_
,
tracks
);
53
54
Handle<CandidateView>
highPtTracks
;
55
event
.getByToken(
highPtTracksToken_
,
highPtTracks
);
56
57
Handle<IsoDepositMap>
isoDeps
;
58
event
.getByToken(
isoDepsToken_
,
isoDeps
);
59
60
int
nTracks
=
tracks
->size();
61
int
nHighPtTracks =
highPtTracks
->size();
62
std::vector<double> iso(
nTracks
);
63
64
OverlapChecker
overlap
;
65
66
for
(
int
i
= 0;
i
<
nTracks
; ++
i
) {
67
const
Candidate
& tkCand = (*tracks)[
i
];
68
double
caloIso = -1.0;
69
if
(tkCand.
pt
() >
trackPtMin_
) {
70
for
(
int
j
= 0;
j
< nHighPtTracks; ++
j
) {
71
const
Candidate
& highPtTkCand = (*highPtTracks)[
j
];
72
if
(
overlap
(tkCand, highPtTkCand)) {
73
CandidateBaseRef
tkRef =
highPtTracks
->refAt(
j
);
74
const
IsoDeposit
& isoDep = (*isoDeps)[tkRef];
75
caloIso = isoDep.
depositWithin
(
coneSize_
);
76
break
;
77
}
78
}
79
}
80
iso[
i
] = caloIso;
81
}
82
filler
.insert(
tracks
, iso.begin(), iso.end());
83
}
84
85
// really fill the association map
86
filler
.fill();
87
event
.put(
std::move
(caloIsolations));
88
}
89
90
#include "
FWCore/Framework/interface/MakerMacros.h
"
91
92
DEFINE_FWK_MODULE
(
IsolationProducerForTracks
);
highPtTrackIsolations_cff.isoDeps
isoDeps
Definition:
highPtTrackIsolations_cff.py:7
OverlapChecker
Definition:
OverlapChecker.h:17
Handle.h
mps_fire.i
i
Definition:
mps_fire.py:428
EDProducer.h
IsolationProducerForTracks::highPtTracksToken_
edm::EDGetTokenT< reco::CandidateView > highPtTracksToken_
Definition:
IsolationProducerForTracks.cc:19
edm::EDGetTokenT
Definition:
EDGetToken.h:33
edm
HLT enums.
Definition:
AlignableModifier.h:19
reco::Candidate::pt
virtual double pt() const =0
transverse momentum
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:46
Association.h
BeamSpotPI::nTracks
Definition:
BeamSpotPayloadInspectorHelper.h:42
edm::Handle
Definition:
AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition:
singleTopDQM_cfi.py:37
CandidateFwd.h
IsolationProducerForTracks::produce
void produce(edm::Event &event, const edm::EventSetup &setup) override
Definition:
IsolationProducerForTracks.cc:47
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
IsolationProducerForTracks::trackPtMin_
double trackPtMin_
Definition:
IsolationProducerForTracks.cc:21
L1TrackerEtMissProducer_cfi.highPtTracks
highPtTracks
Definition:
L1TrackerEtMissProducer_cfi.py:17
IsoDeposit.h
edm::View
Definition:
CaloClusterFwd.h:14
edm::ParameterSet
Definition:
ParameterSet.h:47
IsolationProducerForTracks::tracksToken_
edm::EDGetTokenT< reco::CandidateView > tracksToken_
Definition:
IsolationProducerForTracks.cc:18
IsolationProducerForTracks::isoDepsToken_
edm::EDGetTokenT< reco::IsoDepositMap > isoDepsToken_
Definition:
IsolationProducerForTracks.cc:20
Event.h
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition:
CAHitNtupletGeneratorKernelsImpl.h:176
trigObjTnPSource_cfi.filler
filler
Definition:
trigObjTnPSource_cfi.py:21
muon::overlap
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
Definition:
MuonSelectors.cc:791
IsolationProducerForTracks::IsolationProducerForTracks
IsolationProducerForTracks(const edm::ParameterSet &)
Definition:
IsolationProducerForTracks.cc:38
edm::EventSetup
Definition:
EventSetup.h:58
InputTag.h
reco::Candidate
Definition:
Candidate.h:27
ValueMap.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Ref.h
reco::IsoDeposit::depositWithin
double depositWithin(double coneSize, const Vetos &vetos=Vetos(), bool skipDepositVeto=false) const
Get deposit.
Definition:
IsoDeposit.cc:29
TkIsoMap
edm::ValueMap< float > TkIsoMap
Definition:
IsolationProducerForTracks.cc:36
edm::ValueMap< float >
reco::IsoDeposit
Definition:
IsoDeposit.h:49
edm::EDProducer
Definition:
EDProducer.h:35
edm::RefToBase< Candidate >
IsolationProducerForTracks
Definition:
IsolationProducerForTracks.cc:11
OverlapChecker.h
Candidate.h
IsoDepositFwd.h
edm::helper::Filler
Definition:
ValueMap.h:22
ParameterSet.h
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
IsolationProducerForTracks::coneSize_
double coneSize_
Definition:
IsolationProducerForTracks.cc:22
event
Definition:
event.py:1
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
Generated for CMSSW Reference Manual by
1.8.16