9 TVector3
end = start + direction;
10 double denominator = direction.Mag();
11 double numerator = (pos - start).Cross(pos - end).Mag();
12 return numerator/denominator;
48 return std::min(std::min(dist1, dist2), std::min(dist3, dist4));
57 double smallNum = 0.00001;
60 TVector3 direction1 = end1 - start1;
62 TVector3 direction2 = end2 - start2;
64 TVector3 u = direction1;
65 TVector3 v = direction2;
66 TVector3
w = start1 - start2;
73 double D = a * c - b * b;
74 double sc, sN, sD = D;
75 double tc, tN, tD = D;
85 sN = (b * e - c * d)/D;
86 tN = (a * e - b * d)/D;
99 sc = (
std::abs(sN) < smallNum ? 0.0 : sN / sD);
100 tc = (
std::abs(tN) < smallNum ? 0.0 : tN / tD);
102 TVector3 dP = w + (sc * u) - (tc * v);
112 TVector3
dir = (end - start);
113 TVector3 invDir (1./dir.X(), 1./dir.Y(), 1/dir.Z());
115 double tmin, tmax, tymin, tymax, tzmin, tzmax;
117 TVector3 enter (-99999, -99999, -99999);
118 TVector3
exit (-99999, -99999, -99999);
122 tmin = (min.X() - start.X()) * invDir.X();
123 tmax = (max.X() - start.X()) * invDir.X();
126 tmin = (max.X() - start.X()) * invDir.X();
127 tmax = (min.X() - start.X()) * invDir.X();
132 tymin = (min.Y() - start.Y()) * invDir.Y();
133 tymax = (max.Y() - start.Y()) * invDir.Y();
136 tymin = (max.Y() - start.Y()) * invDir.Y();
137 tymax = (min.Y() - start.Y()) * invDir.Y();
141 if((tmin > tymax) || (tymin > tmax))
return std::make_pair(enter, exit);
144 if(tymin > tmin) tmin = tymin;
147 if(tymax < tmax) tmax = tymax;
151 tzmin = (min.Z() - start.Z()) * invDir.Z();
152 tzmax = (max.Z() - start.Z()) * invDir.Z();
155 tzmin = (max.Z() - start.Z()) * invDir.Z();
156 tzmax = (min.Z() - start.Z()) * invDir.Z();
160 if((tmin > tzmax) || (tzmin > tmax))
return std::make_pair(enter, exit);
163 if(tzmin > tmin) tmin = tzmin;
166 if(tzmax < tmax) tmax = tzmax;
169 double xmin = start.X() + tmin * dir.X();
170 double xmax = start.X() + tmax * dir.X();
171 double ymin = start.Y() + tmin * dir.Y();
172 double ymax = start.Y() + tmax * dir.Y();
173 double zmin = start.Z() + tmin * dir.Z();
174 double zmax = start.Z() + tmax * dir.Z();
177 enter.SetXYZ(xmin, ymin, zmin);
178 exit.SetXYZ(xmax, ymax, zmax);
179 return std::make_pair(enter, exit);
185 if (tagger ==
"volTaggerBot_0" )
return kCRTBot;
186 else if (tagger ==
"volTaggerSouth_0" )
return kCRTFaceSouth;
187 else if (tagger ==
"volTaggerNorth_0" )
return kCRTFaceNorth;
188 else if (tagger ==
"volTaggerWest_0" )
return kCRTSideWest;
189 else if (tagger ==
"volTaggerEast_0" )
return kCRTSideEast;
190 else if (tagger ==
"volTaggerTopLow_0" )
return kCRTTopLow;
191 else if (tagger ==
"volTaggerTopHigh_0" )
return kCRTTopHigh;
193 mf::LogWarning(
"CRTCommonUtils") <<
"CRT tagger unkown: " << tagger << std::endl;
float z_err
position uncertainty in z-direction (cm).
float x_err
position uncertainty in x-direction (cm).
float y_err
position uncertainty in y-direction (cm).
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
float z_pos
position in z-direction (cm).
double DistToCrtHit(sbn::crt::CRTHit hit, TVector3 start, TVector3 end)
enum::sbnd::CRTPlane GetPlaneIndex(std::string tagger)
auto end(FixedBins< T, C > const &) noexcept
double LineSegmentDistance(TVector3 start1, TVector3 end1, TVector3 start2, TVector3 end2)
float y_pos
position in y-direction (cm).
double SimpleDCA(sbn::crt::CRTHit hit, TVector3 start, TVector3 direction)
float x_pos
position in x-direction (cm).
stream1 can override from command line with o or output services user sbnd
std::pair< TVector3, TVector3 > CubeIntersection(TVector3 min, TVector3 max, TVector3 start, TVector3 end)