Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accommodate breaking changes in geometry #30

Merged
merged 2 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 17 additions & 20 deletions lardata/ArtDataHelper/TrackUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ double lar::util::TrackProjectedLength(recob::Track const& track, geo::View_t vi

auto const* geom = lar::providerFrom<geo::Geometry>();
double angleToVert = 0.;
for (unsigned int i = 0; i < geom->Nplanes(); ++i) {
if (geom->Plane(i).View() == view) {
angleToVert = geom->Plane(i).Wire(0).ThetaZ(false) - 0.5 * ::util::pi<>();
for (auto const& plane : geom->Iterate<geo::PlaneGeo>(geo::CryostatID{0})) {
if (plane.View() == view) {
angleToVert = plane.Wire(0).ThetaZ(false) - 0.5 * ::util::pi<>();
break;
}
}
Expand Down Expand Up @@ -97,19 +97,17 @@ double lar::util::TrackPitchInView(recob::Track const& track,
geo::PlaneGeo const& plane = geom.PositionToTPC(point.position).Plane(view);

#if 0 // this can be enabled after `geo::PlaneGeo::InterWireProjectedDistance()` becomes available in larcorealg
double const d = plane.InterWireProjectedDistance(point.direction());

// do we prefer to just return the value and let the caller check it?
if (d > 50.0 * plane.WirePitch()) { // after many pitches track would scatter
throw cet::exception("Track")
<< "track at point #" << trajectory_point
<< " is almost parallel to the wires in view "
<< geo::PlaneGeo::ViewName(view) << " (wire direction is "
<< plane.GetWireDirection<geo::Vector_t>() << "; track direction is "
<< point.direction()
<< ").\n";
}
return d;
double const d = plane.InterWireProjectedDistance(point.direction());

// do we prefer to just return the value and let the caller check it?
if (d > 50.0 * plane.WirePitch()) { // after many pitches track would scatter
throw cet::exception("Track") << "track at point #" << trajectory_point
<< " is almost parallel to the wires in view "
<< geo::PlaneGeo::ViewName(view) << " (wire direction is "
<< plane.GetWireDirection() << "; track direction is "
<< point.direction() << ").\n";
}
return d;

#else // !0
//
Expand All @@ -125,10 +123,9 @@ double lar::util::TrackPitchInView(recob::Track const& track,
throw cet::exception("Track") << "track at point #" << trajectory_point
<< " is almost parallel to the wires in view "
<< geo::PlaneGeo::ViewName(view) << " (wire direction is "
<< plane.GetWireDirection<geo::Vector_t>()
<< "; track direction is " << point.direction()
<< ", its projection on plane " << plane.ID() << " is " << proj
<< ").\n";
<< plane.GetWireDirection() << "; track direction is "
<< point.direction() << ", its projection on plane " << plane.ID()
<< " is " << proj << ").\n";
}

//
Expand Down
4 changes: 2 additions & 2 deletions lardata/RawData/utils/LArRawInputDriver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ namespace {

digitList[i] =
raw::RawDigit((c1.ch - 1), c1.samples, adclist); //subtract one from ch. number...
//hence offline channels will always be one lower
//than the DAQ480 definition. - mitch 7/8/2009
//hence offline channels will always be one lower
//than the DAQ480 definition. - mitch 7/8/2009
digitList[i].SetPedestal(400.); //carl b assures me this will never change. bjr 4/15/2009
}
//read in footer section of file...though it's currently empty.
Expand Down
2 changes: 1 addition & 1 deletion lardata/RecoObjects/SurfWireLine.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace trkf {

// Update base class.

*static_cast<SurfYZLine*>(this) = SurfYZLine(x, xyz[1], xyz[2], phi);
*static_cast<SurfYZLine*>(this) = SurfYZLine(x, xyz.Y(), xyz.Z(), phi);
}

/// Destructor.
Expand Down
4 changes: 2 additions & 2 deletions lardata/RecoObjects/SurfWireX.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ namespace trkf {

// Update base class.

*static_cast<SurfYZPlane*>(this) = SurfYZPlane(0., xyz[1], xyz[2], phi);
*static_cast<SurfYZPlane*>(this) = SurfYZPlane(0., xyz.Y(), xyz.Z(), phi);
}

/// Destructor.
SurfWireX::~SurfWireX() {}
SurfWireX::~SurfWireX() = default;

} // end namespace trkf
71 changes: 34 additions & 37 deletions lardata/RecoObjects/TrackingPlaneHelper.h
Original file line number Diff line number Diff line change
@@ -1,51 +1,48 @@
#ifndef TRACKINGPLANEHELPER_H
#define TRACKINGPLANEHELPER_H

/// \file lardata/RecoObjects/TrackingPlaneHelper.h
///
/// \author G. Cerati (FNAL, MicroBooNE)
/// \date 2017
/// \version 1.0

#include "TMath.h"
#include "larcorealg/Geometry/WireGeo.h"
#include "lardata/RecoObjects/SurfWireX.h"
#include "lardataobj/RecoBase/TrackingPlane.h"
#include "lardataobj/RecoBase/Trajectory.h"

namespace recob {
namespace tracking {

/// \file lardata/RecoObjects/TrackingPlaneHelper.h
///
/// \author G. Cerati (FNAL, MicroBooNE)
/// \date 2017
/// \version 1.0

/// helper function to construct a recob::tracking::Plane from a Point_t and a Vector_t; the point is on the plane, the vector is orthogonal to the plane.
inline Plane makePlane(recob::tracking::Point_t const& pos,
recob::tracking::Vector_t const& dir)
{
return Plane(pos, dir);
}

/// helper function to construct a recob::tracking::Plane from a recob::Trajectory::TrajectoryPoint_t.
inline Plane makePlane(recob::Trajectory::TrajectoryPoint_t const& s)
{
return Plane(s.position, s.direction());
}

/// helper function to construct a recob::tracking::Plane from a trkf::SurfWireX object.
inline Plane makePlane(trkf::SurfWireX const& s)
{
return Plane(Point_t(s.x0(), s.y0(), s.z0()),
Vector_t(0, -std::sin(s.phi()), std::cos(s.phi())));
}

/// helper function to construct a recob::tracking::Plane from a geo::WireGeo object. The plane will contain the wire and the x axis, assumed to be the drift direction (to be generalized).
inline Plane makePlane(geo::WireGeo const& wgeom)
{
auto xyz = wgeom.GetCenter<Point_t>();
xyz.SetX(0.);
double const phi = TMath::PiOver2() - wgeom.ThetaZ();
return Plane{xyz, Vector_t{0, -std::sin(phi), std::cos(phi)}};
}
namespace recob::tracking {

/// helper function to construct a recob::tracking::Plane from a Point_t and a Vector_t; the point is on the plane, the vector is orthogonal to the plane.
inline Plane makePlane(recob::tracking::Point_t const& pos, recob::tracking::Vector_t const& dir)
{
return Plane(pos, dir);
}

/// helper function to construct a recob::tracking::Plane from a recob::Trajectory::TrajectoryPoint_t.
inline Plane makePlane(recob::Trajectory::TrajectoryPoint_t const& s)
{
return Plane(s.position, s.direction());
}

/// helper function to construct a recob::tracking::Plane from a trkf::SurfWireX object.
inline Plane makePlane(trkf::SurfWireX const& s)
{
return Plane(Point_t(s.x0(), s.y0(), s.z0()),
Vector_t(0, -std::sin(s.phi()), std::cos(s.phi())));
}

/// helper function to construct a recob::tracking::Plane from a geo::WireGeo object. The plane will contain the wire and the x axis, assumed to be the drift direction (to be generalized).
inline Plane makePlane(geo::WireGeo const& wgeom)
{
auto xyz = wgeom.GetCenter();
xyz.SetX(0.);
double const phi = TMath::PiOver2() - wgeom.ThetaZ();
return Plane{xyz, Vector_t{0, -std::sin(phi), std::cos(phi)}};
}

}

#endif