5 copyExtras_(cloner.copyExtras_), copyTrajectories_(cloner.copyTrajectories_), evt(ievt) {
6 selTracks_ = std::make_unique<reco::TrackCollection>();
9 selHits_ = std::make_unique<TrackingRecHitCollection>();
12 selTrajs_ = std::make_unique< std::vector<Trajectory> >();
33 trajRefProd = evt.getRefBeforePut< std::vector<Trajectory> >();
36 std::vector<Trajectory> dummy;
40 auto const & tracksIn = tokens.
tracks(evt);
41 for (
auto k : selected) {
42 auto const & trk = tracksIn[
k];
43 selTracks_->emplace_back( trk );
46 selTrajs_->emplace_back(trajIn[
k]);
47 assert(selTrajs_->back().measurements().size()==trk.recHitsSize());
48 selTTAss_->insert (
edm::Ref< std::vector<Trajectory> >(trajRefProd, selTrajs_->size() - 1),
56 selTrackExtras_->emplace_back( trk.outerPosition(), trk.outerMomentum(), trk.outerOk(),
57 trk.innerPosition(), trk.innerMomentum(), trk.innerOk(),
58 trk.outerStateCovariance(), trk.outerDetId(),
59 trk.innerStateCovariance(), trk.innerDetId(),
60 trk.seedDirection(), trk.seedRef()
62 selTracks_->back().setExtra(
reco::TrackExtraRef( rTrackExtras, selTrackExtras_->size() - 1) );
63 auto & tx = selTrackExtras_->back();
64 tx.setResiduals(trk.residuals());
65 auto nh1=trk.recHitsSize();
66 tx.setHits(rHits,selHits_->size(),nh1);
68 for(
auto hit = trk.recHitsBegin();
hit != trk.recHitsEnd(); ++
hit ) {
69 selHits_->push_back( (*hit)->clone() );
76 selTracks_->shrink_to_fit();
77 auto tsize = selTracks_->size();
80 selTrackExtras_->shrink_to_fit();
81 assert(selTrackExtras_->size()==tsize);
82 selHits_->shrink_to_fit();
87 selTrajs_->shrink_to_fit();
88 assert(selTrajs_->size()==tsize);
89 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
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
std::vector< Trajectory > const & trajectories(edm::Event &evt) const
reco::TrackCollection const & tracks(edm::Event &evt) const
RefProd< PROD > getRefBeforePut()
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
Producer(edm::Event &ievt, TrackCollectionCloner const &cloner)
bool copyTrajectories_
copy also trajectories and trajectory->track associations
void operator()(Tokens const &tokens, std::vector< unsigned int > const &selected)
process one event
std::unique_ptr< TrajTrackAssociationCollection > selTTAss_