1 #ifndef TRK_TRACKCONTAINMENTALG_CXX 2 #define TRK_TRACKCONTAINMENTALG_CXX 112 double min_distance = 9e12;
123 return std::sqrt(min_distance);
128 double min_distance = 9e12;
138 return std::sqrt(min_distance);
152 std::cout <<
"Geometry:" << std::endl;
160 int containment_level=0;
161 bool track_linked =
false;
162 std::size_t n_tracks=0;
177 for(
size_t i_tc=0; i_tc<tracksVec.size(); ++i_tc){
181 n_tracks += tracksVec[i_tc].size();
182 for(
size_t i_t=0; i_t<tracksVec[i_tc].size(); ++i_t){
185 if(!track_linked) track_linked=
true;
189 std::cout <<
"\tTrack (" << i_tc <<
"," << i_t <<
")" 190 <<
" " << containment_level << std::endl;
208 for(
size_t i_tc=0; i_tc<tracksVec.size(); ++i_tc){
209 for(
size_t i_t=0; i_t<tracksVec[i_tc].size(); ++i_t){
230 if(!track_linked) track_linked=
true;
235 std::cout <<
"\tTrackPair (" << i_tc <<
"," << i_t <<
") and (" << i_tr.first <<
"," << i_tr.second <<
")" 236 <<
" " << containment_level << std::endl;
251 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){
283 anab::CosmicTag(std::vector<float>{(float)tracksVec[i_tc][i_t].Vertex().X(),
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 std::cout <<
"\tS_(X,Y,Z) = (" 299 << tracksVec[i_tc][i_t].Vertex().X() <<
"," 300 << tracksVec[i_tc][i_t].Vertex().Y() <<
"," 301 << tracksVec[i_tc][i_t].Vertex().Z() <<
")" << std::endl;
302 std::cout <<
"\tNearest wire ..." << std::endl;
303 for(
size_t i_p=0; i_p<geo.
Nplanes(); ++i_p)
304 std::cout <<
"\t\tPlane " << i_p <<
" " << geo.
NearestWireID(tracksVec[i_tc][i_t].Vertex(),i_p).Wire << std::endl;
305 std::cout <<
"\tE_(X,Y,Z) = (" 306 << tracksVec[i_tc][i_t].End().X() <<
"," 307 << tracksVec[i_tc][i_t].End().Y() <<
"," 308 << tracksVec[i_tc][i_t].End().Z() <<
")" << std::endl;
309 std::cout <<
"\tNearest wire ..." << std::endl;
310 for(
size_t i_p=0; i_p<geo.
Nplanes(); ++i_p)
311 std::cout <<
"\t\tPlane " << i_p <<
" " << geo.
NearestWireID(tracksVec[i_tc][i_t].End(),i_p).Wire << std::endl;
312 std::cout <<
"\tLength=" << tracksVec[i_tc][i_t].Length() << std::endl;
313 std::cout <<
"\tSimple_length=" << (tracksVec[i_tc][i_t].End()-tracksVec[i_tc][i_t].Vertex()).
R() << std::endl;
328 <<
"Cosmic tags not created. Set MakeCosmicTags to true in fcl paramters.";
std::vector< std::vector< int > > fTrackContainmentLevel
double MinDistanceStartPt(recob::Track const &, recob::Track const &)
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
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< double > > fMinDistances
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
anab::CosmicTagID_t GetCosmicTagID(recob::Track const &, geo::GeometryCore const &)
typename BeginEndPackage< L >::End End
void ProcessTracks(std::vector< std::vector< recob::Track > > const &, geo::GeometryCore const &)
std::vector< std::vector< std::pair< int, int > > > fTrackContainmentIndices
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Access the description of detector geometry.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
struct trk::TrackTree TrackTree_t
T get(std::string const &key) const
Point_t const & Vertex() const
Access to track position at different points.
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
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< anab::CosmicTag > > fCosmicTags
std::vector< std::vector< anab::CosmicTag > > const & GetTrackCosmicTags()
TrackContainmentAlg()
Default constructor.
Point_t const & End() const
Access to track position at different points.
geo::WireID NearestWireID(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
TrackTree_t fTrackTreeObj
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.