From a4565f32ba40e82673f36410ee01f1ab86b08a30 Mon Sep 17 00:00:00 2001
From: Adrien Matta <matta@lpccaen.in2p3.fr>
Date: Tue, 21 Jul 2020 10:03:33 +0200
Subject: [PATCH] * Adding Tracking utility file

---
 NPLib/TrackReconstruction/CMakeLists.txt      |  2 +-
 NPLib/TrackReconstruction/NPTrackingUtility.h | 34 +++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 NPLib/TrackReconstruction/NPTrackingUtility.h

diff --git a/NPLib/TrackReconstruction/CMakeLists.txt b/NPLib/TrackReconstruction/CMakeLists.txt
index 1b61b7ecb..7fbdc6a68 100644
--- a/NPLib/TrackReconstruction/CMakeLists.txt
+++ b/NPLib/TrackReconstruction/CMakeLists.txt
@@ -7,4 +7,4 @@ add_custom_command(OUTPUT TrackingDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/b
 add_library(NPTrackReconstruction SHARED NPRansac.cxx NPCluster.cxx NPTrack.cxx Tracking.cxx NPRansacDict.cxx NPClusterDict.cxx TrackingDict.cxx)
 target_link_libraries(NPTrackReconstruction ${ROOT_LIBRARIES} NPCore)
 
-install(FILES NPRansac.h NPCluster.h NPTrack.h Tracking.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
+install(FILES NPRansac.h NPCluster.h NPTrack.h Tracking.h NPTrackingUtility.h   DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
diff --git a/NPLib/TrackReconstruction/NPTrackingUtility.h b/NPLib/TrackReconstruction/NPTrackingUtility.h
new file mode 100644
index 000000000..afc0a447c
--- /dev/null
+++ b/NPLib/TrackReconstruction/NPTrackingUtility.h
@@ -0,0 +1,34 @@
+#ifndef NPUTILITY_H
+#define NPUTILITY_H
+/*****************************************************************************
+ * Copyright (C) 2009-2016   this file is part of the NPTool Project         *
+ *                                                                           *
+ * For the licensing terms see $NPTOOL/Licence/NPTool_Licence                *
+ * For the list of contributors see $NPTOOL/Licence/Contributors             *
+ *****************************************************************************/
+
+/*****************************************************************************
+ *                                                                           *
+ * Original Author :  Adrien Matta  contact address: matta@lpccaen.in2p3.fr  *
+ *                                                                           *
+ * Creation Date   : July 2020                                               *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ *  This class deal with finding all the track event by event                *
+ *****************************************************************************/
+
+namespace NPL{
+  double MinimunDistance(TVector3 v1,TVector3 v2, TVector3 w1, TVector3 w2){
+  TVector3 v=v1-v2;
+  TVector3 w = w2-w1;
+  // Minimum distance
+  // let be n perpendicular to both line
+  TVector3 n = v.Cross(w);
+
+  double d = n.Dot(v1-w1)/n.Mag();
+  return d;
+  }
+}
+
+
+#endif
-- 
GitLab