84 art::ServiceHandle<geo::Geometry const> geom;
90 std::unique_ptr<std::vector<recob::Track> > tcol(
new std::vector<recob::Track>);
91 std::unique_ptr<art::PtrVector<recob::SpacePoint> > scol(
new art::PtrVector<recob::SpacePoint>);
93 std::unique_ptr<std::vector< art::PtrVector<recob::Track> > > tvcol(
new std::vector< art::PtrVector<recob::Track> >);
94 std::unique_ptr< art::Assns<recob::Track, recob::Hit> > thassn(
new art::Assns<recob::Track, recob::Hit>);
95 std::unique_ptr< art::Assns<recob::Track, recob::SpacePoint> > tsptassn(
new art::Assns<recob::Track, recob::SpacePoint>);
96 std::unique_ptr< art::Assns<recob::SpacePoint, recob::Hit > > spthassn(
new art::Assns<recob::SpacePoint, recob::Hit>);
102 art::Handle< std::vector < recob::SpacePoint > > sppth;
105 mf::LogWarning(
"TrackStitcher") <<
"Trying to read Track3DKalmanXYZ-style PtrVector of std::vector of SpacePoints" << std::endl;
106 art::Handle< std::vector < art::PtrVector <recob::SpacePoint> > > sppth;
108 for (
size_t ii=0; ii<sppth->size() ;ii++)
109 for (
size_t jj=0; jj<sppth->at(ii).size() ;ii++)
111 art::Ptr<recob::SpacePoint> sptmp(sppth->at(ii).at(jj));
112 scol->push_back(sptmp );
117 mf::LogWarning(
"TrackStitcher") <<
"Trying instead to read CosmicTracker-style already-flattened vector of SpacePoints" << std::endl;
118 art::Handle< std::vector < recob::SpacePoint > > sppthf;
120 for (
size_t ii=0; ii<sppthf->size() ;ii++)
122 art::Ptr<recob::SpacePoint> sptmpf(sppthf,ii);
123 scol->push_back(sptmpf);
139 mf::LogVerbatim(
"TrackStitcher.beginning") <<
"There are " <<
fStitchAlg.
ftListHandle->size() <<
" Tracks in this event before stitching.";
144 if (tcol->size()!=tvcol->size())
145 throw cet::exception(
"TrackStitcher") <<
"Tracks and TrackComposites do not match: "<<tcol->size()<<
" vs "<<tvcol->size()<<
"\n";
147 std::vector<size_t> spIndices(scol->size());
149 for (
size_t ii=0; ii<scol->size(); ii++ )
152 for (
size_t ii=0; ii<tvcol->size(); ii++)
164 std::vector<std::pair<std::vector<art::Ptr<recob::Hit> >::const_iterator, std::vector<art::Ptr<recob::Hit> >::const_iterator > > pits;
166 std::vector<art::Ptr<recob::Hit>> hitsFromSppts;
169 size_t start(0), finish(0);
170 for (
unsigned int ii=0; ii < sppts.size(); ++ii )
172 hitsFromSppts.insert(hitsFromSppts.end(),hitAssns.at(ii).begin(), hitAssns.at(ii).end());
173 finish = start+(size_t)(hitAssns.at(ii).end() - hitAssns.at(ii).begin());
174 std::pair< std::vector<art::Ptr<recob::Hit> >::const_iterator, std::vector<art::Ptr<recob::Hit> >::const_iterator > pithittmp(hitAssns.at(ii).begin(),hitAssns.at(ii).end());
175 pits.push_back(pithittmp);
180 for (
size_t jj=0; jj<sppts.size(); jj++ )
183 size_t ll(scol->size());
187 for (
auto& kk : spIndices )
189 const art::Ptr<recob::SpacePoint> spptnc(scol->at(kk));
190 if ( spptnc != sppts.at(jj)) { off++;
continue;}
199 std::vector <art::Ptr <recob::Hit> > hitsThisSppt;
200 hitsThisSppt.insert(hitsThisSppt.begin(),pits.at(jj).first,pits.at(jj).second);
207 mf::LogVerbatim(
"TrackStitcher.end") <<
"There are " << tvcol->size() <<
" Tracks in this event after stitching.";
208 evt.put(std::move(tcol));
209 evt.put(std::move(tvcol));
211 evt.put(std::move(thassn));
212 evt.put(std::move(tsptassn));
213 evt.put(std::move(spthassn));
void GetTracks(std::vector< recob::Track > &t) const
art::Handle< std::vector< recob::Track > > ftListHandle
void FindHeadsAndTails(const art::Event &e, const std::string &t)
bool CommonComponentStitch()
art::PtrVector< recob::Hit > GetHitsFromComponentTracks(const art::PtrVector< recob::Track > &, const art::Event &evt)
void GetTrackComposites(std::vector< art::PtrVector< recob::Track > > &c) const
std::size_t size(FixedBins< T, C > const &) noexcept
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::string fSpptModuleLabel
std::string fTrackModuleLabel
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
art::PtrVector< recob::SpacePoint > GetSpacePointsFromComponentTracks(const art::PtrVector< recob::Track > &, const art::Event &evt)