4 desc.addUntracked<
bool>(
"copyExtras",
true);
5 desc.addUntracked<
bool>(
"copyTrajectories",
false);
9 : copyExtras_(cloner.copyExtras_), copyTrajectories_(cloner.copyTrajectories_), evt(ievt) {
10 selTracks_ = std::make_unique<reco::TrackCollection>();
13 selHits_ = std::make_unique<TrackingRecHitCollection>();
16 selTrajs_ = std::make_unique<std::vector<Trajectory> >();
35 trajRefProd = evt.getRefBeforePut<std::vector<Trajectory> >();
38 std::vector<Trajectory>
dummy;
42 auto const& tracksIn = tokens.
tracks(evt);
43 for (
auto k : selected) {
44 auto const&
trk = tracksIn[
k];
45 selTracks_->emplace_back(
trk);
48 selTrajs_->emplace_back(trajIn[
k]);
49 assert(selTrajs_->back().measurements().size() ==
trk.recHitsSize());
50 selTTAss_->insert(
edm::Ref<std::vector<Trajectory> >(trajRefProd, selTrajs_->size() - 1),
58 selTrackExtras_->emplace_back(
trk.outerPosition(),
64 trk.outerStateCovariance(),
66 trk.innerStateCovariance(),
70 selTracks_->back().setExtra(
reco::TrackExtraRef(rTrackExtras, selTrackExtras_->size() - 1));
71 auto& tx = selTrackExtras_->back();
72 tx.setResiduals(
trk.residuals());
73 auto nh1 =
trk.recHitsSize();
74 tx.setHits(rHits, selHits_->size(), nh1);
75 tx.setTrajParams(
trk.extra()->trajParams(),
trk.extra()->chi2sX5());
76 assert(tx.trajParams().size() == tx.recHitsSize());
79 selHits_->push_back((*hit)->clone());
85 selTracks_->shrink_to_fit();
86 auto tsize = selTracks_->size();
89 selTrackExtras_->shrink_to_fit();
90 assert(selTrackExtras_->size() == tsize);
91 selHits_->shrink_to_fit();
96 selTrajs_->shrink_to_fit();
97 assert(selTrajs_->size() == tsize);
98 assert(selTTAss_->size() == tsize);
std::unique_ptr< std::vector< Trajectory > > selTrajs_
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
std::vector< Track > TrackCollection
collection of Tracks
static void fill(edm::ParameterSetDescription &desc)
std::unique_ptr< reco::TrackExtraCollection > selTrackExtras_
std::unique_ptr< reco::TrackCollection > selTracks_
std::unique_ptr< TrackingRecHitCollection > selHits_
bool copyTrajectories_
copy also trajectories and trajectory->track associations
edm::Event & evt
the event
RefProd< PROD > getRefBeforePut()
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
std::vector< Trajectory > const & trajectories(edm::Event &evt) const
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
std::unique_ptr< TrajTrackAssociationCollection > selTTAss_
Producer(edm::Event &ievt, TrackCollectionCloner const &cloner)
reco::TrackCollection const & tracks(edm::Event &evt) const
bool copyTrajectories_
copy also trajectories and trajectory->track associations
void operator()(Tokens const &tokens, std::vector< unsigned int > const &selected)
process one event