All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbndcode/sbndcode/CRT/CRTUtils/CRTCommonUtils.h
Go to the documentation of this file.
1 #ifndef CRTCOMMONUTILS_H_SEEN
2 #define CRTCOMMONUTILS_H_SEEN
3 
4 
5 ///////////////////////////////////////////////
6 // CRTCommonUtils.h
7 //
8 // Common functions for CRT reconstruction
9 ///////////////////////////////////////////////
10 
11 // framework includes
12 #include "messagefacility/MessageLogger/MessageLogger.h"
13 
14 // sbndcode includes
16 
17 // c++
18 #include <vector>
19 #include <utility>
20 
21 // ROOT
22 #include "TVector3.h"
23 
24 namespace sbnd {
25  enum CRTPlane {
26  kCRTNotDefined = -1, ///< Not defined
27  kCRTBot = 0, ///< Bottom
28  kCRTFaceSouth = 1, ///< Face South (Front)
29  kCRTFaceNorth, ///< Face North (Back)
30  kCRTSideWest, ///< Side Weast (Left)
31  kCRTSideEast, ///< Side East (Right)
32  kCRTTopLow, ///< Top Low
33  kCRTTopHigh, ///< Top High
35  };
36 }
37 
38 namespace sbnd{
39 namespace CRTCommonUtils{
40 
41  // Simple distance of closest approach between infinite track and centre of hit
42  double SimpleDCA(sbn::crt::CRTHit hit, TVector3 start, TVector3 direction);
43 
44  // Minimum distance from infinite track to CRT hit assuming that hit is a 2D square
45  double DistToCrtHit(sbn::crt::CRTHit hit, TVector3 start, TVector3 end);
46 
47  // Distance between infinite line (2) and segment (1)
48  // http://geomalgorithms.com/a07-_distance.html
49  double LineSegmentDistance(TVector3 start1, TVector3 end1, TVector3 start2, TVector3 end2);
50 
51  // Intersection between axis-aligned cube and infinite line
52  // (https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-box-intersection)
53  std::pair<TVector3, TVector3> CubeIntersection(TVector3 min, TVector3 max, TVector3 start, TVector3 end);
54 
55  // Returns the CRT plane index given the tagger name
57 }
58 }
59 
60 #endif
process_name hit
Definition: cheaterreco.fcl:51
double DistToCrtHit(sbn::crt::CRTHit hit, TVector3 start, TVector3 end)
enum::sbnd::CRTPlane GetPlaneIndex(std::string tagger)
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
double LineSegmentDistance(TVector3 start1, TVector3 end1, TVector3 start2, TVector3 end2)
double SimpleDCA(sbn::crt::CRTHit hit, TVector3 start, TVector3 direction)
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)