src
PhysicsTools
NanoAOD
plugins
pfTracksProducer.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
2
#include "
FWCore/Framework/interface/Event.h
"
3
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
4
#include "
FWCore/Utilities/interface/InputTag.h
"
5
#include "
DataFormats/Common/interface/View.h
"
6
7
#include "
DataFormats/PatCandidates/interface/UserData.h
"
8
#include "
PhysicsTools/PatAlgos/interface/PATUserDataMerger.h
"
9
#include "
CommonTools/Utils/interface/StringCutObjectSelector.h
"
10
11
#include "
DataFormats/VertexReco/interface/Vertex.h
"
12
#include "
DataFormats/VertexReco/interface/VertexFwd.h
"
13
14
#include "
DataFormats/PatCandidates/interface/PackedCandidate.h
"
15
#include "
DataFormats/TrackReco/interface/Track.h
"
16
#include "
DataFormats/Math/interface/deltaR.h
"
17
#include "
DataFormats/MuonReco/interface/MuonSimInfo.h
"
18
#include "
MuonAnalysis/MuonAssociators/interface/PropagateToMuon.h
"
19
20
class
pfTracksProducer
:
public
edm::stream::EDProducer
<> {
21
public
:
22
explicit
pfTracksProducer
(
const
edm::ParameterSet
& iConfig)
23
:
PFCands_
(consumes<
std
::
vector
<
pat
::PackedCandidate>>(iConfig.getParameter<
edm
::
InputTag
>(
"PFCands"
))),
24
LostTracks_
(consumes<
std
::
vector
<
pat
::PackedCandidate>>(iConfig.getParameter<
edm
::
InputTag
>(
"lostTracks"
))),
25
trkSelection_
(iConfig.getParameter<
std
::
string
>(
"trkSelection"
)),
26
HighPurity_
(iConfig.getParameter<
bool
>(
"TrkHPurity"
)) {
27
produces<reco::TrackCollection>();
28
}
29
~pfTracksProducer
()
override
{}
30
31
private
:
32
void
produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
override
;
33
34
edm::EDGetToken
PFCands_
;
35
edm::EDGetToken
LostTracks_
;
36
const
StringCutObjectSelector<pat::PackedCandidate>
trkSelection_
;
37
const
bool
HighPurity_
;
38
};
39
40
void
pfTracksProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
41
edm::Handle<std::vector<pat::PackedCandidate>
>
pfcands
;
42
iEvent
.getByToken(
PFCands_
,
pfcands
);
43
44
edm::Handle<std::vector<pat::PackedCandidate>
>
lostTracks
;
45
iEvent
.getByToken(
LostTracks_
,
lostTracks
);
46
47
std::unique_ptr<std::vector<reco::Track>>
tracks
(
new
std::vector<reco::Track>());
48
tracks
->reserve(
pfcands
->size() +
lostTracks
->size());
49
50
for
(
const
auto
& container : {
pfcands
,
lostTracks
}) {
51
for
(
const
pat::PackedCandidate
& trk : *container) {
52
if
(!trk.hasTrackDetails())
53
continue
;
54
if
(!
trkSelection_
(trk))
55
continue
;
56
if
(
HighPurity_
&& !trk.trackHighPurity())
57
continue
;
58
tracks
->emplace_back(*trk.bestTrack());
59
}
60
}
61
62
iEvent
.put(
std::move
(
tracks
));
63
}
64
65
#include "
FWCore/Framework/interface/MakerMacros.h
"
66
DEFINE_FWK_MODULE
(
pfTracksProducer
);
deltaR.h
pfTracksProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition:
pfTracksProducer.cc:40
Vertex.h
ProducerED_cfi.InputTag
InputTag
Definition:
ProducerED_cfi.py:5
pfTracksProducer::pfTracksProducer
pfTracksProducer(const edm::ParameterSet &iConfig)
Definition:
pfTracksProducer.cc:22
pfTracksProducer
Definition:
pfTracksProducer.cc:20
pfTracksProducer::LostTracks_
edm::EDGetToken LostTracks_
Definition:
pfTracksProducer.cc:35
EDProducer.h
isotracks_cff.lostTracks
lostTracks
Definition:
isotracks_cff.py:23
Event.h
StringCutObjectSelector< pat::PackedCandidate >
edm::Handle
Definition:
AssociativeIterator.h:50
std
Definition:
JetResolutionObject.h:76
PackedCandidate.h
VertexFwd.h
pfTracksProducer::~pfTracksProducer
~pfTracksProducer() override
Definition:
pfTracksProducer.cc:29
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
pat
Definition:
HeavyIon.h:7
ParameterSet.h
DiMuonV_cfg.tracks
tracks
Definition:
DiMuonV_cfg.py:215
edm::EDGetToken
Definition:
EDGetToken.h:39
StringCutObjectSelector.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
pfTracksProducer::trkSelection_
const StringCutObjectSelector< pat::PackedCandidate > trkSelection_
Definition:
pfTracksProducer.cc:36
MuonSimInfo.h
View.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::EventSetup
Definition:
EventSetup.h:56
HLT_2024v14_cff.pfcands
pfcands
Definition:
HLT_2024v14_cff.py:62057
UserData.h
edm::stream::EDProducer
Definition:
EDProducer.h:36
nano_mu_local_reco_cff.bool
bool
Definition:
nano_mu_local_reco_cff.py:14
pat::PackedCandidate
Definition:
PackedCandidate.h:22
PropagateToMuon.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
trackerHitRTTI::vector
Definition:
trackerHitRTTI.h:21
InputTag.h
pfTracksProducer::PFCands_
edm::EDGetToken PFCands_
Definition:
pfTracksProducer.cc:34
Track.h
edm::ParameterSet
Definition:
ParameterSet.h:48
edm::Event
Definition:
Event.h:73
PATUserDataMerger.h
pfTracksProducer::HighPurity_
const bool HighPurity_
Definition:
pfTracksProducer.cc:37
MakerMacros.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Generated for CMSSW Reference Manual by
1.8.14