diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d1ddad61bac126363c7bfc173c91a8a414f284d..d385e94f9b1f6a62ae5d31ac6657399611ca2fc9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,9 +73,6 @@ add_definitions("-DActs_VERSION_MAJOR=${Acts_VERSION_MAJOR}")
 add_definitions("-DActs_VERSION_MINOR=${Acts_VERSION_MINOR}")
 add_definitions("-DActs_VERSION_PATCH=${Acts_VERSION_PATCH}")
 
-find_library(genfit2 genfit2 /usr/local/lib REQUIRED)
-find_path(genfit2_INCLUDE_DIR NAMES GFGbl.h PATHS /usr/local/include ${genfit2}/../include REQUIRED)
-
 find_package(Gaudi)
 add_subdirectory(JugBase)
 add_subdirectory(JugDigi)
diff --git a/JugBase/CMakeLists.txt b/JugBase/CMakeLists.txt
index 4c4a98948edfe868cfb7c32965380c8d066ca28a..354bfea986e9c9434f21886db6cc93d4c01753df 100644
--- a/JugBase/CMakeLists.txt
+++ b/JugBase/CMakeLists.txt
@@ -19,13 +19,11 @@ gaudi_add_library(JugBase
   ROOT::Core ROOT::RIO ROOT::Tree
   DD4hep::DDG4IO DD4hep::DDRec
   ActsCore ActsPluginDD4hep
-  ${genfit2}
 )
 
 target_include_directories(JugBase PUBLIC
   $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
-  ${genfit2_INCLUDE_DIR}
 )
 
 target_compile_options(JugBase PRIVATE -Wno-suggest-override)
@@ -42,13 +40,11 @@ gaudi_add_module(JugBasePlugins
   DD4hep::DDRec
   ActsCore ActsPluginDD4hep ActsPluginJson
   EDM4EIC::edm4eic
-  ${genfit2}
 )
 
 target_include_directories(JugBasePlugins PUBLIC
   $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
-  ${genfit2_INCLUDE_DIR}
 )
 
 target_compile_options(JugBasePlugins PRIVATE -Wno-suggest-override)
diff --git a/JugBase/JugBase/IGeoSvc.h b/JugBase/JugBase/IGeoSvc.h
index 16d4f1876360326b115f8b72fe77958c8b26b7cb..4ee60fcbc6c02232b86c47bcebbeec05f8a08dee 100644
--- a/JugBase/JugBase/IGeoSvc.h
+++ b/JugBase/JugBase/IGeoSvc.h
@@ -22,10 +22,6 @@ namespace Acts {
   class MagneticFieldProvider;
 }
 
-namespace genfit {
-  class DetPlane;
-}
-
 /** Geometry service interface.
  *
  * \ingroup base
@@ -49,13 +45,6 @@ public:
 
   virtual const VolumeSurfaceMap& surfaceMap() const = 0;
 
-  // Note this hsould return a const& but is just copied for the moment to get around genfit's api
-  /// Genfit DetPlane map
-  virtual std::map<int64_t, std::shared_ptr<genfit::DetPlane>> getDetPlaneMap() const = 0;
-  virtual std::map< int64_t, dd4hep::rec::Surface* > getDD4hepSurfaceMap() const =0;
-
-  //virtual std::map< int64_t, dd4hep::rec::Surface* > getDetPlaneMap() const = 0 ;
-
   virtual ~IGeoSvc() {}
 };
 
diff --git a/JugBase/src/components/GeoSvc.cpp b/JugBase/src/components/GeoSvc.cpp
index 2eddc4b6c884685e9532df75ad665e41e94367a3..c6d3554eefd1950b2960aea30dcb476512f1347e 100644
--- a/JugBase/src/components/GeoSvc.cpp
+++ b/JugBase/src/components/GeoSvc.cpp
@@ -18,20 +18,6 @@
 #include "Acts/MagneticField/MagneticFieldContext.hpp"
 #include "Acts/Surfaces/PlaneSurface.hpp"
 
-// genfit
-#include "ConstField.h"
-#include "DAF.h"
-#include "Exception.h"
-#include "FieldManager.h"
-#include "KalmanFitterRefTrack.h"
-#include "StateOnPlane.h"
-#include "Track.h"
-#include "TrackPoint.h"
-#include "MaterialEffects.h"
-#include "RKTrackRep.h"
-#include "TGeoMaterialInterface.h"
-#include "PlanarMeasurement.h"
-
 static const std::map<int, Acts::Logging::Level> s_msgMap = {
     {MSG::DEBUG, Acts::Logging::DEBUG},
     {MSG::VERBOSE, Acts::Logging::VERBOSE},
@@ -113,29 +99,6 @@ StatusCode GeoSvc::initialize() {
     m_log << MSG::INFO << "DD4Hep geometry SUCCESSFULLY built" << endmsg;
   }
 
-  // Genfit
-  genfit::FieldManager::getInstance()->init(new genfit::ConstField(
-      0., 0., this->centralMagneticField() * 10.0)); // gentfit uses kilo-Gauss
-  genfit::MaterialEffects::getInstance()->init(new genfit::TGeoMaterialInterface());
-
-  // create a list of all surfaces in the detector:
-  dd4hep::rec::SurfaceManager surfMan( *m_dd4hepGeo ) ;
-  debug() << " surface manager " << endmsg;
-  const auto* const sM = surfMan.map("tracker") ;
-  if (sM != nullptr) {
-    debug() << " surface map  size: " << sM->size() << endmsg;
-    // setup  dd4hep surface map
-    //for( dd4hep::rec::SurfaceMap::const_iterator it = sM->begin() ; it != sM->end() ; ++it ){
-    for( const auto& [id, s] :   *sM) {
-      //dd4hep::rec::Surface* surf = s ;
-      m_surfaceMap[ id ] = dynamic_cast<dd4hep::rec::Surface*>(s) ;
-      debug() << " surface : " << *s << endmsg;
-      m_detPlaneMap[id] = std::shared_ptr<genfit::DetPlane>(
-          new genfit::DetPlane({s->origin().x(), s->origin().y(), s->origin().z()}, {s->u().x(), s->u().y(), s->u().z()},
-                               {s->v().x(), s->v().y(), s->v().z()}));
-    }
-  }
-
   // Set ACTS logging level
   auto im = s_msgMap.find(msgLevel());
   if (im != s_msgMap.end()) {
diff --git a/JugBase/src/components/GeoSvc.h b/JugBase/src/components/GeoSvc.h
index d8ea30346ca9436575a0c3c2e4f4a4be4dbe5f2f..d992de03ab4cdf58b814fd6dfbc3b5e2c901df18 100644
--- a/JugBase/src/components/GeoSvc.h
+++ b/JugBase/src/components/GeoSvc.h
@@ -57,12 +57,6 @@ private:
    */
   dd4hep::Detector* m_dd4hepGeo = nullptr;
 
-  /// DD4hep surface map
-  std::map< int64_t, dd4hep::rec::Surface* > m_surfaceMap ;
-
-  /// Genfit DetPlane map
-  std::map< int64_t, std::shared_ptr<genfit::DetPlane> > m_detPlaneMap ;
-
   /// ACTS Logging Level
   Acts::Logging::Level m_actsLoggingLevel = Acts::Logging::INFO;
 
@@ -144,11 +138,6 @@ public:
   }
 
   virtual const VolumeSurfaceMap& surfaceMap() const { return m_surfaces; }
-
-  // Note this hsould return a const& but is just copied for the moment to get around genfit's api
-  virtual std::map<int64_t, std::shared_ptr<genfit::DetPlane>> getDetPlaneMap() const { return m_detPlaneMap; }
-
-  virtual std::map< int64_t, dd4hep::rec::Surface* > getDD4hepSurfaceMap() const { return m_surfaceMap ;}
 };
 
 inline std::shared_ptr<const Acts::TrackingGeometry> GeoSvc::trackingGeometry() const
diff --git a/JugTrack/CMakeLists.txt b/JugTrack/CMakeLists.txt
index 0fb0c66c6ee21991d6ca1d70bf4f142a441a3792..47a3bebc53460c0c356b7e94607a75341644ad11 100644
--- a/JugTrack/CMakeLists.txt
+++ b/JugTrack/CMakeLists.txt
@@ -17,14 +17,12 @@ gaudi_add_module(JugTrackPlugins
   EDM4EIC::edm4eic
   DD4hep::DDRec
   ActsCore
-  ${genfit2}
 )
 
 target_include_directories(JugTrackPlugins PUBLIC
   $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/JugBase>
   $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
-  ${genfit2_INCLUDE_DIR}
 )
 
 target_compile_options(JugTrackPlugins PRIVATE -Wno-suggest-override)
diff --git a/JugTrack/src/components/GenFitTrackFitter.cpp b/JugTrack/src/components/GenFitTrackFitter.cpp
deleted file mode 100644
index 48db05dbe16bee56e231064e47037857e43293d1..0000000000000000000000000000000000000000
--- a/JugTrack/src/components/GenFitTrackFitter.cpp
+++ /dev/null
@@ -1,308 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-later
-// Copyright (C) 2022 Whitney Armstrong, Sylvester Joosten
-
-#include "GenFitTrackFitter.h"
-// Gaudi
-#include "Gaudi/Property.h"
-#include "GaudiAlg/GaudiAlgorithm.h"
-#include "GaudiAlg/GaudiTool.h"
-#include "GaudiAlg/Transformer.h"
-#include "GaudiKernel/RndmGenerators.h"
-#include "GaudiKernel/ToolHandle.h"
-
-#include "DDRec/CellIDPositionConverter.h"
-#include "DDRec/Surface.h"
-#include "DDRec/SurfaceManager.h"
-
-#include "JugBase/BField/DD4hepBField.h"
-#include "JugBase/DataHandle.h"
-#include "JugBase/IGeoSvc.h"
-#include "JugTrack/GeometryContainers.hpp"
-#include "JugTrack/IndexSourceLink.hpp"
-#include "JugTrack/Measurement.hpp"
-#include "JugTrack/Track.hpp"
-
-#include "edm4eic/TrackerHitCollection.h"
-#include "edm4eic/vector_utils.h"
-
-#include <functional>
-#include <random>
-#include <stdexcept>
-#include <vector>
-
-//# genfit
-#include "ConstField.h"
-#include "DAF.h"
-#include "Exception.h"
-#include "FieldManager.h"
-#include "KalmanFitterRefTrack.h"
-#include "MaterialEffects.h"
-#include "RKTrackRep.h"
-#include "StateOnPlane.h"
-#include "TGeoMaterialInterface.h"
-#include "Track.h"
-#include "TrackPoint.h"
-//#include <EventDisplay.h>
-#include "HelixTrackModel.h"
-#include "PlanarMeasurement.h"
-//#include "MeasurementCreator.h"
-#include "WireMeasurement.h"
-
-#include "TDatabasePDG.h"
-#include "TEveManager.h"
-#include "TGeoManager.h"
-#include "TRandom.h"
-#include "TVector3.h"
-#include <vector>
-
-namespace Jug::Reco {
-
-GenFitTrackFitter::GenFitTrackFitter(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) {
-  declareProperty("inputHitCollection", m_inputHitCollection, "");
-  declareProperty("initialTrackParameters", m_initialTrackParameters, "");
-  declareProperty("inputProtoTracks", m_inputProtoTracks, "");
-  declareProperty("trackParameters", m_foundTracks, "");
-  declareProperty("outputTrajectories", m_outputTrajectories, "");
-}
-
-StatusCode GenFitTrackFitter::initialize() {
-  if (GaudiAlgorithm::initialize().isFailure()) {
-    return StatusCode::FAILURE;
-  }
-  m_geoSvc = service("GeoSvc");
-  if (!m_geoSvc) {
-    error() << "Unable to locate Geometry Service. "
-            << "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg;
-    return StatusCode::FAILURE;
-  }
-
-  genfit::FieldManager::getInstance()->init(new FieldImp(m_geoSvc->detector()));
-  // 0., 0., m_geoSvc->centralMagneticField() * 10.0)); // gentfit uses kilo-Gauss
-  genfit::MaterialEffects::getInstance()->init(new genfit::TGeoMaterialInterface());
-
-  // copy the whole map to get around genfit's interface
-  // this should be returning a const&
-  m_detPlaneMap = m_geoSvc->getDetPlaneMap();
-  m_surfaceMap  = m_geoSvc->getDD4hepSurfaceMap();
-
-  return StatusCode::SUCCESS;
-}
-
-StatusCode GenFitTrackFitter::execute() {
-  // Read input data
-  const edm4eic::TrackerHitCollection* hits            = m_inputHitCollection.get();
-  const TrackParametersContainer* initialParameters = m_initialTrackParameters.get();
-  const ProtoTrackContainer* protoTracks            = m_inputProtoTracks.get();
-
-  // TrajectoryContainer trajectories;
-  // commented out unused variables
-  /*auto trajectories    =*/m_outputTrajectories.createAndPut();
-  /*auto trackParameters =*/m_foundTracks.createAndPut();
-
-  int n_tracks       = initialParameters->size();
-  int n_proto_tracks = protoTracks->size();
-  // Unused variable
-  // int ID             = 0;
-
-  // Assuming init track parameters have been match with proto tracks by index
-  if (n_proto_tracks != n_tracks) {
-    warning() << " Number of proto tracks does not match the initial track parameters." << endmsg;
-  }
-
-  for (int itrack = 0; itrack < std::min(n_tracks, n_proto_tracks); itrack++) {
-    const auto& track_param = (*initialParameters)[itrack];
-    const auto& proto_track = (*protoTracks)[itrack];
-
-    if (msgLevel(MSG::DEBUG)) {
-      debug() << "track mom : " << track_param.absoluteMomentum() << endmsg;
-    }
-    if (hits->size() < 2) {
-      return StatusCode::SUCCESS;
-    }
-    // init fitter
-    // genfit::KalmanFitterRefTrack fitter;
-    // fitter.setDebugLvl(1);
-    genfit::DAF fitter;
-    // genfit::AbsKalmanFitter* fitter = new genfit::KalmanFitterRefTrack();
-
-    ROOT::Math::XYZVector tp(track_param.momentum()[0], track_param.momentum()[1], track_param.momentum()[2]);
-    auto first_hit       = (*hits)[proto_track[0]];
-    auto first_hit_phi   = edm4eic::angleAzimuthal(first_hit.getPosition());
-    auto track_param_phi = tp.phi();
-    if (msgLevel(MSG::DEBUG)) {
-      debug() << " first hit phi:  " << first_hit_phi << endmsg;
-      debug() << "init track phi:  " << track_param_phi << endmsg;
-    }
-    if (std::fabs(first_hit_phi - track_param_phi) > 0.15) {
-      warning() << "Seed directions does not match first hit phi. " << endmsg;
-      continue;
-    }
-
-    // start values for the fit, e.g. from pattern recognition
-    TVector3 pos(0, 0, 0);
-    TVector3 mom(track_param.momentum()[0], track_param.momentum()[1], track_param.momentum()[2]);
-    TMatrixDSym covM(6);
-    covM(0, 0) = 0.001;
-    covM(1, 1) = 0.001;
-    covM(2, 2) = 1.0;
-    covM(3, 3) = 0.05 * track_param.momentum()[0] * 0.05 * track_param.momentum()[0];
-    covM(4, 4) = 0.05 * track_param.momentum()[1] * 0.05 * track_param.momentum()[1];
-    covM(5, 5) = 0.05 * track_param.momentum()[2] * 0.05 * track_param.momentum()[2];
-
-    if (msgLevel(MSG::DEBUG)) {
-      debug() << "covM = " << covM(0, 0) << "," << covM(1, 1) << "," << covM(2, 2) << "," << covM(3, 3) << ","
-              << covM(4, 4) << "," << covM(5, 5) << " " << endmsg;
-    }
-
-    // trackrep
-    // @FIXME: raw new should be avoided, either place on the stack or use
-    // std::unique_ptr<>
-    genfit::AbsTrackRep* electron_rep = new genfit::RKTrackRep(11);
-    // unusud
-    // genfit::AbsTrackRep* positron_rep = new genfit::RKTrackRep(-11);
-    // genfit::AbsTrackRep* piplus_rep = new genfit::RKTrackRep(211);
-    // genfit::AbsTrackRep* piminus_rep = new genfit::RKTrackRep(-211);
-
-    // smeared start state
-    genfit::MeasuredStateOnPlane stateSmeared(electron_rep);
-    stateSmeared.setPosMomCov(pos, mom, covM);
-
-    // create track
-    TVectorD seedState(6);
-    TMatrixDSym seedCov(6);
-    stateSmeared.get6DStateCov(seedState, seedCov);
-    // genfit::Track fitTrack(rep, seedState, seedCov);
-
-    // create track
-    genfit::Track fitTrack(electron_rep, seedState, seedCov);
-    // genfit::Track fitTrack(electron_rep, pos, mom);
-    // fitTrack.addTrackRep(positron_rep);
-    // fitTrack.addTrackRep(piplus_rep );
-    // fitTrack.addTrackRep(piminus_rep);
-
-    if (msgLevel(MSG::DEBUG)) {
-      debug() << (*hits).size() << " hits " << endmsg;
-    }
-
-    int nhit = 0;
-    for (int ihit : proto_track) {
-      const auto& ahit = (*hits)[ihit];
-
-      const auto* vol_ctx        = m_geoSvc->cellIDPositionConverter()->findContext(ahit.getCellID());
-      auto vol_id         = vol_ctx->identifier;
-      auto volman         = m_geoSvc->detector()->volumeManager();
-      auto alignment      = volman.lookupDetElement(vol_id).nominal();
-      auto local_position = alignment.worldToLocal(
-          {ahit.getPosition().x / 10.0, ahit.getPosition().y / 10.0, ahit.getPosition().z / 10.0});
-      auto* surf = m_surfaceMap[vol_id];
-      auto local_position2 =
-          surf->globalToLocal({ahit.getPosition().x / 10.0, ahit.getPosition().y / 10.0, ahit.getPosition().z / 10.0});
-
-      TMatrixDSym hitCov(2);
-      hitCov.UnitMatrix();
-      hitCov(0, 0) = ahit.getPositionError().xx / (100.0); // go from mm^2 to  cm^2
-      hitCov(1, 1) = ahit.getPositionError().yy / (100.0); // go from mm^2 to  cm^2
-
-      if (msgLevel(MSG::DEBUG)) {
-        debug() << "------------------------------------ " << endmsg;
-        debug() << " hit position     : " << ahit.getPosition().x / 10 << " " << ahit.getPosition().y / 10 << " "
-                << ahit.getPosition().z / 10 << endmsg;
-        debug() << " dd4hep loc  pos  : " << local_position.x() << " " << local_position.y() << " "
-                << local_position.z() << endmsg;
-        debug() << " dd4hep surf pos  : " << local_position2.u() << " " << local_position2.v() << endmsg;
-      }
-
-      /** \todo Add check for XZ segmentations to use the right local coordinates.
-       *  Unlike acts, the conversion to the local system isn't going from 3D -> 2D.
-       *  Thefore there is one coordinate that is zero. Which one depends on the the segmentation
-       *  type XY, XZ, etc. For XY the Z-coordinate is zero. For the XZ, the Y-coordinate is zero.
-       */
-      TVectorD hitCoords(2);
-      hitCoords[0] = local_position2.u();
-      hitCoords[1] = local_position2.v();
-      if (msgLevel(MSG::DEBUG)) {
-        debug() << "covariance matrix :  " << hitCov(0, 0) << " " << hitCov(1, 1) << " " << endmsg;
-        debug() << "  hit coordinates :  " << hitCoords[0] << " " << hitCoords[1] << " " << endmsg;
-      }
-      auto* measurement = new genfit::PlanarMeasurement(hitCoords, hitCov, 1 /** type **/, nhit, nullptr);
-
-      // measurement->setPlane(genfit::SharedPlanePtr(new genfit::DetPlane(point, u_dir, v_dir)),
-      measurement->setPlane(m_detPlaneMap[vol_id], vol_id);
-      fitTrack.insertPoint(new genfit::TrackPoint(measurement, &fitTrack));
-      // positronFitTrack.insertPoint(new genfit::TrackPoint(measurement, &positronFitTrack));
-
-      nhit++;
-    }
-
-    // do the fit
-    try {
-      if (msgLevel(MSG::DEBUG)) {
-        debug() << "Electron track: " << endmsg;
-        fitTrack.checkConsistency();
-      }
-      fitter.processTrack(&fitTrack, true);
-      bool isConverged = fitTrack.getFitStatus()->isFitConverged();
-      if (!isConverged) {
-        fitter.processTrack(&fitTrack, true);
-      }
-
-      isConverged = fitTrack.getFitStatus()->isFitConverged();
-      if (!isConverged) {
-        fitter.processTrack(&fitTrack);
-      }
-
-      // print fit result
-      fitTrack.getFittedState().Print();
-      // isConverged = fitTrack.getFitStatus()->isFitConverged();
-
-      bool isFitted = fitTrack.getFitStatus()->isFitted();
-      float chi2    = fitTrack.getFitStatus()->getChi2();
-      float ndf     = fitTrack.getFitStatus()->getNdf();
-      // unused
-      // float charge      = fitTrack.getFitStatus()->getCharge();
-
-      TVector3 vertexPos;
-      TVector3 vertexMom;
-      TMatrixDSym vertexCov;
-      genfit::MeasuredStateOnPlane state = fitTrack.getFittedState(); // copy
-      TVector3 vertex(0, 0, 0);
-      TVector3 axis(0, 0, 1);
-      // state.extrapolateToPoint(vertex);
-      // or alternatively
-      state.extrapolateToLine(vertex, axis);
-      state.getPosMomCov(vertexPos, vertexMom, vertexCov);
-
-      if (msgLevel(MSG::DEBUG)) {
-        debug() << "Electron track: " << endmsg;
-        fitTrack.checkConsistency();
-        debug() << "vertex pos: " << vertexPos.x() << ", " << vertexPos.y() << ", " << vertexPos.z() << endmsg;
-        debug() << "vertex mom: " << vertexMom.x() << ", " << vertexMom.y() << ", " << vertexMom.z() << endmsg;
-        debug() << "track status: " << endmsg;
-        debug() << " fitted    = " << isFitted << endmsg;
-        debug() << " converged =" << isConverged << endmsg;
-        debug() << " chi2/ndf    = " << isFitted << "/" << ndf << " = " << chi2 / ndf << endmsg;
-        debug() << " charge =" << isConverged << endmsg;
-        // debug() << "Positron track: " << endmsg;
-        // positronFitTrack.checkConsistency();
-      }
-    } catch (genfit::Exception& e) {
-      warning() << e.what() << endmsg;
-      warning() << "Exception, next track" << endmsg;
-      continue;
-    }
-
-    // edm4eic::TrackParameters electron_track_params({ID++, algorithmID()}, {0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},
-
-    // TrackParameters(edm4eic::Index ID, edm4eic::FloatPair loc, edm4eic::FloatPair locError, edm4eic::Direction direction,
-    // edm4eic::Direction directionError, float qOverP, float qOverPError, float time, float timeError);
-    // tracks->push_back(electron_track_params);
-
-    // delete fitter;
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
-DECLARE_COMPONENT(GenFitTrackFitter)
-} // namespace Jug::Reco
diff --git a/JugTrack/src/components/GenFitTrackFitter.h b/JugTrack/src/components/GenFitTrackFitter.h
deleted file mode 100644
index 6efac291158ac85af319d3438cbe936481a4b9a7..0000000000000000000000000000000000000000
--- a/JugTrack/src/components/GenFitTrackFitter.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-later
-// Copyright (C) 2022 Whitney Armstrong
-
-#ifndef JUGGLER_JUGRECO_GenFitTrackFitter_HH
-#define JUGGLER_JUGRECO_GenFitTrackFitter_HH
-
-#include <functional>
-#include <stdexcept>
-#include <vector>
-
-// Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-#include "GaudiKernel/ToolHandle.h"
-#include "Gaudi/Property.h"
-
-#include "JugBase/DataHandle.h"
-#include "JugBase/IGeoSvc.h"
-#include "JugBase/BField/DD4hepBField.h"
-#include "JugTrack/GeometryContainers.hpp"
-#include "JugTrack/IndexSourceLink.hpp"
-#include "JugTrack/Track.hpp"
-#include "JugTrack/Measurement.hpp"
-#include "JugTrack/Trajectories.hpp"
-#include "JugTrack/ProtoTrack.hpp"
-
-#include "edm4eic/TrackerHitCollection.h"
-#include "edm4eic/TrajectoryCollection.h"
-#include "edm4eic/TrackParametersCollection.h"
-
-//genfitk
-#include "FieldManager.h"
-
-#include <random>
-#include <stdexcept>
-
-namespace Jug::Reco {
-
-
-  /** Genfit based tracking algorithm.
-   *
-   * \ingroup tracking
-   */
-  class GenFitTrackFitter : public GaudiAlgorithm {
-  public:
-
-  class FieldImp : public genfit::AbsBField {
-  protected:
-    dd4hep::Detector* m_detector;
-  public:
-    FieldImp(dd4hep::Detector* det): m_detector(det) {}
-    virtual ~FieldImp() {}
-
-    /** Get the magneticField [kGauss] at position.
-     *
-     *  Note that tgeo units are used. [cm] and [kGauss].
-     */
-    TVector3 get(const TVector3& position) const override {
-      double pos[3] = {position.x(), position.y(), position.z()};
-      double field[3];
-      this->get(pos[0], pos[1], pos[2], field[0], field[1], field[2]);
-      return {field[0], field[1], field[2]};
-    }
-
-    /** Get the magneticField [kGauss] at position.
-     *
-     *  Note that tgeo units are used. [cm] and [kGauss].
-     */
-    void get(const double& posX, const double& posY, const double& posZ,
-             double& Bx, double& By, double& Bz) const override {
-    dd4hep::Position pos(posX,posY,posZ);
-    auto field = m_detector->field().magneticField(pos) * (dd4hep::kilogauss / dd4hep::tesla);
-    Bx = field.x();
-    By = field.y();
-    Bz = field.z();
-    //return {field.x(), field.y(),field.z()};
-    }
-  };
-
-public:
-  DataHandle<edm4eic::TrackerHitCollection> m_inputHitCollection{"inputHitCollection", Gaudi::DataHandle::Reader, this};
-  DataHandle<TrackParametersContainer>  m_initialTrackParameters{"initialTrackParameters", Gaudi::DataHandle::Reader, this};
-  DataHandle<ProtoTrackContainer>       m_inputProtoTracks{"inputProtoTracks", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4eic::TrackParametersCollection> m_foundTracks{"trackParameters", Gaudi::DataHandle::Reader, this};
-  DataHandle<edm4eic::TrajectoryCollection> m_outputTrajectories{"outputTrajectories", Gaudi::DataHandle::Writer, this};
-
-  SmartIF<IGeoSvc> m_geoSvc;
-  // Acts::GeometryContext                 m_geoctx;
-  // Acts::CalibrationContext              m_calibctx;
-  // Acts::MagneticFieldContext            m_fieldctx;
-
-  std::map<int64_t, std::shared_ptr<genfit::DetPlane>> m_detPlaneMap;
-  std::map<int64_t, dd4hep::rec::Surface*> m_surfaceMap;
-
-  GenFitTrackFitter(const std::string& name, ISvcLocator* svcLoc);
-
-  StatusCode initialize() override;
-  StatusCode execute() override;
-  };
-
-
-} // namespace Jug::Reco
-
-#endif