CMS 3D CMS Logo

TrackExtraRekeyer.cc
Go to the documentation of this file.
4 
8 
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
23 };
24 
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 ------------
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 
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 
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
const edm::EDPutTokenT< reco::TrackCollection > outputTrack_
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:232
const edm::EDGetTokenT< reco::TrackCollection > inputTrack_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TrackExtraRekeyer(const edm::ParameterSet &)
~TrackExtraRekeyer() override=default
fixed size matrix
const edm::EDGetTokenT< edm::Association< reco::TrackExtraCollection > > inputAssoc_
HLT enums.
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
def move(src, dest)
Definition: eostools.py:511