95 else if ((track.
End().X() > 0 && track.
End().X() < (0 +
fXBuffer)) ||
123 double min_distance = 9e12;
133 if (tmp < min_distance) min_distance =
tmp;
135 return std::sqrt(min_distance);
141 double min_distance = 9e12;
150 if (tmp < min_distance) min_distance =
tmp;
152 return std::sqrt(min_distance);
162 std::vector<std::vector<recob::Track>>
const& tracksVec,
167 std::cout <<
"Geometry:" << std::endl;
177 int containment_level = 0;
178 bool track_linked =
false;
193 for (
size_t i_tc = 0; i_tc < tracksVec.size(); ++i_tc) {
197 for (
size_t i_t = 0; i_t < tracksVec[i_tc].size(); ++i_t) {
200 if (!track_linked) track_linked =
true;
204 std::cout <<
"\tTrack (" << i_tc <<
"," << i_t <<
")" 205 <<
" " << containment_level << std::endl;
215 while (track_linked) {
217 track_linked =
false;
221 for (
size_t i_tc = 0; i_tc < tracksVec.size(); ++i_tc) {
222 for (
size_t i_t = 0; i_t < tracksVec[i_tc].size(); ++i_t) {
239 if (
MinDistanceEndPt(tracksVec[i_tc][i_t], tracksVec[i_tr.first][i_tr.second]) <
246 MinDistanceEndPt(tracksVec[i_tc][i_t], tracksVec[i_tr.first][i_tr.second]) <
248 if (!track_linked) track_linked =
true;
253 std::cout <<
"\tTrackPair (" << i_tc <<
"," << i_t <<
") and (" << i_tr.first <<
"," 254 << i_tr.second <<
")" 255 <<
" " << containment_level << std::endl;
268 if (
fDebug) std::cout <<
"All done! Now let's make the tree and tags!" << std::endl;
271 for (
size_t i_tc = 0; i_tc < tracksVec.size(); ++i_tc) {
272 for (
size_t i_t = 0; i_t < tracksVec[i_tc].size(); ++i_t) {
301 (float)tracksVec[i_tc][i_t].
Vertex().Y(),
302 (float)tracksVec[i_tc][i_t].
Vertex().Z()},
303 std::vector<float>{(float)tracksVec[i_tc][i_t].End().X(),
304 (float)tracksVec[i_tc][i_t].End().Y(),
305 (float)tracksVec[i_tc][i_t].End().Z()},
312 std::cout <<
"Track (" << i_tc <<
"," << i_t <<
")" 315 auto const&
vertex = tracksVec[i_tc][i_t].Vertex();
316 std::cout <<
"\tS_(X,Y,Z) = (" <<
vertex.X() <<
"," <<
vertex.Y() <<
"," <<
vertex.Z()
318 std::cout <<
"\tNearest wire ..." << std::endl;
319 for (
unsigned int i_p = 0; i_p < geo.
Nplanes(); ++i_p)
320 std::cout <<
"\t\tPlane " << i_p <<
" " 323 auto const&
end = tracksVec[i_tc][i_t].End();
324 std::cout <<
"\tE_(X,Y,Z) = (" <<
end.X() <<
"," <<
end.Y() <<
"," <<
end.Z() <<
")\n";
325 std::cout <<
"\tNearest wire ..." << std::endl;
326 for (
unsigned int i_p = 0; i_p < geo.
Nplanes(); ++i_p)
327 std::cout <<
"\t\tPlane " << i_p <<
" " 329 std::cout <<
"\tLength=" << tracksVec[i_tc][i_t].Length() << std::endl;
330 std::cout <<
"\tSimple_length=" << (
end -
vertex).R() << std::endl;
344 <<
"Cosmic tags not created. Set MakeCosmicTags to true in fcl paramters.";
double MinDistanceStartPt(recob::Track const &, recob::Track const &)
void ProcessTracks(std::vector< std::vector< recob::Track >> const &, geo::GeometryCore const &)
std::vector< std::vector< std::pair< int, int > > > fTrackContainmentIndices
enum anab::cosmic_tag_id CosmicTagID_t
Point_t const & LocationAtPoint(size_t i) const
Access to track position at different points.
Length_t DetHalfWidth(TPCID const &tpcid=tpc_zero) const
Returns the half width of the active volume of the specified TPC.
The data type to uniquely identify a Plane.
void SetupOutputTree(TTree *)
std::vector< std::vector< anab::CosmicTag > > fCosmicTags
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
WireID_t Wire
Index of the wire within its plane.
anab::CosmicTagID_t GetCosmicTagID(recob::Track const &, geo::GeometryCore const &)
Length_t DetLength(TPCID const &tpcid=tpc_zero) const
Returns the length of the active volume of the specified TPC.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Access the description of detector geometry.
struct trk::TrackTree TrackTree_t
std::vector< std::vector< int > > fTrackContainmentLevel
T get(std::string const &key) const
Point_t const & Vertex() const
Access to track position at different points.
void Configure(fhicl::ParameterSet const &)
void SetRunEvent(unsigned int const &, unsigned int const &)
Description of geometry of one entire detector.
double MinDistanceEndPt(recob::Track const &, recob::Track const &)
std::vector< std::vector< double > > fMinDistances
WireID NearestWireID(Point_t const &point, PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
std::vector< std::vector< anab::CosmicTag > > const & GetTrackCosmicTags()
TrackContainmentAlg()
Default constructor.
Point_t const & End() const
Access to track position at different points.
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
TrackTree_t fTrackTreeObj
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Length_t DetHalfHeight(TPCID const &tpcid=tpc_zero) const
Returns the half height of the active volume of the specified TPC.
Namespace collecting geometry-related classes utilities.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
bool IsContained(recob::Track const &, geo::GeometryCore const &)
cet::coded_exception< error, detail::translate > exception
Event finding and building.