13 #include "cetlib_except/exception.h" 88 produces<std::vector<recob::Track> >();
89 produces<art::Assns<recob::Track, recob::Hit> >();
90 produces<art::Assns<recob::PFParticle, recob::Track> >();
91 if (
doTrackFitHitInfo_) produces<std::vector<std::vector<recob::TrackFitHitInfo> > >();
93 produces<std::vector<recob::SpacePoint> >();
94 produces<art::Assns<recob::Hit, recob::SpacePoint> >();
101 auto outputTracks = std::make_unique<std::vector<recob::Track> >();
102 auto outputHits = std::make_unique<art::Assns<recob::Track, recob::Hit> >();
103 auto outputPfpTAssn = std::make_unique<art::Assns<recob::PFParticle, recob::Track> >();
104 auto outputHitInfo = std::make_unique<std::vector<std::vector<recob::TrackFitHitInfo> > >();
105 auto outputSpacePoints = std::make_unique<std::vector<recob::SpacePoint> >();
106 auto outputHitSpacePointAssn = std::make_unique<art::Assns<recob::Hit, recob::SpacePoint> >();
129 for (
unsigned int iPfp = 0; iPfp < inputPfps->size(); ++iPfp) {
135 const std::vector<art::Ptr<recob::Track> >& tracks = assocTracks->at(iPfp);
140 std::vector<art::Ptr<recob::Hit> > inHits;
146 std::vector<art::Ptr<recob::Hit> > outHits;
152 bool fitok =
trackMaker_->makeTrack(
track, inHits, outTrack, outHits, optionals);
153 if (!fitok)
continue;
158 throw cet::exception(
"TrackProducerFromPFParticle") <<
"Produced recob::Track required to have 1-1 correspondance between hits and points.\n";
162 outputTracks->emplace_back(std::move(outTrack));
164 outputPfpTAssn->addSingle(pfp, aptr);
166 for (
auto const& trhit: outHits) {
167 outputHits->addSingle(aptr, trhit);
171 const double fXYZ[3] = {tp.X(),tp.Y(),tp.Z()};
172 const double fErrXYZ[6] = {0};
174 outputSpacePoints->emplace_back(std::move(sp));
176 outputHitSpacePointAssn->addSingle(trhit, apsp);
182 for (
auto it = osp.begin(); it!=osp.end(); ++it ) {
183 outputSpacePoints->emplace_back(std::move(it->first));
185 outputHitSpacePointAssn->addSingle(it->second,apsp);
197 const std::vector<art::Ptr<recob::Shower> >& showers = assocShowers->at(iPfp);
199 if (showers.size()!=1)
continue;
202 std::vector<art::Ptr<recob::Hit> > inHits;
209 for (
unsigned int iShower = 0; iShower < showers.size(); ++iShower) {
215 std::vector<recob::tracking::Point_t> p;
216 std::vector<recob::tracking::Vector_t>
d;
217 for (
unsigned int i=0; i<inHits.size(); ++i) {
225 std::vector<art::Ptr<recob::Hit> > outHits;
231 bool fitok =
trackMaker_->makeTrack(traj, iShower, inHits, outTrack, outHits, optionals);
232 if (!fitok)
continue;
237 throw cet::exception(
"TrackProducerFromPFParticle") <<
"Produced recob::Track required to have 1-1 correspondance between hits and points.\n";
241 outputTracks->emplace_back(std::move(outTrack));
243 outputPfpTAssn->addSingle(pfp, aptr);
245 for (
auto const& trhit: outHits) {
246 outputHits->addSingle(aptr, trhit);
250 const double fXYZ[3] = {tp.X(),tp.Y(),tp.Z()};
251 const double fErrXYZ[6] = {0};
253 outputSpacePoints->emplace_back(std::move(sp));
255 outputHitSpacePointAssn->addSingle(trhit, apsp);
261 for (
auto it = osp.begin(); it!=osp.end(); ++it ) {
262 outputSpacePoints->emplace_back(std::move(it->first));
264 outputHitSpacePointAssn->addSingle(it->second,apsp);
276 e.put(std::move(outputTracks));
277 e.put(std::move(outputHits));
278 e.put(std::move(outputPfpTAssn));
280 e.put(std::move(outputHitInfo));
283 e.put(std::move(outputSpacePoints));
284 e.put(std::move(outputHitSpacePointAssn));
const TVector3 & ShowerStart() const
bool spacePointsFromTrajP_
void initTrackFitInfos()
initialize the output vector of TrackFitHitInfos
art::InputTag pfpInputTag
geo::Point_t Point_t
Type for representation of position in physical 3D space.
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
auto groupByIndex(Groups &&groups, std::size_t index) -> decltype(auto)
Returns the group within groups with the specified index.
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Cluster finding and building.
TrackProducerFromPFParticle(fhicl::ParameterSet const &p)
auto associated_groups(A const &assns)
Helper functions to access associations in order.
void produce(art::Event &e) override
std::unique_ptr< trkmkr::TrackMaker > trackMaker_
#define DEFINE_ART_MODULE(klass)
A trajectory in space reconstructed from hits.
T get(std::string const &key) const
geo::Vector_t Vector_t
Type for representation of momenta in 3D space.
Point_t const & LocationAtPoint(size_t i) const
Returns the position at the specified trajectory point.
const TVector3 & Direction() const
std::vector< PointFlags_t > Flags_t
Type of point flag list.
Declaration of cluster object.
Detector simulation of raw signals on wires.
Produce a reco::Track collection, as a result of the fit of an existing recob::PFParticle collection...
std::vector< SpHitPair > spacePointHitPairs()
get the output vector of SpHitPair by releasing and moving
art::InputTag shwInputTag
std::vector< recob::TrackFitHitInfo > trackFitHitInfos()
get the output vector of TrackFitHitInfos by releasing and moving
Helper functions to access associations in order.
TrackProducerFromPFParticle & operator=(TrackProducerFromPFParticle const &)=delete
art::InputTag trkInputTag
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