42 const bool& debugMode =
false
46 if (fabs(lineA.
m - lineB.
m) <= 0.01*(lineA.
err_m + lineB.
err_m))
48 if (fabs(lineA.
c - lineB.
c) > (lineA.
err_c + lineB.
err_c))
53 std::cerr<<
"The lines are almost parallel (within given uncertainties) and don't intersect.\n";
54 std::cerr<<
"fabs(mA - mB) = "<<fabs(lineA.
m - lineB.
m)<<endl;
55 std::cerr<<
"Err_mA + Err_mB = "<<lineA.
err_m + lineB.
err_m<<endl;
63 double x = (lineB.
c - lineA.
c) / (lineA.
m - lineB.
m);
64 double y = lineA.
m * x + lineA.
c;
73 const std::vector<Line::FitLine2D>& linesB,
74 const bool& debugMode =
false)
76 std::vector<bool> vResults;
77 std::vector<IntersectionPoint3D> vPoints;
79 for (
size_t i = 0; i < 3; ++i)
90 printf(
"----> No intersection found.");
94 printf(
"----> Intersection point found at (%s, %s) = %8.3f, %8.3f\n",
112 std::cout<<
"Saved 3D intersection points:\n";
113 printf(
"%s: %8.3f, %8.3f, %8.3f\n", vPoints[0].FitPlane.c_str(), vPoints[0].x, vPoints[0].y, vPoints[0].z);
114 printf(
"%s: %8.3f, %8.3f, %8.3f\n", vPoints[1].FitPlane.c_str(), vPoints[1].x, vPoints[1].y, vPoints[1].z);
115 printf(
"%s: %8.3f, %8.3f, %8.3f\n", vPoints[2].FitPlane.c_str(), vPoints[2].x, vPoints[2].y, vPoints[2].z);
137 printf(
"Checked for following conditions:\n");
138 printf(
"%s: fabs(%8.3f - %8.3f) < %f cm: TRUE\n", vPoints[0].FitPlane.c_str(), vPoints.at(0).x, vPoints.at(2).x,
INTERSECTION_MAX_TOLERANCE);
139 printf(
"%s: fabs(%8.3f - %8.3f) < %f cm: TRUE\n", vPoints[1].FitPlane.c_str(), vPoints.at(1).y, vPoints.at(2).y,
INTERSECTION_MAX_TOLERANCE);
140 printf(
"%s: fabs(%8.3f - %8.3f) < %f cm: TRUE\n", vPoints[2].FitPlane.c_str(), vPoints.at(0).z, vPoints.at(1).z,
INTERSECTION_MAX_TOLERANCE);
144 if (vPoints.at(0).z > 145 && vPoints.at(0).z < 150)
145 printf(
"\n\n\nFound interaction just above TRD: %8.3f cm\n", vPoints.at(0).z);
174 for (
unsigned int i = 0; i < vvFittedTracks.size()-1; ++i)
176 for (
unsigned int j = i + 1; j < vvFittedTracks.size(); ++j)
180 printf(
"\n\nChecking for fitted line pair (%d, %d), g3PID's (%d, %d), trkID's (%d, %d):\n",
181 i, j, vvFittedTracks[i][0].g3PID, vvFittedTracks[j][0].g3PID, vvFittedTracks[i][0].trkID, vvFittedTracks[j][0].trkID);
187 printf(
"----> Intersecting!\n");
195 printf(
"!!!!!!!!!!!!!!!!!!!!!!!\n");
196 printf(
"----> Not intersecting!\n");
197 printf(
"!!!!!!!!!!!!!!!!!!!!!!!\n");
const std::vector< std::string > vFitPlanes
Strings for fit planes and components.
Definition: TRDConstants.h:23
const double TRD_ZFITCUTOFF_MAX
for intersection cutoffs
Definition: TRDConstants.h:14
const double INTERSECTION_MAX_TOLERANCE
3D track distance for asserting intersection
Definition: TRDConstants.h:42
const std::map< int, std::pair< std::string, std::string > > components
Definition: TRDConstants.h:30
Definition: Intersection3D.h:16
int GetNIntersectingLinePairs(const std::vector< std::vector< Line::FitLine2D >> &vvFittedTracks, const bool &debugMode=false)
Definition: Intersection3D.h:171
Intersection2DResult findIntersection2D(const Line::FitLine2D &lineA, const Line::FitLine2D &lineB, const bool &debugMode=false)
Definition: Intersection3D.h:40
bool areLinesCloseEnough(const std::vector< Line::FitLine2D > &linesA, const std::vector< Line::FitLine2D > &linesB, const bool &debugMode=false)
Definition: Intersection3D.h:72
bool areAllElementsEqual(const std::vector< T > &vec)
Definition: Utilities.h:113
Definition: Intersection3D.h:30
bool intersects
Definition: Intersection3D.h:31
Point::Point2D point
Definition: Intersection3D.h:32
Intersection2DResult()
Definition: Intersection3D.h:34
Intersection2DResult(bool intersects, Point::Point2D point)
Definition: Intersection3D.h:35
Definition: Intersection3D.h:19
double z
Definition: Intersection3D.h:20
double x
Definition: Intersection3D.h:20
std::string FitPlane
Definition: Intersection3D.h:21
IntersectionPoint3D(const std::string &str, double xVal, double yVal, double zVal)
Definition: Intersection3D.h:24
double y
Definition: Intersection3D.h:20
double c
Definition: Line.h:18
double err_m
Definition: Line.h:19
double m
Definition: Line.h:17
double err_c
Definition: Line.h:20
double y
Definition: Point.h:10
double x
Definition: Point.h:10