21 #include "cetlib_except/exception.h" 35 throw cet::exception(
"TrackProjectedLength") <<
"cannot provide projected length for " 40 auto const* geom = lar::providerFrom<geo::Geometry>();
41 double angleToVert = 0.;
42 for(
unsigned int i = 0; i < geom->Nplanes(); ++i){
43 if(geom->Plane(i).View() == view){
44 angleToVert = geom->Plane(i).Wire(0).ThetaZ(
false) - 0.5*::util::pi<>();
55 double dist = std::sqrt( std::pow(pos_cur.x() - pos_prev.x(), 2) +
56 std::pow(pos_cur.y() - pos_prev.y(), 2) +
57 std::pow(pos_cur.z() - pos_prev.z(), 2) );
62 double cosgamma = std::abs(std::sin(angleToVert)*dir_prev.Y() +
63 std::cos(angleToVert)*dir_prev.Z() );
66 length += dist/cosgamma;
80 throw cet::exception(
"TrackPitchInView") <<
"Warning cannot obtain pitch for unknown view\n";
84 cet::exception(
"TrackPitchInView") <<
"ERROR: Asking for trajectory point #" 85 << trajectory_point <<
" when trajectory vector size is of size " 89 auto const* geom = lar::providerFrom<geo::Geometry>();
91 const double Position[3] = { pos.X(), pos.Y(), pos.Z() };
92 geo::TPCID tpcid = geom->FindTPCAtPosition ( Position );
94 cet::exception(
"TrackPitchInView") <<
"ERROR: invalid TPC " << std::string(tpcid)
95 <<
" for trajectory point #" << trajectory_point <<
".\n";
97 double wirePitch = geom->WirePitch(view, tpcid.
TPC, tpcid.
Cryostat);
98 double angleToVert = geom->WireAngleToVertical(view, tpcid.
TPC, tpcid.
Cryostat) - 0.5*::util::pi<>();
102 double cosgamma = std::abs(std::sin(angleToVert)*dir.Y() +
103 std::cos(angleToVert)*dir.Z());
106 throw cet::exception(
"Track") <<
"cosgamma is basically 0, that can't be right\n";
107 return wirePitch/cosgamma;
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Point_t const & LocationAtPoint(size_t i) const
Access to track position at different points.
bool isValid
Whether this ID points to a valid element.
double TrackProjectedLength(recob::Track const &track, geo::View_t view)
Returns the length of the projection of a track on a view.
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
CryostatID_t Cryostat
Index of cryostat.
Provides recob::Track data product.
The data type to uniquely identify a TPC.
Encapsulate the geometry of a wire.
Encapsulate the construction of a single detector plane.
Vector_t DirectionAtPoint(size_t i) const
Access to track direction at different points.
double TrackPitchInView(recob::Track const &track, geo::View_t view, size_t trajectory_point=0)
Provides projected wire pitch for the view.
TPCID_t TPC
Index of the TPC within its cryostat.
Utility functions to extract information from recob::Track.
art framework interface to geometry description
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
cet::coded_exception< error, detail::translate > exception