34 #include "canvas/Persistency/Common/FindManyP.h" 69 fStizatch = pset.get<
bool > (
"CommonComponentStitch",
true);
71 produces< std::vector<recob::Track> >();
72 produces<std::vector<art::PtrVector<recob::Track> > >();
73 produces<art::Assns<recob::Track, recob::Hit> >();
74 produces<art::Assns<recob::Track, recob::SpacePoint> >();
75 produces<art::Assns<recob::SpacePoint, recob::Hit> >();
90 std::unique_ptr<std::vector<recob::Track> > tcol(
new std::vector<recob::Track>);
105 mf::LogWarning(
"TrackStitcher") <<
"Trying to read Track3DKalmanXYZ-style PtrVector of std::vector of SpacePoints" <<
std::endl;
108 for (
size_t ii=0; ii<sppth->size() ;ii++)
109 for (
size_t jj=0; jj<sppth->at(ii).size() ;ii++)
112 scol->push_back(sptmp );
117 mf::LogWarning(
"TrackStitcher") <<
"Trying instead to read CosmicTracker-style already-flattened vector of SpacePoints" <<
std::endl;
120 for (
size_t ii=0; ii<sppthf->size() ;ii++)
123 scol->push_back(sptmpf);
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 )
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.";
223 for (
unsigned int ii=0; ii < tcomp.
size(); ++ii )
225 hits.
insert(hits.
end(),hitAssns.at(ii).begin(), hitAssns.at(ii).end());
238 for (
unsigned int ii=0; ii < tcomp.
size(); ++ii )
240 sppts.
insert(sppts.
end(),spptAssns.at(ii).begin(), spptAssns.at(ii).end());
250 std::vector<art::Ptr<recob::Hit>> hits;
253 size_t start(0), finish(0);
254 for (
unsigned int ii=0; ii < sppts.
size(); ++ii )
256 hits.insert(hits.end(),hitAssns.at(ii).begin(), hitAssns.at(ii).end());
257 finish = start+(size_t)(hitAssns.at(ii).end() - hitAssns.at(ii).begin());
258 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());
259 pithit.push_back(pithittmp);
std::vector< art::Ptr< recob::Hit > > GetHitsFromAssdSpacePoints(const art::PtrVector< recob::SpacePoint > &, const art::Event &evt, std::vector< std::pair< std::vector< art::Ptr< recob::Hit > >::const_iterator, std::vector< art::Ptr< recob::Hit > >::const_iterator > > &vpi)
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
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()
EDProducer(fhicl::ParameterSet const &pset)
art::PtrVector< recob::Hit > GetHitsFromComponentTracks(const art::PtrVector< recob::Track > &, const art::Event &evt)
void GetTrackComposites(std::vector< art::PtrVector< recob::Track > > &c) const
TrackStitcher(fhicl::ParameterSet const &pset)
art framework interface to geometry description
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
std::string fSpptModuleLabel
reference at(size_type n)
std::string fTrackModuleLabel
iterator insert(iterator position, Ptr< U > const &p)
Declaration of signal hit object.
art::PtrVector< recob::SpacePoint > GetSpacePointsFromComponentTracks(const art::PtrVector< recob::Track > &, const art::Event &evt)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Provides recob::Track data product.
void produce(art::Event &evt) override
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)