40 auto const& tpc = geo.
TPC({0, 0});
47 if (track.
End().Y() < (-1 * tpc.HalfHeight() +
fYBuffer) ||
61 auto const& tpc = geo.
TPC({0, 0});
67 else if (track.
Vertex().Y() < (-1 * tpc.HalfHeight() +
fYBuffer) ||
71 (track.
Vertex().X() < 2 * tpc.HalfWidth() &&
85 else if (track.
End().Y() < (-1 * tpc.HalfHeight() +
fYBuffer) ||
96 else if ((track.
End().X() > 0 && track.
End().X() < (0 +
fXBuffer)) ||
97 (track.
End().X() < 2 * tpc.HalfWidth() &&
98 track.
End().X() > (2 * tpc.HalfWidth() -
fXBuffer))) {
109 if (track.
Vertex().X() < 0 || track.
Vertex().X() > 2 * tpc.HalfWidth())
111 if (track.
End().X() < 0 || track.
End().X() > 2 * tpc.HalfWidth()) {
124 double min_distance = 9e12;
127 if (distance < min_distance) min_distance = distance;
129 return std::sqrt(min_distance);
135 double min_distance = 9e12;
138 if (distance < min_distance) min_distance = distance;
140 return std::sqrt(min_distance);
150 std::vector<std::vector<recob::Track>>
const& tracksVec,
154 auto const& tpc = geo.
TPC({0, 0});
157 std::cout <<
"Geometry:" << std::endl;
158 std::cout <<
"\t" << tpc.
HalfWidth() <<
" " << tpc.HalfHeight() <<
" " << tpc.Length()
161 <<
"\t y:(" << -1. * tpc.HalfHeight() +
fYBuffer <<
"," << tpc.HalfHeight() -
fYBuffer 167 int containment_level = 0;
168 bool track_linked =
false;
183 for (
size_t i_tc = 0; i_tc < tracksVec.size(); ++i_tc) {
187 for (
size_t i_t = 0; i_t < tracksVec[i_tc].size(); ++i_t) {
190 if (!track_linked) track_linked =
true;
194 std::cout <<
"\tTrack (" << i_tc <<
"," << i_t <<
")" 195 <<
" " << containment_level << std::endl;
205 while (track_linked) {
207 track_linked =
false;
211 for (
size_t i_tc = 0; i_tc < tracksVec.size(); ++i_tc) {
212 for (
size_t i_t = 0; i_t < tracksVec[i_tc].size(); ++i_t) {
222 if (
MinDistanceEndPt(tracksVec[i_tc][i_t], tracksVec[i_tr.first][i_tr.second]) <
229 MinDistanceEndPt(tracksVec[i_tc][i_t], tracksVec[i_tr.first][i_tr.second]) <
231 if (!track_linked) track_linked =
true;
236 std::cout <<
"\tTrackPair (" << i_tc <<
"," << i_t <<
") and (" << i_tr.first <<
"," 237 << i_tr.second <<
")" 238 <<
" " << containment_level << std::endl;
251 if (
fDebug) std::cout <<
"All done! Now let's make the tree and tags!" << std::endl;
254 for (
size_t i_tc = 0; i_tc < tracksVec.size(); ++i_tc) {
255 for (
size_t i_t = 0; i_t < tracksVec[i_tc].size(); ++i_t) {
284 (float)tracksVec[i_tc][i_t].
Vertex().Y(),
285 (float)tracksVec[i_tc][i_t].
Vertex().Z()},
286 std::vector<float>{(float)tracksVec[i_tc][i_t].End().X(),
287 (float)tracksVec[i_tc][i_t].End().Y(),
288 (float)tracksVec[i_tc][i_t].End().Z()},
295 std::cout <<
"Track (" << i_tc <<
"," << i_t <<
")" 298 auto const&
vertex = tracksVec[i_tc][i_t].Vertex();
299 std::cout <<
"\tS_(X,Y,Z) = (" <<
vertex.X() <<
"," <<
vertex.Y() <<
"," <<
vertex.Z()
301 std::cout <<
"\tNearest wire ..." << std::endl;
302 for (
unsigned int i_p = 0; i_p < wireReadoutGeom.
Nplanes(); ++i_p) {
303 auto const& plane = wireReadoutGeom.
Plane({0, 0, i_p});
307 auto const&
end = tracksVec[i_tc][i_t].End();
308 std::cout <<
"\tE_(X,Y,Z) = (" <<
end.X() <<
"," <<
end.Y() <<
"," <<
end.Z() <<
")\n";
309 std::cout <<
"\tNearest wire ..." << std::endl;
310 for (
unsigned int i_p = 0; i_p < wireReadoutGeom.
Nplanes(); ++i_p) {
311 auto const& plane = wireReadoutGeom.
Plane({0, 0, i_p});
314 std::cout <<
"\tLength=" << tracksVec[i_tc][i_t].Length() << std::endl;
315 std::cout <<
"\tSimple_length=" << (
end -
vertex).R() << std::endl;
327 <<
"Cosmic tags not created. Set MakeCosmicTags to true in fcl paramters.";
double MinDistanceStartPt(recob::Track const &, recob::Track const &)
std::vector< std::vector< std::pair< int, int > > > fTrackContainmentIndices
WireID NearestWireID(Point_t const &pos) const
Returns the ID of wire closest to the specified position.
enum anab::cosmic_tag_id CosmicTagID_t
Point_t const & LocationAtPoint(size_t i) const
Access to track position at different points.
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 &)
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 the physical detector geometry.
struct trk::TrackTree TrackTree_t
std::vector< std::vector< int > > fTrackContainmentLevel
Interface for a class providing readout channel mapping to geometry.
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 the physical geometry of one entire detector.
double MinDistanceEndPt(recob::Track const &, recob::Track const &)
unsigned int Nplanes(TPCID const &tpcid=details::tpc_zero) const
Returns the total number of planes in the specified TPC.
std::vector< std::vector< double > > fMinDistances
std::vector< std::vector< anab::CosmicTag > > const & GetTrackCosmicTags()
void ProcessTracks(std::vector< std::vector< recob::Track >> const &, geo::GeometryCore const &, geo::WireReadoutGeom const &)
TrackContainmentAlg()
Default constructor.
Point_t const & End() const
Access to track position at different points.
TrackTree_t fTrackTreeObj
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
TPCGeo const & TPC(TPCID const &tpcid=details::tpc_zero) const
Returns the specified TPC.
Interface to geometry for wire readouts .
double HalfWidth() const
Width is associated with x coordinate [cm].
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.