3 #ifndef BEZIERTRACKERMOD_H 4 #define BEZIERTRACKERMOD_H 32 class BezierTrackerAlgorithm;
62 std::unique_ptr<trkf::BezierTrackerAlgorithm>
fBTrackAlg;
108 produces< std::vector<recob::Trajectory> >(
"bezierformat");
109 produces< std::vector<recob::Vertex> >();
110 produces< art::Assns<recob::Trajectory, recob::Hit> >(
"bezierformat");
111 produces< art::Assns<recob::Cluster, recob::Trajectory> >(
"bezierformat");
112 produces< art::Assns<recob::Trajectory, recob::Vertex> >(
"bezierformat");
114 produces< std::vector<recob::Trajectory> >();
115 produces< art::Assns<recob::Trajectory, recob::Hit> >();
116 produces< art::Assns<recob::Cluster, recob::Trajectory> >();
117 produces< art::Assns<recob::Trajectory, recob::Vertex> >();
121 BezierTrackerModule::~BezierTrackerModule()
127 fClusterModuleLabel = pset.
get<std::string>(
"ClusterModuleLabel");
128 fTrajPtPitch = pset.
get<
double>(
"TrajPtPitch",0.1);
143 std::unique_ptr< std::vector<recob::Trajectory > > btracks (
new std::vector<recob::Trajectory>);
144 std::unique_ptr< std::vector<recob::Vertex > > vertices (
new std::vector<recob::Vertex>);
149 std::unique_ptr< std::vector<recob::Trajectory > > ub_tracks (
new std::vector<recob::Trajectory>);
154 std::vector<trkf::BezierTrack > BTracks;
156 std::vector<art::PtrVector<recob::Hit> > HitsForAssns;
159 std::vector< std::vector<art::PtrVector<recob::Hit> > > SortedHits;
161 GetHitsFromClusters(fClusterModuleLabel, evt, SortedHits,ClusterMap);
164 std::vector<std::vector<std::pair<int, int> > > ClustersUsed;
165 BTracks = fBTrackAlg->MakeTracks(SortedHits, HitsForAssns, ClustersUsed);
168 fBTrackAlg->FilterOverlapTracks( BTracks, HitsForAssns, ClustersUsed );
169 fBTrackAlg->SortTracksByLength( BTracks, HitsForAssns, ClustersUsed );
170 fBTrackAlg->MakeOverlapJoins( BTracks, HitsForAssns, ClustersUsed );
171 fBTrackAlg->SortTracksByLength( BTracks, HitsForAssns, ClustersUsed );
172 fBTrackAlg->MakeDirectJoins( BTracks, HitsForAssns, ClustersUsed );
173 fBTrackAlg->FilterOverlapTracks( BTracks, HitsForAssns, ClustersUsed );
176 std::vector<recob::Vertex> Vertices;
177 std::vector<std::vector<int> > VertexMapping;
178 fBTrackAlg->MakeVertexJoins(BTracks, Vertices, VertexMapping);
180 for(
size_t i=0; i!=BTracks.size(); ++i)
183 btracks->push_back(BTracks.at(i).GetTrajectory());
185 std::vector<TVector3> track_xyz,track_dir;
186 BTracks.at(i).FillTrackVectors(track_xyz,track_dir,fTrajPtPitch);
190 util::CreateAssn(*
this, evt, *(btracks.get()), HitsForAssns.at(i), *(assnhit.get()));
191 util::CreateAssn(*
this, evt, *(ub_tracks), HitsForAssns.at(i), *(assnhit.get()));
195 for(
size_t v=0; v!=Vertices.size(); ++v)
197 vertices->push_back(Vertices.at(v));
198 for(
size_t t=0; t!=VertexMapping.at(v).size(); ++t)
200 util::CreateAssn(*
this, evt, *(btracks), *(vertices), *(assnvtx.get()), v, v, VertexMapping[v][t]);
201 util::CreateAssn(*
this, evt, *(ub_tracks), *(vertices), *(assnvtx.get()), v, v, VertexMapping[v][t]);
206 std::vector<art::Ptr<recob::Cluster> > Clusters;
209 evt.
getByLabel(fClusterModuleLabel, clusterh);
215 for(
size_t t=0; t!=btracks->size(); ++t)
217 for(
size_t i=0; i!=ClustersUsed[t].size(); ++i)
219 int View = ClustersUsed[t][i].first;
220 int Index = ClustersUsed[t][i].second;
222 util::CreateAssn(*
this, evt, *(btracks), Clusters.at(ClusterID), *(assnclus.get()), t);
223 util::CreateAssn(*
this, evt, *(ub_tracks), Clusters.at(ClusterID), *(assnclus.get()), t);
228 mf::LogVerbatim(
"BezierTrackerAlgorithm")<<
"Storing in evt - check"<<std::endl;
229 evt.
put(std::move(btracks),
"bezierformat");
230 evt.
put(std::move(vertices));
231 evt.
put(std::move(assnhit),
"bezierformat");
232 evt.
put(std::move(assnvtx),
"bezierformat");
233 evt.
put(std::move(assnclus),
"bezierformat");
235 evt.
put(std::move(ub_tracks));
236 evt.
put(std::move(ub_assnhit));
237 evt.
put(std::move(ub_assnvtx));
238 evt.
put(std::move(ub_assnclus));
243 for(
size_t i=0; i!=HitsForAssns.size(); ++i)
244 HitsForAssns.at(i).clear();
245 HitsForAssns.clear();
257 std::vector<art::Ptr<recob::Cluster> > Clusters;
268 for(
size_t iclus = 0; iclus < Clusters.size(); ++iclus) {
271 std::vector< art::Ptr<recob::Hit> > ihits = fm.at(iclus);
275 i != ihits.end(); ++i)
278 int View = ThisCluster->
View();
279 ClusterMap[View][ReturnVec[View].size()] = iclus;
280 ReturnVec[View].push_back(HitsThisCluster);
287 void BezierTrackerModule::endJob()
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
Data product for reconstructed trajectory in space.
Reconstruction base classes.
std::map< int, art::Ptr< recob::Cluster > > ClusterMap
Declaration of signal hit object.
std::string fClusterModuleLabel
ProductID put(std::unique_ptr< PROD > &&product)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
#define DEFINE_ART_MODULE(klass)
void push_back(Ptr< U > const &p)
std::vector< geo::Point_t > convertCollToPoint(std::vector< Point > const &coll)
T get(std::string const &key) const
Utilities to extend the interface of geometry vectors.
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.
Declaration of cluster object.
geo::View_t View() const
Returns the view for this cluster.
Utility object to perform functions of association.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
std::vector< geo::Vector_t > convertCollToVector(std::vector< Vector > const &coll)
std::unique_ptr< trkf::BezierTrackerAlgorithm > fBTrackAlg
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
art framework interface to geometry description