56 if (
m_y == p.getY())
return std::abs(
m_x - p.getX());
58 else if (
m_x == p.getX())
return std::abs(
m_y - p.getY());
60 else return std::sqrt((
m_x - p.getX()) * (
m_x - p.getX()) +
61 (
m_y - p.getY()) * (
m_y - p.getY()));
101 if (p1.getX() == p2.getX()) {
105 m_m = (p1.getY() - p2.getY()) / (p1.getX() - p2.getX());
121 B2WARNING(
"Lines are parallel, will not intersect...");
125 }
else if (
m_m == 0.0) {
128 }
else if (l.
m_m == 0.0) {
218 std::vector<DedxPoint> endpoints;
220 endpoints.push_back(intLeft);
222 endpoints.push_back(intTop);
224 endpoints.push_back(intRight);
226 endpoints.push_back(intBot);
229 if (endpoints.size() == 2) {
230 Dx = endpoints[0].
length(endpoints[1]);
241 double dx(
double doca,
double entAng)
248 const DedxPoint poca =
DedxPoint(doca * std::abs(std::cos(entAng)), -1.0 * doca * std::sin(entAng));
257 std::vector< DedxPoint > endpoints;
259 endpoints.push_back(intLeft);
261 endpoints.push_back(intTop);
263 endpoints.push_back(intRight);
265 endpoints.push_back(intBot);
268 if (endpoints.size() == 2) {
269 Dx = endpoints[0].
length(endpoints[1]);
A class to hold the geometry of a cell.
DedxLine m_Right
the left boundary of the cell
DedxLine m_Top
the left boundary of the cell
double dx(const DedxPoint &poca, double entAng)
Calculate the path length through this cell for a track with a given DedxPoint Of Closest Approach (p...
DedxDriftCell(const DedxPoint &tl, const DedxPoint &tr, const DedxPoint &br, const DedxPoint &bl)
Construct a DedxDriftCell from four different DedxPoints (corners)
DedxLine m_Left
the left boundary of the cell
double dx(double doca, double entAng)
Calculate the path length through this cell for a track with a given Distance Of Closest Approach (do...
DedxDriftCell(const DedxLine &left, const DedxLine &top, const DedxLine &right, const DedxLine &bot)
Construct a DedxDriftCell from four different DedxLines (sides)
DedxLine m_Bot
the left boundary of the cell
bool m_isValid
does the hit land in this cell
bool isValid()
Check if this is a valid calculation (number of intersections = 2)
A class to hold the endpoints and slope of a line.
int m_vertical
If the line is vertical, this is set to true.
DedxPoint m_p2
Second endpoint.
DedxLine(const DedxPoint &p1, const DedxPoint &p2)
Construct a DedxLine from two DedxPoints.
void setVertical()
Mark this DedxLine as being vertical.
DedxPoint intersection(const DedxLine &l)
Find the intersection of this and another line.
double getSlope() const
Helper function to return the slope.
bool isVertical() const
The m_vertical flag is used for the special case of a vertical line.
DedxLine(const DedxPoint &p, const double slope)
Construct a DedxLine from the given DedxPoint and slope.
DedxLine()
A line is definied either by a point and a slope, or by endpoints.
double m_m
Slope of the line.
DedxPoint m_p1
First endpoint.
A collection of classes that are useful for making a simple path length correction to the dE/dx measu...
void setInvalid()
Mark this point as invalid (exists outside a DedxDriftCell)
double getX() const
Helper function to return the x-coordinates of a DedxPoint.
bool isValid() const
Check whether this point lies within the endpoints of a line.
double m_x
the x-coordinate of the DedxPoint
DedxPoint()
The default constructor sets the coordinates to zero.
bool m_valid
used to check if the point lies inside a boundary
void setPoint(double x, double y)
Set the x and y coordinates of a DedxPoint.
double getY() const
Helper function to return the y-coordinates of a DedxPoint.
double length(const DedxPoint &p)
Calculate the distance between this and another point.
double m_y
the y-coordinate of the DedxPoint
DedxPoint(double x, double y)
Construct a point DedxPoint object from x and y coordinates.
Abstract base class for different kinds of events.