12 #include "cetlib_except/exception.h" 70 produces<std::vector<recob::Track> >();
71 produces<art::Assns<recob::Track, recob::Hit> >();
72 produces<art::Assns<recob::TrackTrajectory, recob::Track> >();
73 if (
doTrackFitHitInfo_) produces<std::vector<std::vector<recob::TrackFitHitInfo> > >();
75 produces<std::vector<recob::SpacePoint> >();
76 produces<art::Assns<recob::Hit, recob::SpacePoint> >();
83 auto outputTracks = std::make_unique<std::vector<recob::Track> >();
84 auto outputHits = std::make_unique<art::Assns<recob::Track, recob::Hit> >();
85 auto outputTTjTAssn = std::make_unique<art::Assns<recob::TrackTrajectory, recob::Track> >();
86 auto outputHitInfo = std::make_unique<std::vector<std::vector<recob::TrackFitHitInfo> > >();
87 auto outputSpacePoints = std::make_unique<std::vector<recob::SpacePoint> >();
88 auto outputHitSpacePointAssn = std::make_unique<art::Assns<recob::Hit, recob::SpacePoint> >();
103 unsigned int iTraj = 0;
104 for (
auto hitsRange: trajectoriesWithHits) {
108 std::vector<art::Ptr<recob::Hit> > inHits;
113 std::vector<art::Ptr<recob::Hit> > outHits;
119 bool fitok =
trackMaker_->makeTrack(traj, inHits, outTrack, outHits, optionals);
120 if (!fitok)
continue;
125 throw cet::exception(
"TrackProducerFromTrackTrajectory") <<
"Produced recob::Track required to have 1-1 correspondance between hits and points.\n";
129 outputTracks->emplace_back(std::move(outTrack));
131 outputTTjTAssn->addSingle(traj, aptr);
133 for (
auto const& trhit: outHits) {
134 outputHits->addSingle(aptr, trhit);
138 const double fXYZ[3] = {tp.X(),tp.Y(),tp.Z()};
139 const double fErrXYZ[6] = {0};
141 outputSpacePoints->emplace_back(std::move(sp));
143 outputHitSpacePointAssn->addSingle(trhit, apsp);
149 for (
auto it = osp.begin(); it!=osp.end(); ++it ) {
150 outputSpacePoints->emplace_back(std::move(it->first));
152 outputHitSpacePointAssn->addSingle(it->second,apsp);
161 e.
put(std::move(outputTracks));
162 e.
put(std::move(outputHits));
163 e.
put(std::move(outputTTjTAssn));
165 e.
put(std::move(outputHitInfo));
168 e.
put(std::move(outputSpacePoints));
169 e.
put(std::move(outputHitSpacePointAssn));
void initTrackFitInfos()
initialize the output vector of TrackFitHitInfos
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
Produce a reco::Track collection, as a result of the fit of an existing recob::TrackTrajectory collec...
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
std::unique_ptr< trkmkr::TrackMaker > trackMaker_
ProductID put(std::unique_ptr< PROD > &&product)
auto associated_groups(A const &assns)
Helper functions to access associations in order.
#define DEFINE_ART_MODULE(klass)
TrackProducerFromTrackTrajectory(fhicl::ParameterSet const &p)
TrackProducerFromTrackTrajectory & operator=(TrackProducerFromTrackTrajectory const &)=delete
T get(std::string const &key) const
Point_t const & LocationAtPoint(size_t i) const
Returns the position at the specified trajectory point.
bool spacePointsFromTrajP_
Detector simulation of raw signals on wires.
void produce(art::Event &e) override
std::vector< SpHitPair > spacePointHitPairs()
get the output vector of SpHitPair by releasing and moving
art::InputTag trajInputTag
std::vector< recob::TrackFitHitInfo > trackFitHitInfos()
get the output vector of TrackFitHitInfos by releasing and moving
Helper functions to access associations in order.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
void initSpacePoints()
initialize the output vector of SpHitPair
Struct holding optional TrackMaker outputs.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
cet::coded_exception< error, detail::translate > exception