src
RecoTracker
TrackProducer
plugins
TrackExtraRekeyer.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/Event.h
"
2
#include "
FWCore/Framework/interface/global/EDProducer.h
"
3
#include "
FWCore/Framework/interface/MakerMacros.h
"
4
5
#include "
DataFormats/TrackReco/interface/Track.h
"
6
#include "
DataFormats/TrackReco/interface/TrackFwd.h
"
7
#include "
DataFormats/TrackReco/interface/TrackExtraFwd.h
"
8
9
class
TrackExtraRekeyer
:
public
edm::global::EDProducer
<> {
10
public
:
11
explicit
TrackExtraRekeyer
(
const
edm::ParameterSet
&);
12
~TrackExtraRekeyer
()
override
=
default
;
13
14
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
&descriptions);
15
16
private
:
17
void
produce
(
edm::StreamID
,
edm::Event
&,
const
edm::EventSetup
&)
const override
;
18
19
// memeber data
20
const
edm::EDGetTokenT<reco::TrackCollection>
inputTrack_
;
21
const
edm::EDGetTokenT<edm::Association<reco::TrackExtraCollection>
>
inputAssoc_
;
22
const
edm::EDPutTokenT<reco::TrackCollection>
outputTrack_
;
23
};
24
25
TrackExtraRekeyer::TrackExtraRekeyer
(
const
edm::ParameterSet
&iConfig)
26
: inputTrack_(consumes(iConfig.getParameter<
edm
::
InputTag
>(
"src"
))),
27
inputAssoc_(consumes(iConfig.getParameter<
edm
::
InputTag
>(
"association"
))),
28
outputTrack_(produces<
reco
::
TrackCollection
>()) {}
29
30
// ------------ method called for each event ------------
31
void
TrackExtraRekeyer::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
&iSetup)
const
{
32
using namespace
edm
;
33
34
auto
const
&
tracks
=
iEvent
.get(
inputTrack_
);
35
auto
const
&
assoc
=
iEvent
.get(
inputAssoc_
);
36
37
reco::TrackCollection
tracksOut;
38
39
for
(
auto
const
&
track
:
tracks
) {
40
if
(!
assoc
.contains(
track
.extra().id())) {
41
continue
;
42
}
43
const
reco::TrackExtraRef
&trackextraref =
assoc
[
track
.extra()];
44
if
(trackextraref.
isNonnull
()) {
45
auto
&trackout = tracksOut.emplace_back(
track
);
46
trackout.setExtra(trackextraref);
47
}
48
}
49
iEvent
.emplace(
outputTrack_
,
std::move
(tracksOut));
50
}
51
52
void
TrackExtraRekeyer::fillDescriptions
(
edm::ConfigurationDescriptions
&descriptions) {
53
edm::ParameterSetDescription
desc
;
54
desc
.setComment(
"Simple prooducer to re-key muon tracks for refit"
);
55
desc
.add<
edm::InputTag
>(
"src"
,
edm::InputTag
(
"generalTracks"
))->setComment(
"input track collections"
);
56
desc
.add<
edm::InputTag
>(
"association"
,
edm::InputTag
(
"muonReducedTrackExtras"
))
57
->setComment(
"input track association collection"
);
58
descriptions.
addWithDefaultLabel
(
desc
);
59
}
60
61
DEFINE_FWK_MODULE
(
TrackExtraRekeyer
);
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:87
TrackExtraRekeyer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
TrackExtraRekeyer.cc:52
edm::Ref< TrackExtraCollection >
edm::StreamID
Definition:
StreamID.h:30
Event.h
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition:
TrackFwd.h:14
TrackExtraRekeyer::outputTrack_
const edm::EDPutTokenT< reco::TrackCollection > outputTrack_
Definition:
TrackExtraRekeyer.cc:22
HLT_2022v15_cff.InputTag
InputTag
Definition:
HLT_2022v15_cff.py:60417
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition:
Ref.h:238
TrackFwd.h
edm::EDGetTokenT< reco::TrackCollection >
edm::EDPutTokenT< reco::TrackCollection >
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
TrackExtraRekeyer::inputTrack_
const edm::EDGetTokenT< reco::TrackCollection > inputTrack_
Definition:
TrackExtraRekeyer.cc:20
trackingPlots.assoc
assoc
Definition:
trackingPlots.py:183
iEvent
int iEvent
Definition:
GenABIO.cc:224
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::EventSetup
Definition:
EventSetup.h:59
edm::global::EDProducer
Definition:
EDProducer.h:32
TrackExtraFwd.h
TrackExtraRekeyer::TrackExtraRekeyer
TrackExtraRekeyer(const edm::ParameterSet &)
Definition:
TrackExtraRekeyer.cc:25
tracks
auto const & tracks
cannot be loose
Definition:
CAHitNtupletGeneratorKernelsImpl.h:148
TrackExtraRekeyer::~TrackExtraRekeyer
~TrackExtraRekeyer() override=default
EDProducer.h
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:46
TrackExtraRekeyer::inputAssoc_
const edm::EDGetTokenT< edm::Association< reco::TrackExtraCollection > > inputAssoc_
Definition:
TrackExtraRekeyer.cc:21
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::InputTag
Definition:
InputTag.h:15
HLT_2022v15_cff.track
track
Definition:
HLT_2022v15_cff.py:9644
Track.h
edm::ParameterSet
Definition:
ParameterSet.h:47
edm::Event
Definition:
Event.h:73
TrackExtraRekeyer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition:
TrackExtraRekeyer.cc:31
MakerMacros.h
TrackExtraRekeyer
Definition:
TrackExtraRekeyer.cc:9
eostools.move
def move(src, dest)
Definition:
eostools.py:511
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
Generated for CMSSW Reference Manual by
1.8.14