diff --git a/.travis.yml b/.travis.yml
index 01879b8127d95e20e7d800c888d1358a5bbcfb0b..4a3be81b21999420318be4e160a97727579cfbb4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,13 @@ notifications:
   email:
     on_success: change
     on_failure: always
-compiler: gcc
+env:
+  matrix:
+    - ROOT_VERSION=root_v6.10.00.Linux-ubuntu14-x86_64-gcc4.8.tar.gz
+    - ROOT_VERSION=root_v6.08.06.Linux-ubuntu14-x86_64-gcc4.8.tar.gz
+compiler:
+    - gcc-4.8
+    - clang-3.8
 addons:
   apt:
     sources:
@@ -13,18 +19,32 @@ addons:
     packages:
     - clang
 before_install:
-  # install boost and root
-  - sudo apt-get -y install libboost1.54-all-dev root-system
+  # install cmake and gtest
+  - sudo apt-get install cmake libgtest-dev libglu1-mesa
+  - cd /usr/src/gtest
+  - sudo cmake CMakeLists.txt
+  - sudo make
+  - sudo cp *.a /usr/lib
+  - cd -
+  # install root
+  - wget https://root.cern.ch/download/${ROOT_VERSION}
+  - tar xzf ${ROOT_VERSION}
+  - source root/bin/thisroot.sh
+  # Install Eigen from source
+  - wget https://bitbucket.org/eigen/eigen/get/3.3.4.tar.gz -O /tmp/eigen.tar.gz
+  - mkdir eigen3-src && tar -xzf /tmp/eigen.tar.gz -C eigen3-src --strip 1
+  - cd eigen3-src && mkdir build && cd build && cmake .. && sudo make install && cd ../..
 install:
   # create dedicated build folder
   - cd .. && mkdir build && cd build
   - cmake ../GenFit
-  - make VERBOSE=1
+  - make
   - make tests
 script:
   # generate test geometry
-  - cd bin
-  - root -l -b -q ../../GenFit/test/makeGeom.C
-  # run unit tests
-  - ./unitTests
-
+  - root -l -b -q ../GenFit/test/makeGeom.C
+  # run unit tests, must be executed in the build folder
+  # so ROOT can find its .pcm files
+  - ./bin/gtests
+  - ./bin/streamerTest
+  - ./bin/unitTests
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a9139210c5a664de2b80be52cf2abf96036c3a1..779862f55bf12d85d503a5defa0fa06698fe73b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,17 +9,19 @@ PROJECT(genfit2)
 
 # set project version
 SET( ${PROJECT_NAME}_VERSION_MAJOR 2 )
-SET( ${PROJECT_NAME}_VERSION_MINOR 0 )
+SET( ${PROJECT_NAME}_VERSION_MINOR 2 )
 SET( ${PROJECT_NAME}_VERSION_PATCH 0 )
 
+include(GNUInstallDirs)
+
 # install destinations can be passed via the command line:
 # cmake -DLIBRARY_OUTPUT_DIRECTORY:PATH=.... -DINCLUDE_OUTPUT_DIRECTORY:PATH=....
 # otherwise, set default install destinations
 IF(NOT DEFINED LIBRARY_OUTPUT_DIRECTORY)
-	set( LIBRARY_OUTPUT_DIRECTORY ./lib )
+	set( LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR} )
 ENDIF()
 IF(NOT DEFINED INCLUDE_OUTPUT_DIRECTORY)
-	set( INCLUDE_OUTPUT_DIRECTORY ./include )
+	set( INCLUDE_OUTPUT_DIRECTORY ${CMAKE_INSTALL_INCLUDEDIR} )
 ENDIF()
 
 # define path to macros and settings
@@ -27,8 +29,14 @@ LIST( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
 # include the macros and settings
 INCLUDE(settings)
 INCLUDE(macros)
+INCLUDE(genfit)
 
 FIND_PACKAGE(ROOT REQUIRED COMPONENTS Geom)
+IF(${ROOT_found_version} LESS 60000)
+	MESSAGE(FATAL_ERROR "GenFit requires a ROOT version > 6.00.00")
+ENDIF()
+
+FIND_PACKAGE(Eigen3 REQUIRED)
 
 # either, the environment variable RAVEPATH has to be specified, and RAVE's pkgConfig will be used to determine everything we need
 # or, RAVE_LDFLAGS, RAVE_INCLUDE_DIRS and RAVE_CFLAGS have to be set via the command-line
@@ -70,33 +78,21 @@ ENDIF()
 
 # Set GENFIT include directories
 SET(GF_INC_DIRS
-	./core/include/ 
-	./eventDisplay/include/
-	./fields/include/
-	./finitePlanes/include/ 
-	./fitters/include/
-	./GBL/include/
-	./measurements/include/ 
-	./trackReps/include/
-	./utilities/include/
-    ${GF_INC_DIRS}
-#    $ENV{VALGRINDDIR}
-#    $ENV{VALGRINDDIR}/include/
+		./core/include/
+		./eventDisplay/include/
+		./fields/include/
+		./finitePlanes/include/
+		./fitters/include/
+		./GBL/include/
+		./measurements/include/
+		./trackReps/include/
+		./utilities/include/
+		${GF_INC_DIRS}
 )
 
-#search for boost, provide some information to user
-FIND_PACKAGE(Boost)
-IF (Boost_FOUND)
-    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
-    MESSAGE("-- Boost is found at: ${Boost_INCLUDE_DIR}")
-    INSTALL( DIRECTORY ${GF_INC_DIRS}
-    	DESTINATION ${INCLUDE_OUTPUT_DIRECTORY}
-	    PATTERN ".svn" EXCLUDE 
-	 )
-ELSE()
-    MESSAGE(SEND_ERROR " Boost was not found on your system, required for GENFIT.")
-ENDIF()
-
+INSTALL(DIRECTORY ${GF_INC_DIRS}
+        DESTINATION ${INCLUDE_OUTPUT_DIRECTORY}
+        PATTERN ".svn" EXCLUDE)
 
 IF(NOT CMAKE_BUILD_TYPE)
   SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
@@ -104,47 +100,24 @@ IF(NOT CMAKE_BUILD_TYPE)
       FORCE)
 ENDIF(NOT CMAKE_BUILD_TYPE)
 
-# Uncomment for coverage analysis.
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
-#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
-#SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
+SET(CPP_STANDARD c++11)
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=${CPP_STANDARD} -pthread -Wpedantic -Wall -Wextra \
+ -Wno-long-long -Wshadow -Werror=overloaded-virtual -Wunused-parameter -Waddress")
 
-include(CheckCXXCompilerFlag)
-SET(CPP_STANDARD c++03)
-# ROOT 6 requires C++11 support, enforced via headers
-IF (ROOT_found_version GREATER 59900)
-    SET(CPP_STANDARD c++11)
-ENDIF()
-MESSAGE(STATUS "Using C++ standard ${CPP_STANDARD}.")
-check_cxx_compiler_flag(-std=${CPP_STANDARD} HAS_STD_FLAG)
-check_cxx_compiler_flag(--std=${CPP_STANDARD} HAS_STD_FLAG_ALTERNATIVE)
-if (HAS_STD_FLAG)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${CPP_STANDARD}")
-elseif (HAS_STD_FLAG_ALTERNATIVE)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=${CPP_STANDARD}")
-else()
-  message("Neither -std=${CPP_STANDARD} nor --std=${CPP_STANDARD} seem to work.  Moving on.")
-endif()
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wno-long-long -Wshadow -Werror=overloaded-virtual"   )
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g3")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g")
 SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -O3 -g3")
-
-
-
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -O3 -g")
 
-# include directories 
-INCLUDE_DIRECTORIES( 
-	BEFORE 
-	${GF_INC_DIRS}
-	${ROOT_INCLUDE_DIRS})
 
+INCLUDE_DIRECTORIES(
+		BEFORE
+		${ROOT_INCLUDE_DIRS}
+		SYSTEM ${EIGEN3_INCLUDE_DIR}
+		${GF_INC_DIRS}
+)
 
-# add a target to generate API documentation with Doxygen
 FIND_PACKAGE(Doxygen)
-
-if(DOXYGEN_FOUND)
+IF(DOXYGEN_FOUND)
     CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY)
 
     ADD_CUSTOM_TARGET(doc
@@ -171,208 +144,202 @@ AUX_SOURCE_DIRECTORY( ./measurements/src  library_sources )
 AUX_SOURCE_DIRECTORY( ./trackReps/src     library_sources )
 AUX_SOURCE_DIRECTORY( ./utilities/src     library_sources )
 
-
 # Dictionary generation.  For the time being, we list classes one-by-one.
-MACRO (ROOT_GENERATE_DICTIONARY LIBNAME INFILES INCLUDE_DIRS_IN LINKDEF_FILE OUTFILE)
-  set (INCLUDE_DIRS)
-  foreach (_current_FILE ${INCLUDE_DIRS_IN})
-    set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE})   
-  endforeach (_current_FILE ${INCLUDE_DIRS_IN})
-
-  SET(EXTRA_DICT_ARGS "")
-  IF(ROOT_found_version GREATER 59900)
-    STRING(REGEX REPLACE "^(.*)\\.(.*)$" "\\1_rdict.pcm" OUTFILE_PCM "${OUTFILE}")
-    STRING(REGEX REPLACE "^(.*)Dict\\.(.*)$" "\\1.rootmap" OUTFILE_RMF "${OUTFILE}")
-    SET (OUTFILES ${OUTFILE} ${OUTFILE_PCM} ${OUTFILE_RMF})
-    SET(EXTRA_DICT_ARGS -inlineInputHeader -rmf ${OUTFILE_RMF} -rml ${LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
-  ELSE()
-    STRING(REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" OUTFILE_H "${OUTFILE}")
-    SET (OUTFILES ${OUTFILE} ${OUTFILE_H})
-  ENDIF()
-  
-  ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES}
-    COMMAND ${ROOT_CINT_EXECUTABLE}
-    ARGS -f ${OUTFILE} ${EXTRA_DICT_ARGS} -c ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE}
-    DEPENDS ${INFILES} ${LINKDEF_FILE})
-
-  STRING(REGEX REPLACE "/" "" OUTFILE_NO_SLASH "${OUTFILE}")
-  ADD_CUSTOM_TARGET(generate_${OUTFILE_NO_SLASH} DEPENDS ${OUTFILE})
-
-  IF(ROOT_found_version GREATER 59900)
-    # PCM files and rootmap-files should be installed
-    INSTALL(FILES ${OUTFILE_RMF} ${OUTFILE_PCM}
-            DESTINATION ${LIBRARY_OUTPUT_DIRECTORY})
-  ENDIF()
-ENDMACRO (ROOT_GENERATE_DICTIONARY)
-
 SET(CORE_DICTIONARY_SOURCES
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/AbsFinitePlane.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/AbsFitterInfo.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/AbsHMatrix.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/AbsTrackRep.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/DetPlane.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/FitStatus.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/IO.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/MaterialProperties.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/MeasuredStateOnPlane.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/MeasurementFactory.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/MeasurementOnPlane.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/MeasurementProducer.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/StateOnPlane.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/AbsMeasurement.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/ThinScatterer.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/Track.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/TrackCand.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/TrackCandHit.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/core/include/TrackPoint.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/finitePlanes/include/RectangularFinitePlane.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/AbsFinitePlane.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/AbsFitterInfo.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/AbsHMatrix.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/AbsTrackRep.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/DetPlane.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/FitStatus.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/IO.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/Material.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/MeasuredStateOnPlane.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/MeasurementFactory.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/MeasurementOnPlane.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/MeasurementProducer.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/StateOnPlane.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/AbsMeasurement.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/ThinScatterer.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/Track.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/TrackCand.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/TrackCandHit.h
+		${CMAKE_CURRENT_SOURCE_DIR}/core/include/TrackPoint.h
+		${CMAKE_CURRENT_SOURCE_DIR}/finitePlanes/include/RectangularFinitePlane.h
+)
+ROOT_GENERATE_DICTIONARY(
+		"${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
+		"${CORE_DICTIONARY_SOURCES}"
+		"${CMAKE_CURRENT_SOURCE_DIR}/core/include"
+		"${CMAKE_CURRENT_SOURCE_DIR}/core/src/coreLinkDef.h"
+		"${CMAKE_CURRENT_BINARY_DIR}/coreRootDict.cc"
 )
-ROOT_GENERATE_DICTIONARY("${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
-                         "${CORE_DICTIONARY_SOURCES}"
-                         "${CMAKE_CURRENT_SOURCE_DIR}/core/include"
-			 "${CMAKE_CURRENT_SOURCE_DIR}/core/src/coreLinkDef.h"
-			 "${CMAKE_CURRENT_BINARY_DIR}/coreRootDict.cc")
 SET(library_sources "${CMAKE_CURRENT_BINARY_DIR}/coreRootDict.cc" "${library_sources}")
 
 SET(EVENTDISPLAY_DICTIONARY_SOURCES
-  ${CMAKE_CURRENT_SOURCE_DIR}/eventDisplay/include/EventDisplay.h
+		${CMAKE_CURRENT_SOURCE_DIR}/eventDisplay/include/EventDisplay.h
+)
+ROOT_GENERATE_DICTIONARY(
+		"${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
+		"${EVENTDISPLAY_DICTIONARY_SOURCES}"
+		"${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/fitters/include;${CMAKE_CURRENT_SOURCE_DIR}/eventDisplay/include"
+		"${CMAKE_CURRENT_SOURCE_DIR}/eventDisplay/src/eventDisplayLinkDef.h"
+		"${CMAKE_CURRENT_BINARY_DIR}/eventDisplayRootDict.cc"
 )
-ROOT_GENERATE_DICTIONARY("${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
-                         "${EVENTDISPLAY_DICTIONARY_SOURCES}"
-                         "${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/fitters/include;${CMAKE_CURRENT_SOURCE_DIR}/eventDisplay/include"
-			 "${CMAKE_CURRENT_SOURCE_DIR}/eventDisplay/src/eventDisplayLinkDef.h"
-			 "${CMAKE_CURRENT_BINARY_DIR}/eventDisplayRootDict.cc")
 SET(library_sources "${CMAKE_CURRENT_BINARY_DIR}/eventDisplayRootDict.cc" "${library_sources}")
 
 SET(FITTERS_DICTIONARY_SOURCES
-  ${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/AbsKalmanFitter.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/KalmanFittedStateOnPlane.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/KalmanFitStatus.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/ReferenceStateOnPlane.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/KalmanFitterRefTrack.h
-
-  ${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/KalmanFitter.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/KalmanFitterInfo.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/DAF.h
+		${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/AbsKalmanFitter.h
+		${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/KalmanFittedStateOnPlane.h
+		${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/KalmanFitStatus.h
+		${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/ReferenceStateOnPlane.h
+		${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/KalmanFitterRefTrack.h
+		${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/KalmanFitter.h
+		${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/KalmanFitterInfo.h
+		${CMAKE_CURRENT_SOURCE_DIR}/fitters/include/DAF.h
+)
+ROOT_GENERATE_DICTIONARY(
+		"${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
+		"${FITTERS_DICTIONARY_SOURCES}"
+		"${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/fitters/include"
+		"${CMAKE_CURRENT_SOURCE_DIR}/fitters/src/fittersLinkDef.h"
+		"${CMAKE_CURRENT_BINARY_DIR}/fittersRootDict.cc"
 )
-ROOT_GENERATE_DICTIONARY("${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
-                         "${FITTERS_DICTIONARY_SOURCES}"
-                         "${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/fitters/include"
-			 "${CMAKE_CURRENT_SOURCE_DIR}/fitters/src/fittersLinkDef.h"
-			 "${CMAKE_CURRENT_BINARY_DIR}/fittersRootDict.cc")
 SET(library_sources "${CMAKE_CURRENT_BINARY_DIR}/fittersRootDict.cc" "${library_sources}")
 
 SET(GBL_DICTIONARY_SOURCES
-  ${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/GFGbl.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/GblFitter.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/ICalibrationParametersDerivatives.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/GblFitterInfo.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/GblFitStatus.h
+		${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/GFGbl.h
+		${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/GblFitter.h
+		${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/ICalibrationParametersDerivatives.h
+		${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/GblFitterInfo.h
+		${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/GblFitStatus.h
+		${CMAKE_CURRENT_SOURCE_DIR}/GBL/include/GblData.h
+)
+ROOT_GENERATE_DICTIONARY(
+		"${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
+        "${GBL_DICTIONARY_SOURCES}"
+		"${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/GBL/include"
+		"${CMAKE_CURRENT_SOURCE_DIR}/GBL/src/GBLLinkDef.h"
+		"${CMAKE_CURRENT_BINARY_DIR}/GBLRootDict.cc"
 )
-ROOT_GENERATE_DICTIONARY("${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
-                         "${GBL_DICTIONARY_SOURCES}"
-                         "${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/GBL/include"
-			 "${CMAKE_CURRENT_SOURCE_DIR}/GBL/src/GBLLinkDef.h"
-			 "${CMAKE_CURRENT_BINARY_DIR}/GBLRootDict.cc")
 SET(library_sources "${CMAKE_CURRENT_BINARY_DIR}/GBLRootDict.cc" "${library_sources}")
 
 SET(MEASUREMENTS_DICTIONARY_SOURCES
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/HMatrixPhi.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/HMatrixU.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/HMatrixUnit.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/HMatrixV.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/HMatrixUV.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/FullMeasurement.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/PlanarMeasurement.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/ProlateSpacepointMeasurement.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/SpacepointMeasurement.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/WireMeasurement.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/WireMeasurementNew.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/WirePointMeasurement.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/WireTrackCandHit.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/HMatrixPhi.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/HMatrixU.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/HMatrixUnit.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/HMatrixV.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/HMatrixUV.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/FullMeasurement.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/PlanarMeasurement.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/ProlateSpacepointMeasurement.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/SpacepointMeasurement.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/WireMeasurement.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/WireMeasurementNew.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/WirePointMeasurement.h
+		${CMAKE_CURRENT_SOURCE_DIR}/measurements/include/WireTrackCandHit.h
+)
+ROOT_GENERATE_DICTIONARY(
+		"${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
+		"${MEASUREMENTS_DICTIONARY_SOURCES}"
+        "${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/measurements/include"
+		"${CMAKE_CURRENT_SOURCE_DIR}/measurements/src/measurementsLinkDef.h"
+		"${CMAKE_CURRENT_BINARY_DIR}/measurementsRootDict.cc"
 )
-ROOT_GENERATE_DICTIONARY("${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
-                         "${MEASUREMENTS_DICTIONARY_SOURCES}"
-                         "${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/measurements/include"
-			 "${CMAKE_CURRENT_SOURCE_DIR}/measurements/src/measurementsLinkDef.h"
-			 "${CMAKE_CURRENT_BINARY_DIR}/measurementsRootDict.cc")
 SET(library_sources "${CMAKE_CURRENT_BINARY_DIR}/measurementsRootDict.cc" "${library_sources}")
 
 SET(TRACKREPS_DICTIONARY_SOURCES
-  ${CMAKE_CURRENT_SOURCE_DIR}/trackReps/include/RKTrackRep.h
+		${CMAKE_CURRENT_SOURCE_DIR}/trackReps/include/RKTrackRep.h
+)
+ROOT_GENERATE_DICTIONARY(
+		"${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
+		"${TRACKREPS_DICTIONARY_SOURCES}"
+		"${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/trackReps/include"
+		"${CMAKE_CURRENT_SOURCE_DIR}/trackReps/src/trackRepsLinkDef.h"
+		"${CMAKE_CURRENT_BINARY_DIR}/trackRepsRootDict.cc"
 )
-ROOT_GENERATE_DICTIONARY("${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
-                         "${TRACKREPS_DICTIONARY_SOURCES}"
-                         "${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/trackReps/include"
-			 "${CMAKE_CURRENT_SOURCE_DIR}/trackReps/src/trackRepsLinkDef.h"
-			 "${CMAKE_CURRENT_BINARY_DIR}/trackRepsRootDict.cc")
 SET(library_sources "${CMAKE_CURRENT_BINARY_DIR}/trackRepsRootDict.cc" "${library_sources}")
 
 SET(UTILITIES_DICTIONARY_SOURCES
-  ${CMAKE_CURRENT_SOURCE_DIR}/utilities/include/HelixTrackModel.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/utilities/include/MeasurementCreator.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/utilities/include/mySpacepointDetectorHit.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/utilities/include/mySpacepointMeasurement.h
+		${CMAKE_CURRENT_SOURCE_DIR}/utilities/include/HelixTrackModel.h
+		${CMAKE_CURRENT_SOURCE_DIR}/utilities/include/MeasurementCreator.h
+		${CMAKE_CURRENT_SOURCE_DIR}/utilities/include/mySpacepointDetectorHit.h
+		${CMAKE_CURRENT_SOURCE_DIR}/utilities/include/mySpacepointMeasurement.h
+)
+ROOT_GENERATE_DICTIONARY(
+		"${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
+		"${UTILITIES_DICTIONARY_SOURCES}"
+		"${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/utilities/include;${CMAKE_CURRENT_SOURCE_DIR}/measurements/include"
+		"${CMAKE_CURRENT_SOURCE_DIR}/utilities/src/utilitiesLinkDef.h"
+		"${CMAKE_CURRENT_BINARY_DIR}/utilitiesRootDict.cc"
 )
-ROOT_GENERATE_DICTIONARY("${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
-                         "${UTILITIES_DICTIONARY_SOURCES}"
-                         "${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/utilities/include;${CMAKE_CURRENT_SOURCE_DIR}/measurements/include"
-			 "${CMAKE_CURRENT_SOURCE_DIR}/utilities/src/utilitiesLinkDef.h"
-			 "${CMAKE_CURRENT_BINARY_DIR}/utilitiesRootDict.cc")
 SET(library_sources "${CMAKE_CURRENT_BINARY_DIR}/utilitiesRootDict.cc" "${library_sources}")
 
 if(DEFINED RAVE)
 	SET(GFRAVE_DICTIONARY_SOURCES
-	  ${CMAKE_CURRENT_SOURCE_DIR}/GFRave/include/GFRaveTrackParameters.h
-	  ${CMAKE_CURRENT_SOURCE_DIR}/GFRave/include/GFRaveVertex.h
+			${CMAKE_CURRENT_SOURCE_DIR}/GFRave/include/GFRaveTrackParameters.h
+			${CMAKE_CURRENT_SOURCE_DIR}/GFRave/include/GFRaveVertex.h
+	)
+	ROOT_GENERATE_DICTIONARY(
+			"${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
+			"${GFRAVE_DICTIONARY_SOURCES}"
+			"${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/GFRave/include"
+			"${CMAKE_CURRENT_SOURCE_DIR}/GFRave/src/GFRaveLinkDef.h"
+			"${CMAKE_CURRENT_BINARY_DIR}/GFRaveRootDict.cc"
 	)
-	ROOT_GENERATE_DICTIONARY("${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}"
-	                         "${GFRAVE_DICTIONARY_SOURCES}"
-	                         "${CMAKE_CURRENT_SOURCE_DIR}/core/include;${CMAKE_CURRENT_SOURCE_DIR}/GFRave/include"
-				 "${CMAKE_CURRENT_SOURCE_DIR}/GFRave/src/GFRaveLinkDef.h"
-				 "${CMAKE_CURRENT_BINARY_DIR}/GFRaveRootDict.cc")
 	SET(library_sources "${CMAKE_CURRENT_BINARY_DIR}/GFRaveRootDict.cc" "${library_sources}")
 endif()
 
 
 # install
 ADD_SHARED_LIBRARY( ${PROJECT_NAME} ${library_sources})
-INSTALL( TARGETS ${PROJECT_NAME} 
-	LIBRARY DESTINATION ${LIBRARY_OUTPUT_DIRECTORY}
-)
+INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${LIBRARY_OUTPUT_DIRECTORY})
 
 # link ROOT libraries
 if(DEFINED RAVE)
 	TARGET_LINK_LIBRARIES(
-		${PROJECT_NAME}
-		${ROOT_LIBS}  
-  		${RAVE_LDFLAGS_STR}
-  		-I${RAVE_INCLUDE_DIRS_I}
+			${PROJECT_NAME}
+			${ROOT_LIBS}
+			${RAVE_LDFLAGS_STR}
+			-I${RAVE_INCLUDE_DIRS_I}
   	)
 else()
 	TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${ROOT_LIBS})
 endif()
 
 
-# the examples, build with "make tests"
 ADD_CUSTOM_TARGET( tests )
-MACRO( ADD_GENFIT_TEST _testname )
-   ADD_EXECUTABLE( ${_testname} EXCLUDE_FROM_ALL ${ARGN} )
-   ADD_DEPENDENCIES( tests  ${_testname} )
-   TARGET_LINK_LIBRARIES( ${_testname} ${PROJECT_NAME}  ${ROOT_LIBS} -lGeom )
-    #INSTALL( TARGETS ${_testname} DESTINATION ${EXECUTABLE_INSTALL_DIR})
-ENDMACRO( ADD_GENFIT_TEST )
 
 ADD_GENFIT_TEST( fitterTests               test/fitterTests/main.cc)
 ADD_GENFIT_TEST( minimalFittingExample     test/minimalFittingExample/main.cc)
-ADD_GENFIT_TEST( minimalFittingExample2     test/minimalFittingExample/main2.cc)
+ADD_GENFIT_TEST( minimalFittingExample2    test/minimalFittingExample/main2.cc)
 ADD_GENFIT_TEST( measurementFactoryExample test/measurementFactoryExample/main.cc)
 ADD_GENFIT_TEST( streamerTest              test/streamerTest/main.cc)
 ADD_GENFIT_TEST( unitTests                 test/unitTests/main.cc)
-if(DEFINED RAVE)
+IF(DEFINED RAVE)
   ADD_GENFIT_TEST( vertexingTest           test/vertexingTest/main.cc)
   ADD_GENFIT_TEST( vertexingTestRead       test/vertexingTest/read.cc)
-endif()
+ENDIF()
+
+
+FIND_PACKAGE(GTest)
+IF(GTEST_FOUND)
+	ADD_EXECUTABLE(gtests
+			gtest/TestConstField.cpp
+			gtest/TestMaterialEffects.cpp
+			gtest/TestRKTrackRep.cpp
+			gtest/TestRootEigenTransformations.cpp
+			gtest/TestRKMatrixEigenTransformations.cpp
+			gtest/TestUnits.cpp
+			gtest/TestMaterial.cpp
+			)
+	TARGET_LINK_LIBRARIES(gtests ${GTEST_BOTH_LIBRARIES} ${ROOT_LIBS} ${PROJECT_NAME})  # gtest gtest_main
+	MESSAGE(STATUS  ${GTEST_INCLUDE_DIRS})
+	TARGET_INCLUDE_DIRECTORIES(gtests PUBLIC ${GTEST_INCLUDE_DIRS})
+	INSTALL(TARGETS gtests DESTINATION bin)
+ELSE()
+	MESSAGE(STATUS "GTest not installed or found -- skip building unittests.")
+ENDIF()
 
 # generate and install following configuration files
 #GENERATE_PACKAGE_CONFIGURATION_FILES( genfitConfig.cmake genfitConfigVersion.cmake )
diff --git a/GBL/include/GFGbl.h b/GBL/include/GFGbl.h
index 4e2e033cf2b654a1f65b06e884a2e7c687393cf9..4ab77c98914c3945444f3de328ffaa7808586041 100644
--- a/GBL/include/GFGbl.h
+++ b/GBL/include/GFGbl.h
@@ -117,7 +117,7 @@ namespace genfit {
      * Performs fit on a Track.
      * Hit resorting currently NOT supported.
      */
-    void processTrackWithRep(Track* trk, const AbsTrackRep* rep, bool resortHits = false);
+    void processTrackWithRep(Track* trk, const AbsTrackRep* rep, bool resortHits = false) override;
     
     
   public:
diff --git a/GBL/include/GblData.h b/GBL/include/GblData.h
index 2c54ee1eb31274bc67bd30eee4ec8d816c876e9c..fcf2f729cf46cb46b9a8a28e57e16e8de9332145 100644
--- a/GBL/include/GblData.h
+++ b/GBL/include/GblData.h
@@ -54,6 +54,7 @@ namespace gbl {
  */
 class GblData {
 public:
+        GblData() : theLabel(0), theValue(0.), thePrecision(-1.), theDownWeight(0.), thePrediction(0.) {};
 	GblData(unsigned int aLabel, double aMeas, double aPrec);
 	virtual ~GblData();
 	void addDerivatives(unsigned int iRow,
@@ -92,6 +93,8 @@ private:
 	std::vector<double> theDerivatives; ///< List of derivatives for fit
 	std::vector<int> globalLabels; ///< Labels for global derivatives
 	std::vector<double> globalDerivatives; ///< Global derivatives
+
+        ClassDef(GblData, 1)
 };
 }
 #endif /* GBLDATA_H_ */
diff --git a/GBL/include/GblFitStatus.h b/GBL/include/GblFitStatus.h
index d29957c75f419da9160aaf15a7fc57db534294df..ebfffc3fb8bec47d34d7bdc8257acd2703779f3c 100644
--- a/GBL/include/GblFitStatus.h
+++ b/GBL/include/GblFitStatus.h
@@ -46,7 +46,7 @@ namespace genfit {
     
     virtual ~GblFitStatus() {};
     
-    virtual FitStatus* clone() const {return new GblFitStatus(*this);}
+    virtual FitStatus* clone() const override {return new GblFitStatus(*this);}
     
     void setCurvature(bool useCurvature) {curvatureFlag_ = useCurvature;}
     bool hasCurvature() { return curvatureFlag_; }
@@ -62,7 +62,7 @@ namespace genfit {
     void setIsFittedWithReferenceTrack(bool fittedWithReferenceTrack = true) {fittedWithReferenceTrack_ = fittedWithReferenceTrack;}
     void setTrackLen(double trackLen) {trackLen_ = trackLen;}
     
-    virtual void Print(const Option_t* = "") const {;}
+    virtual void Print(const Option_t* = "") const override {;}
     
   protected:
     
@@ -76,7 +76,7 @@ namespace genfit {
     
   public:
     
-    ClassDef(GblFitStatus, 1)
+    ClassDefOverride(GblFitStatus, 1)
     
   };
   
diff --git a/GBL/include/GblFitter.h b/GBL/include/GblFitter.h
index bad9ae777fe60df8f5d8c948681e284641659704..2dda882f2a418408c3ceb0d4b7aca24daf2c5067 100644
--- a/GBL/include/GblFitter.h
+++ b/GBL/include/GblFitter.h
@@ -71,7 +71,7 @@ namespace genfit {
     /**
      * Default (and only) constructor
      */
-    GblFitter() : AbsFitter(), m_gblInternalIterations(""), m_enableScatterers(true), m_enableIntermediateScatterer(true), m_externalIterations(1), m_recalcJacobians(0), scatEpsilon(1.e-8), m_segmentController(NULL) {;}
+    GblFitter() : AbsFitter(), m_gblInternalIterations(""), m_enableScatterers(true), m_enableIntermediateScatterer(true), m_externalIterations(1), m_recalcJacobians(0), scatEpsilon(1.e-8), m_segmentController(nullptr) {;}
     
     /**
      * Destructor
@@ -152,7 +152,7 @@ namespace genfit {
      * Hit resorting currently supported (use only if necessary /wire chamber/ ... will 
      * extrapolate along whole track to sort the hits).
      */
-    void processTrackWithRep(Track* trk, const AbsTrackRep* rep, bool resortHits = false);
+    void processTrackWithRep(Track* trk, const AbsTrackRep* rep, bool resortHits = false) override;
     
     /**
      * @brief Propagate seed, populate track with scatterers
diff --git a/GBL/include/GblFitterInfo.h b/GBL/include/GblFitterInfo.h
index 257f4e6454bc99086925a47dacd4e0fe648afd5b..5d92b1d0253335434cd80939f907ebcd8d996976 100644
--- a/GBL/include/GblFitterInfo.h
+++ b/GBL/include/GblFitterInfo.h
@@ -40,10 +40,7 @@
 #include "AbsHMatrix.h"
 
 #include <vector>
-
-#ifndef __CINT__
-#include <boost/scoped_ptr.hpp>
-#endif
+#include <memory>
 
 
 namespace genfit {
@@ -156,7 +153,7 @@ namespace genfit {
      *                  If false, for backward
      * @return const genfit::MeasuredStateOnPlane&
      */
-    const MeasuredStateOnPlane& getFittedState(bool afterKink = true) const;
+    const MeasuredStateOnPlane& getFittedState(bool afterKink = true) const override;
 
     /**
      * @brief Get the residual
@@ -172,7 +169,7 @@ namespace genfit {
      *                              If false, diagonalized residual error incl. correlation from track fit is returned.
      * @return genfit::MeasurementOnPlane
      */
-    MeasurementOnPlane getResidual(unsigned int = 0, bool = false, bool onlyMeasurementErrors = true) const;
+    MeasurementOnPlane getResidual(unsigned int = 0, bool = false, bool onlyMeasurementErrors = true) const override;
     
     /**
      * @brief Get kink (residual) with diagonalized covariance (2D)
@@ -226,26 +223,26 @@ namespace genfit {
     void recalculateJacobian(GblFitterInfo* prevFitterInfo);
     
     virtual ~GblFitterInfo() {;}
-    virtual GblFitterInfo* clone() const;
-    bool hasMeasurements() const {return trackPoint_->hasRawMeasurements();}
-    bool hasReferenceState() const {return (refPrediction_(0) != 0.);}
-    bool hasForwardPrediction() const {return hasReferenceState();}
-    bool hasBackwardPrediction() const {return hasReferenceState();}
-    bool hasForwardUpdate() const {return hasForwardPrediction();}
-    bool hasBackwardUpdate() const {return hasBackwardPrediction();}
-    bool hasUpdate(int direction) const {if (direction < 0) return hasBackwardPrediction(); return hasForwardPrediction();}
+    virtual GblFitterInfo* clone() const override;
+    bool hasMeasurements() const override {return trackPoint_->hasRawMeasurements();}
+    bool hasReferenceState() const override {return (refPrediction_(0) != 0.);}
+    bool hasForwardPrediction() const override {return hasReferenceState();}
+    bool hasBackwardPrediction() const override {return hasReferenceState();}
+    bool hasForwardUpdate() const override {return hasForwardPrediction();}
+    bool hasBackwardUpdate() const override {return hasBackwardPrediction();}
+    bool hasUpdate(int direction) const override {if (direction < 0) return hasBackwardPrediction(); return hasForwardPrediction();}
     bool hasPredictionsAndUpdates() const {return (hasForwardPrediction() && hasBackwardPrediction() && hasForwardUpdate() && hasBackwardUpdate());}
 
-    void deleteForwardInfo() {;}
-    void deleteBackwardInfo() {;}
+    void deleteForwardInfo() override {;}
+    void deleteBackwardInfo() override {;}
     void deletePredictions() {
       deleteBackwardInfo();
       deleteForwardInfo();
     }
-    void deleteReferenceInfo() {;} // Empty because we really do not want to delete reference without a new one
-    void deleteMeasurementInfo() {;} // We do not keep the measurements
-    virtual void Print(const Option_t* = "") const;
-    virtual bool checkConsistency(const genfit::PruneFlags* = NULL) const;
+    void deleteReferenceInfo() override {;} // Empty because we really do not want to delete reference without a new one
+    void deleteMeasurementInfo() override {;} // We do not keep the measurements
+    virtual void Print(const Option_t* = "") const override;
+    virtual bool checkConsistency(const genfit::PruneFlags* = nullptr) const override;
        
   private:
     TMatrixD jacobian_;
@@ -266,18 +263,13 @@ namespace genfit {
     TVectorD measurement_;
     TMatrixDSym measCov_;
     TMatrixD hMatrix_;
-    
-    #ifndef __CINT__
-    mutable boost::scoped_ptr<MeasuredStateOnPlane> fittedStateBwd_; //!  cache
-    mutable boost::scoped_ptr<MeasuredStateOnPlane> fittedStateFwd_; //!  cache    
-    #else
-    class MeasuredStateOnPlane* fittedStateBwd_; //!  cache
-    class MeasuredStateOnPlane* fittedStateFwd_; //!  cache    
-    #endif
+
+    mutable std::unique_ptr<MeasuredStateOnPlane> fittedStateBwd_; //!  cache
+    mutable std::unique_ptr<MeasuredStateOnPlane> fittedStateFwd_; //!  cache
     
   public:
     
-    ClassDef(GblFitterInfo, 1)
+    ClassDefOverride(GblFitterInfo, 1)
     
   };
   
diff --git a/GBL/include/GblTrajectory.h b/GBL/include/GblTrajectory.h
index d3fb341e3a85304797506774d5457bcd95aa29ba..ff5a9fd7af4cc97d3700b40351077238784b7bf2 100644
--- a/GBL/include/GblTrajectory.h
+++ b/GBL/include/GblTrajectory.h
@@ -81,6 +81,7 @@ public:
 	void printTrajectory(unsigned int level = 0);
 	void printPoints(unsigned int level = 0);
 	void printData();
+        std::vector<GblData> getData() {return theData;}
 
 private:
 	unsigned int numAllPoints; ///< Number of all points on trajectory
diff --git a/GBL/include/ICalibrationParametersDerivatives.h b/GBL/include/ICalibrationParametersDerivatives.h
index 313114dd6e5b873790cbc73079bc00a2bf9aa532..5ff4f1a47b66097441108d27a61df2ff1bf95d4a 100644
--- a/GBL/include/ICalibrationParametersDerivatives.h
+++ b/GBL/include/ICalibrationParametersDerivatives.h
@@ -126,7 +126,7 @@ class ICalibrationParametersDerivatives {
     * @return TMatrixD Matrix with #rows = dimension of residual, #columns = number of parameters.
     * #columns must match labels().size().
     */
-   virtual TMatrixD derivatives(const genfit::StateOnPlane* sop) {return TMatrixD();}
+   virtual TMatrixD derivatives(const genfit::StateOnPlane*) {return TMatrixD();}
    
    /**
     * @brief Derivatives for additional local parameters to be fitted
diff --git a/GBL/src/GBLLinkDef.h b/GBL/src/GBLLinkDef.h
index f8279c2211abfaa9ad48c1c4c298757c9352fe87..42144fff283a1e61dcd50d3f67e4e35fde1ad2ee 100644
--- a/GBL/src/GBLLinkDef.h
+++ b/GBL/src/GBLLinkDef.h
@@ -1,14 +1,10 @@
-#ifdef __CINT__
-
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
 
-#ifdef __CLING__
 #pragma link C++ nestedclass;
 #pragma link C++ nestedtypedef;
 #pragma link C++ namespace genfit;
-#endif
 
 #pragma link C++ class genfit::GFGbl+;
 #pragma link C++ class genfit::GblFitter+;
@@ -16,5 +12,5 @@
 #pragma link C++ class genfit::GblFitStatus+;
 #pragma link C++ class genfit::GblFitterInfo+;
 #pragma link C++ class genfit::GblTrackSegmentController+;
-
-#endif
+#pragma link C++ class gbl::GblData+;
+#pragma link C++ class vector<gbl::GblData>+;
diff --git a/GBL/src/GFGbl.cc b/GBL/src/GFGbl.cc
index 8f0866bb8b5368148610c42f1ae0feebcdd92f3e..01d3444f7dd33f05451ca00e0befd8060f3fa30f 100644
--- a/GBL/src/GFGbl.cc
+++ b/GBL/src/GFGbl.cc
@@ -280,7 +280,7 @@ void getScattererFromMatList(double& length, double& theta, double& s, double& d
   for (unsigned int i = 0; i < steps.size(); i++) {
     const MatStep step = steps.at(i);
     // inverse of material radiation length ... (in 1/cm) ... "density of scattering"
-    double rho = 1. / step.materialProperties_.getRadLen();
+    double rho = 1. / step.material_.radiationLength;
     len += fabs(step.stepSize_);
     xmin = xmax;
     xmax = xmin + fabs(step.stepSize_);
@@ -523,7 +523,7 @@ void GFGbl::processTrackWithRep(Track* trk, const AbsTrackRep* rep, bool resortH
       // Covariance matrix of measurement
       TMatrixDSym raw_cov = raw_meas->getRawHitCov();
       // Projection matrix from repository state to measurement coords
-      boost::scoped_ptr<const AbsHMatrix> HitHMatrix(raw_meas->constructHMatrix(rep));
+      std::unique_ptr<const AbsHMatrix> HitHMatrix(raw_meas->constructHMatrix(rep));
       // Residual between measured position and reference track position
       TVectorD residual = -1. * (raw_coor - HitHMatrix->Hv(state));
 
diff --git a/GBL/src/GblFitter.cc b/GBL/src/GblFitter.cc
index dc34f6decf9d4477f9398859cb2f7cd5acd7cdd6..e85cae76cad0ef070c72b33c76968c4c30d2acb0 100644
--- a/GBL/src/GblFitter.cc
+++ b/GBL/src/GblFitter.cc
@@ -77,7 +77,6 @@
 #include <TVectorDfwd.h>
 #include <TMatrixT.h>
 #include <TVector3.h>
-//#include "boost/algorithm/string.hpp"
 
 //#define DEBUG
 
@@ -91,7 +90,7 @@ using namespace genfit;
 GblFitter::~GblFitter() {
   if (m_segmentController) {
     delete m_segmentController;
-    m_segmentController = NULL;
+    m_segmentController = nullptr;
   }
 }
 
@@ -99,7 +98,7 @@ void GblFitter::setTrackSegmentController(GblTrackSegmentController* controler)
 {
   if (m_segmentController) {
     delete m_segmentController;
-    m_segmentController = NULL;
+    m_segmentController = nullptr;
   }
   m_segmentController = controler;      
 }
@@ -153,8 +152,7 @@ void GblFitter::processTrackWithRep(Track* trk, const AbsTrackRep* rep, bool res
   int fitRes = 0;
   std::vector<std::string> gblIterations;
   gblIterations.push_back(m_gblInternalIterations);
-  //boost::split(gblIterations, m_gblInternalIterations, boost::is_any_of(","), boost::token_compress_off);
-  
+
   // Iterations and updates of fitter infos and fit status
   // ------------------------------------------------------------------- 
   for (unsigned int iIter = 0; iIter < m_externalIterations; iIter++) {
@@ -234,7 +232,7 @@ void GblFitter::processTrackWithRep(Track* trk, const AbsTrackRep* rep, bool res
 void GblFitter::cleanGblInfo(Track* trk, const AbsTrackRep* rep) const {
   
   for (int ip = trk->getNumPoints() - 1; ip >=0; ip--) {
-    trk->getPoint(ip)->setScatterer(NULL); 
+    trk->getPoint(ip)->setScatterer(nullptr); 
     trk->getPoint(ip)->deleteFitterInfo(rep);
     //TODO
     if (!trk->getPoint(ip)->hasRawMeasurements())
@@ -335,7 +333,7 @@ void GblFitter::getScattererFromMatList(double& length,
   for (unsigned int i = 0; i < steps.size(); i++) {
     const MatStep step = steps.at(i);
     // inverse of material radiation length ... (in 1/cm) ... "density of scattering"
-    double rho = 1. / step.materialProperties_.getRadLen();
+    double rho = 1. / step.material_.radiationLength;
     len += fabs(step.stepSize_);
     xmin = xmax;
     xmax = xmin + fabs(step.stepSize_);
@@ -475,7 +473,7 @@ double GblFitter::constructGblInfo(Track* trk, const AbsTrackRep* rep)
     // --------------------------------------------
     
     if (theta1 > scatEpsilon)  
-      point_meas->setScatterer(new ThinScatterer(plane, MaterialProperties(theta1, 0., 0., 0., 0.))); 
+      point_meas->setScatterer(new ThinScatterer(plane, Material(theta1, 0., 0., 0., 0.)));
     
     GblFitterInfo* gblfimeas(new GblFitterInfo(point_meas, rep, reference));
     gblfimeas->setJacobian(jacPointToPoint);
@@ -495,7 +493,7 @@ double GblFitter::constructGblInfo(Track* trk, const AbsTrackRep* rep)
       // --------------------------------------
       TrackPoint* scattp = new TrackPoint(trk);
       scattp->setSortingParameter(point_meas->getSortingParameter() + s2);
-      scattp->setScatterer(new ThinScatterer(reference.getPlane(), MaterialProperties(theta2, 0., 0., 0., 0.)));
+      scattp->setScatterer(new ThinScatterer(reference.getPlane(), Material(theta2, 0., 0., 0., 0.)));
       // Add point to track before next point
       int pointIndex = 0;
       //TODO Deduce this rather than looping over all points
diff --git a/GBL/src/GblFitterInfo.cc b/GBL/src/GblFitterInfo.cc
index e1fc3dbf90099f68577608e4eaaddb15e45f848c..4ae7569f11bed552b6c1ce7405d784b23250bdda 100644
--- a/GBL/src/GblFitterInfo.cc
+++ b/GBL/src/GblFitterInfo.cc
@@ -128,10 +128,10 @@ namespace genfit {
         //thePoint.addScatterer(getKinks(), kinkPrec);
         //TODO: if state at scatterer is updated, the direction of track might not be perpendicular anymore
         // plane does not change at pure scatterer
-        TMatrixDSym kinkCov = getCovariance(trackPoint_->getMaterialInfo()->getMaterial().getDensity(), sop.getDir(), sop.getPlane());
+        TMatrixDSym kinkCov = getCovariance(trackPoint_->getMaterialInfo()->getMaterial().density, sop.getDir(), sop.getPlane());
         thePoint.addScatterer(getKinks(), kinkCov.Invert());
       } else {
-        TMatrixDSym kinkCov = getCovariance(trackPoint_->getMaterialInfo()->getMaterial().getDensity(), sop.getDir(), sop.getPlane());
+        TMatrixDSym kinkCov = getCovariance(trackPoint_->getMaterialInfo()->getMaterial().density, sop.getDir(), sop.getPlane());
         thePoint.addScatterer(getKinks(), kinkCov.Invert());
       }      
     }
@@ -168,7 +168,7 @@ namespace genfit {
     }
     
     // Derivatives      
-    ICalibrationParametersDerivatives* globals = NULL;
+    ICalibrationParametersDerivatives* globals = nullptr;
     if (hasMeasurements() && (globals = dynamic_cast<ICalibrationParametersDerivatives*>(trackPoint_->getRawMeasurement(0)) )) {    
       std::pair<std::vector<int>, TMatrixD> labelsAndMatrix = globals->globalDerivatives(&sop);
       std::vector<int> labels = labelsAndMatrix.first;
diff --git a/GFRave/include/GFRaveConverters.h b/GFRave/include/GFRaveConverters.h
index 9c6dc58a2141778e0211de17849a80da648349c9..af0ece4690a8b12dbbba175983d7540a53bab473 100644
--- a/GFRave/include/GFRaveConverters.h
+++ b/GFRave/include/GFRaveConverters.h
@@ -62,13 +62,13 @@ namespace genfit {
    * Ownership over MeasuredStateOnPlane will be taken.
    */
   std::vector < rave::Track > GFTracksToTracks(const std::vector < genfit::Track* > & GFTracks,
-                                               std::vector < genfit::MeasuredStateOnPlane* > * GFStates, // = NULL
+                                               std::vector < genfit::MeasuredStateOnPlane* > * GFStates, // = nullptr
                                                std::map<int, genfit::trackAndState>& IdGFTrackStateMap,
                                                int startID = 0);
 
   rave::Track GFTrackToTrack(trackAndState, int id = -1, std::string tag="");
   //rave::Track MeasuredStateOnPlaneToTrack(const MeasuredStateOnPlane* state, const rave::Track& orig);
-  //rave::Track MeasuredStateOnPlaneToTrack(const MeasuredStateOnPlane* state, int id = -1, Track* originaltrack = NULL, std::string tag="");
+  //rave::Track MeasuredStateOnPlaneToTrack(const MeasuredStateOnPlane* state, int id = -1, Track* originaltrack = nullptr, std::string tag="");
 
   // RAVE to GENFIT
   /** set state and cov of a MeasuredStateOnPlane according to rave track
diff --git a/GFRave/include/GFRaveTrackParameters.h b/GFRave/include/GFRaveTrackParameters.h
index ee8426d4c040dd4c84f87a9b03b08e2dcdf8a432..712ed775bc11a2660304df712b6a78b45a6f35ef 100644
--- a/GFRave/include/GFRaveTrackParameters.h
+++ b/GFRave/include/GFRaveTrackParameters.h
@@ -59,7 +59,7 @@ class GFRaveTrackParameters : public TObject
     // Accessors
     double getWeight() const {return weight_;}
 
-    bool hasTrack() const {return originalTrack_.GetObject() != NULL;}
+    bool hasTrack() const {return originalTrack_.GetObject() != nullptr;}
     const Track* getTrack() const {return  static_cast<Track*>(originalTrack_.GetObject());}
 
     UInt_t GetUniqueID() const {return originalTrack_.GetUniqueID();}
diff --git a/GFRave/src/GFRaveConverters.cc b/GFRave/src/GFRaveConverters.cc
index ab0996c3afae5ac5c7aff8f0b25716cc4476e17f..31f8879d9af1cc1de1092acb6cbd35c216fb639e 100644
--- a/GFRave/src/GFRaveConverters.cc
+++ b/GFRave/src/GFRaveConverters.cc
@@ -40,7 +40,7 @@ GFTracksToTracks(const std::vector < genfit::Track* >  & GFTracks,
 
   unsigned int ntracks(GFTracks.size());
 
-  if (GFStates != NULL)
+  if (GFStates != nullptr)
     if (GFTracks.size() != GFStates->size()) {
       Exception exc("GFTracksToTracks ==> GFStates has not the same size as GFTracks!",__LINE__,__FILE__);
       throw exc;
@@ -51,8 +51,8 @@ GFTracksToTracks(const std::vector < genfit::Track* >  & GFTracks,
 
   for (unsigned int i=0; i<ntracks; ++i){
 
-    if (GFTracks[i] == NULL) {
-      Exception exc("GFTracksToTracks ==> genfit::Track is NULL",__LINE__,__FILE__);
+    if (GFTracks[i] == nullptr) {
+      Exception exc("GFTracksToTracks ==> genfit::Track is nullptr",__LINE__,__FILE__);
       throw exc;
     }
 
@@ -64,7 +64,7 @@ GFTracksToTracks(const std::vector < genfit::Track* >  & GFTracks,
       throw exc;
     }
     IdGFTrackStateMap[startID].track_ = GFTracks[i];
-    if (GFStates == NULL)
+    if (GFStates == nullptr)
       IdGFTrackStateMap[startID].state_ = new MeasuredStateOnPlane(GFTracks[i]->getFittedState()); // here clones are made so that the state of the original GFTracks and their TrackReps will not be altered by the vertexing process
     else
       IdGFTrackStateMap[startID].state_ = (*GFStates)[i];
@@ -82,8 +82,8 @@ GFTracksToTracks(const std::vector < genfit::Track* >  & GFTracks,
 rave::Track
 GFTrackToTrack(trackAndState trackAndState, int id, std::string tag){
 
-  if (trackAndState.track_ == NULL) {
-    Exception exc("GFTrackToTrack ==> originaltrack is NULL",__LINE__,__FILE__);
+  if (trackAndState.track_ == nullptr) {
+    Exception exc("GFTrackToTrack ==> originaltrack is nullptr",__LINE__,__FILE__);
     throw exc;
   }
 
diff --git a/GFRave/src/GFRavePropagator.cc b/GFRave/src/GFRavePropagator.cc
index c86421987283928b41311423faca2e3309a6f2d7..2bff5ac57fe9556c83de774b93ad5da0f973b6de 100644
--- a/GFRave/src/GFRavePropagator.cc
+++ b/GFRave/src/GFRavePropagator.cc
@@ -28,7 +28,7 @@
 namespace genfit {
 
 GFRavePropagator::GFRavePropagator() :
-    IdGFTrackStateMap_(NULL)
+    IdGFTrackStateMap_(nullptr)
 {
   //std::cout << "GFRavePropagator::GFRavePropagator() \n";
 }
@@ -92,8 +92,8 @@ GFRavePropagator::setIdGFTrackStateMap(std::map < int, genfit::trackAndState > *
 
   IdGFTrackStateMap_ = map;
 
-  if (IdGFTrackStateMap_==NULL) {
-    Exception exc("GFRavePropagator::setIdGFMeasuredStateOnPlaneMap ==> map is NULL!",__LINE__,__FILE__);
+  if (IdGFTrackStateMap_==nullptr) {
+    Exception exc("GFRavePropagator::setIdGFMeasuredStateOnPlaneMap ==> map is nullptr!",__LINE__,__FILE__);
     throw exc;
   }
   //std::cout<<"IdGFTrackStateMap_: " << (int)IdGFTrackStateMap_ << std::endl;
diff --git a/GFRave/src/GFRaveTrackParameters.cc b/GFRave/src/GFRaveTrackParameters.cc
index fe152b7aed09545960fbe3944b206c988c237413..b3548365528c68525236e940c4d902f4373a3bc0 100644
--- a/GFRave/src/GFRaveTrackParameters.cc
+++ b/GFRave/src/GFRaveTrackParameters.cc
@@ -29,7 +29,7 @@ namespace genfit {
 
 
 GFRaveTrackParameters::GFRaveTrackParameters() :
-  originalTrack_(NULL),
+  originalTrack_(nullptr),
   weight_(0),
   state_(6),
   cov_(6,6),
diff --git a/GFRave/src/GFRaveVertexFactory.cc b/GFRave/src/GFRaveVertexFactory.cc
index a60428e747bc4c76ff49026cb0ff88ab5fc39ae4..3b51b4616acfd21cc69bc8c2c24d8a6a3091c486 100644
--- a/GFRave/src/GFRaveVertexFactory.cc
+++ b/GFRave/src/GFRaveVertexFactory.cc
@@ -72,7 +72,7 @@ GFRaveVertexFactory::findVertices ( std::vector <  genfit::GFRaveVertex* > * GFv
 
   try{
     RaveToGFVertices(GFvertices,
-                     factory_->create(GFTracksToTracks(GFTracks, NULL, IdGFTrackStateMap_, 0),
+                     factory_->create(GFTracksToTracks(GFTracks, nullptr, IdGFTrackStateMap_, 0),
                                       use_beamspot),
                      IdGFTrackStateMap_);
   }
diff --git a/README.build b/README.build
index f48f4a43fd4065a813e7a20bad659945b6937b2a..6001d98ec530bab027a1956c2fe31e5c440c415c 100644
--- a/README.build
+++ b/README.build
@@ -5,9 +5,6 @@ To create the library, create a build directory and change into it. E.g.
  
 Now create the Makefiles by invoking:
   cmake ..
- 
-On some systems with an older boost version, you instead might have to type (cf. http://stackoverflow.com/questions/9948375/cmake-find-package-succeeds-but-returns-wrong-path):
-  cmake .. -DBoost_NO_BOOST_CMAKE=ON
 
 And build:
   make
@@ -25,6 +22,11 @@ To build the doxygen:
 To build the examples/tests (also see README in test/):
   make tests
 
+The ROOT dicitionary requires to know the include paths of the libraries during runtime. To run GenFit, one has to
+define the ROOT_INCLUDE_PATH environment variable. The reason is, that we use the from Eigen recommended include pattern
+e.g. Eigen/Dense and not eigen3/Eigen/Dense. Because of this, the ROOT dictionaries can not find the headers. Run
+  export ROOT_INCLUDE_PATH=/path/to/eigen3
+to make the Eigen headers visible.
 
 
 To build GFRave and the vertexing examples, you need an installation of Rave (https://rave.hepforge.org/), and the environment variable RAVEPATH set.
diff --git a/README.md b/README.md
index e5d136081c3c605997622479f8c7fd171f295d7c..18836a6a105154e9de88f6704037a61655778841 100644
--- a/README.md
+++ b/README.md
@@ -6,17 +6,17 @@ GenFit is an experiment-independent framework for track reconstruction for parti
 
 * Track fitting algorithms
 
-    Currently, GENFIT contains a Kalman Filter and a Deterministic Annealing Filter. Other algorithm modules can be added easily.
+  Currently, GENFIT contains a Kalman Filter, a Deterministic Annealing Filter, and a General Broken Lines fitter. Other algorithm modules can be added easily.
 
 * Track representations
 
-  These modules hold the data of track track parameters and can perform extrapolations of these parameters. GENFIT is distributed with two well-tested track representations.
+  These modules can perform extrapolations of track parameters through material and magnetic fields. GENFIT is distributed with a well-tested track representation.
   Existing track extrapolation codes can be interfaced in a very straightforward way in this framework, using their native geometry and magnetic field interfaces.
 
-* Reconstruction hits
+* Measurements
   
-  The hit dimensionality and the orientation of planar tracking detectors can be chosen freely. GENFIT is especially useful for tracking systems which include detectors which do not measure the passage of particles on predefined planes, like TPCs or wire-based drift chambers. The concept of so-called virtual detector planes provides a simple mechanism to use these detector hits in a transparent way without any geometrical simplifications.
+  The measurement dimensionality and the orientation of planar tracking detectors can be chosen freely. GENFIT is especially useful for tracking systems which include detectors which do not measure the passage of particles on predefined planes, like TPCs or wire-based drift chambers. The concept of so-called virtual detector planes provides a simple mechanism to use these detector hits in a transparent way without any geometrical simplifications.
 
 GenFit has been developed in the framework of the PANDA experiment at FAIR, Darmstadt, Germany. It is also used in the Belle-2, Fopi, and GEM-TPC experiments.
 
-GenFit Homepage: (http://genfit.sourceforge.net)
+GenFit Homepage: (https://github.com/GenFit/GenFit)
diff --git a/cmake/FindROOT.cmake b/cmake/FindROOT.cmake
index 38b98b3deab2015184d7f53816d4533163310fdd..44f84c5f139d0027f6733746228b3621437e52d6 100644
--- a/cmake/FindROOT.cmake
+++ b/cmake/FindROOT.cmake
@@ -152,11 +152,7 @@ IF( ROOT_CONFIG_EXECUTABLE )
     # find rootcint
     SET( ROOT_CINT_EXECUTABLE ROOT_CINT_EXECUTABLE-NOTFOUND )
     MARK_AS_ADVANCED( ROOT_CINT_EXECUTABLE )
-    IF(ROOT_found_version GREATER 59900)
-      FIND_PROGRAM( ROOT_CINT_EXECUTABLE NAMES rootcling PATHS ${ROOT_BIN_DIR} NO_DEFAULT_PATH )
-    ELSE()
-      FIND_PROGRAM( ROOT_CINT_EXECUTABLE NAMES rootcint PATHS ${ROOT_BIN_DIR} NO_DEFAULT_PATH )
-    ENDIF()
+    FIND_PROGRAM( ROOT_CINT_EXECUTABLE NAMES rootcling PATHS ${ROOT_BIN_DIR} NO_DEFAULT_PATH )
 
     IF( NOT ROOT_FIND_QUIETLY )
         MESSAGE( STATUS "Check for ROOT_CINT_EXECUTABLE: ${ROOT_CINT_EXECUTABLE}" )
diff --git a/cmake/genfit.cmake b/cmake/genfit.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..a0f96dc89221cc5b3a2ce3dc6ef0e4508b4063d1
--- /dev/null
+++ b/cmake/genfit.cmake
@@ -0,0 +1,32 @@
+MACRO( ADD_GENFIT_TEST _testname )
+    ADD_EXECUTABLE( ${_testname} EXCLUDE_FROM_ALL ${ARGN} )
+    ADD_DEPENDENCIES( tests  ${_testname} )
+    TARGET_LINK_LIBRARIES( ${_testname} ${PROJECT_NAME}  ${ROOT_LIBS} -lGeom )
+    #INSTALL( TARGETS ${_testname} DESTINATION ${EXECUTABLE_INSTALL_DIR})
+ENDMACRO( ADD_GENFIT_TEST )
+
+MACRO (ROOT_GENERATE_DICTIONARY LIBNAME INFILES INCLUDE_DIRS_IN LINKDEF_FILE OUTFILE)
+    SET (INCLUDE_DIRS)
+    FOREACH (_current_FILE ${INCLUDE_DIRS_IN})
+        set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE})
+    ENDFOREACH (_current_FILE ${INCLUDE_DIRS_IN})
+    SET(INCLUDE_DIRS ${INCLUDE_DIRS} -isystem${EIGEN3_INCLUDE_DIR})
+
+    SET(EXTRA_DICT_ARGS "")
+    STRING(REGEX REPLACE "^(.*)\\.(.*)$" "\\1_rdict.pcm" OUTFILE_PCM "${OUTFILE}")
+    STRING(REGEX REPLACE "^(.*)Dict\\.(.*)$" "\\1.rootmap" OUTFILE_RMF "${OUTFILE}")
+    SET (OUTFILES ${OUTFILE} ${OUTFILE_PCM} ${OUTFILE_RMF})
+    SET(EXTRA_DICT_ARGS -inlineInputHeader -rmf ${OUTFILE_RMF} -rml ${LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
+
+    ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES}
+            COMMAND ${ROOT_CINT_EXECUTABLE}
+            ARGS -f ${OUTFILE} ${EXTRA_DICT_ARGS} -c ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE}
+            DEPENDS ${INFILES} ${LINKDEF_FILE})
+
+    STRING(REGEX REPLACE "/" "" OUTFILE_NO_SLASH "${OUTFILE}")
+    ADD_CUSTOM_TARGET(generate_${OUTFILE_NO_SLASH} DEPENDS ${OUTFILE})
+
+    # PCM files and rootmap-files should be installed
+    INSTALL(FILES ${OUTFILE_RMF} ${OUTFILE_PCM}
+            DESTINATION ${LIBRARY_OUTPUT_DIRECTORY})
+ENDMACRO (ROOT_GENERATE_DICTIONARY)
diff --git a/core/include/AbsFitterInfo.h b/core/include/AbsFitterInfo.h
index 1f9f777167b8708831b60790e0340cf79376ab10..ba91b3dae391c55b0729f2d9a86f0a50f032a6eb 100644
--- a/core/include/AbsFitterInfo.h
+++ b/core/include/AbsFitterInfo.h
@@ -79,7 +79,7 @@ class AbsFitterInfo : public TObject {
 
   virtual void Print(const Option_t* = "") const {;}
 
-  virtual bool checkConsistency(const PruneFlags* = NULL) const = 0;
+  virtual bool checkConsistency(const PruneFlags* = nullptr) const = 0;
 
  protected:
 
diff --git a/core/include/AbsTrackRep.h b/core/include/AbsTrackRep.h
index a8596c55968f9ff21b55d4b4f1dd9c8967cec50e..e143403a9ed14e0d02ebbea35961cbe7d1259084 100644
--- a/core/include/AbsTrackRep.h
+++ b/core/include/AbsTrackRep.h
@@ -25,7 +25,7 @@
 
 #include "SharedPlanePtr.h"
 //#include "MaterialInfo.h"
-#include "MaterialProperties.h"
+#include "Material.h"
 
 #include <TVector3.h>
 #include <TObject.h>
@@ -40,7 +40,7 @@ namespace genfit {
  * @brief Simple struct containing MaterialProperties and stepsize in the material.
  */
 struct MatStep {
-  MaterialProperties materialProperties_;
+  Material material_;
   double stepSize_;
 
   MatStep() {
diff --git a/core/include/Constants.h b/core/include/Constants.h
new file mode 100644
index 0000000000000000000000000000000000000000..d66e170e417f90aebbccfad903dd73c094e7078a
--- /dev/null
+++ b/core/include/Constants.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "EigenMatrixTypedefs.h"
+#include "Units.h"
+
+namespace genfit {
+
+    namespace Constants {
+
+        constexpr Scalar electronMass = 0.510998910 * Unit::MeV;
+
+    }
+
+}
\ No newline at end of file
diff --git a/core/include/DetPlane.h b/core/include/DetPlane.h
index 8d750d56515d7a38c7ef41efbc8dd003e05026fc..1436f2bdb9a7a5bd466a03fbdf639945c202ac17 100644
--- a/core/include/DetPlane.h
+++ b/core/include/DetPlane.h
@@ -36,9 +36,7 @@
 #include <TObject.h>
 #include <TVector3.h>
 
-#ifndef __CINT__
-#include <boost/scoped_ptr.hpp>
-#endif
+#include <memory>
 
 
 namespace genfit {
@@ -64,16 +62,16 @@ class DetPlane : public TObject {
 
 
   // Constructors/Destructors ---------
-  DetPlane(AbsFinitePlane* finite = NULL);
+  DetPlane(AbsFinitePlane* finite = nullptr);
 
   DetPlane(const TVector3& o,
              const TVector3& u,
              const TVector3& v,
-             AbsFinitePlane* finite = NULL);
+             AbsFinitePlane* finite = nullptr);
 
   DetPlane(const TVector3& o,
              const TVector3& n,
-             AbsFinitePlane* finite = NULL);
+             AbsFinitePlane* finite = nullptr);
 
   virtual ~DetPlane();
 
@@ -144,14 +142,14 @@ class DetPlane : public TObject {
 
   //! intersect in the active area? C.f. AbsFinitePlane
   bool isInActive(const TVector3& point, const TVector3& dir) const {
-    if(finitePlane_.get() == NULL) return true;
+    if(finitePlane_.get() == nullptr) return true;
     return this->isInActive( this->straightLineToPlane(point,dir));
   }
 
   //! intersect in the active area? C.f. AbsFinitePlane
   bool isInActive(const double& posX, const double& posY, const double& posZ,
                   const double& dirX, const double& dirY, const double& dirZ) const {
-    if(finitePlane_.get() == NULL) return true;
+    if(finitePlane_.get() == nullptr) return true;
     double u, v;
     this->straightLineToPlane(posX, posY, posZ, dirX, dirY, dirZ, u, v);
     return this->isInActive(u, v);
@@ -159,7 +157,7 @@ class DetPlane : public TObject {
 
   //! isInActive methods refer to finite plane. C.f. AbsFinitePlane
   bool isInActive(double u, double v) const{
-    if(finitePlane_.get() == NULL) return true;
+    if(finitePlane_.get() == nullptr) return true;
     return finitePlane_->isInActive(u,v);
   }
 
@@ -169,7 +167,7 @@ class DetPlane : public TObject {
   }
 
   bool isFinite() const {
-    return (finitePlane_.get() != NULL);
+    return (finitePlane_.get() != nullptr);
   }
 
   //! rotate u and v around normal. Angle is in rad. More for debugging than for actual use.
@@ -187,12 +185,7 @@ class DetPlane : public TObject {
   TVector3 u_;
   TVector3 v_;
 
-#ifndef __CINT__
-  boost::scoped_ptr<AbsFinitePlane> finitePlane_; // Ownership
-#else
-  class AbsFinitePlane* finitePlane_; //! Shut ROOT up, this class has a custom streamer.
-#endif
-
+  std::unique_ptr<AbsFinitePlane> finitePlane_; // Ownership
 
  public:
   ClassDef(DetPlane,1)
diff --git a/core/include/EigenMatrixTypedefs.h b/core/include/EigenMatrixTypedefs.h
new file mode 100644
index 0000000000000000000000000000000000000000..dd39ddb2e9d6b55e35314082c12230f17e6ff2d4
--- /dev/null
+++ b/core/include/EigenMatrixTypedefs.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <Eigen/Dense>
+
+namespace genfit {
+    typedef double Precision;
+
+    typedef Precision Scalar;
+
+    typedef Eigen::Matrix<Precision, 3, 1> Vector3;
+    typedef Eigen::Matrix<Precision, 5, 1> Vector5;
+    typedef Eigen::Matrix<Precision, 6, 1> Vector6;
+    typedef Eigen::Matrix<Precision, 7, 1> Vector7;
+
+    typedef Eigen::Matrix<Precision, 3, 3> Matrix3x3;
+    typedef Eigen::Matrix<Precision, 4, 4> Matrix4x4;
+    typedef Eigen::Matrix<Precision, 5, 5> Matrix5x5;
+    typedef Eigen::Matrix<Precision, 6, 6> Matrix6x6;
+    typedef Eigen::Matrix<Precision, 7, 7> Matrix7x7;
+
+    typedef Eigen::Matrix<Precision, Eigen::Dynamic, 1> VectorDynamic;
+    typedef Eigen::Matrix<Precision, Eigen::Dynamic, Eigen::Dynamic> MatrixDynamic;
+
+    typedef Matrix3x3 Matrix3x3Sym;
+    typedef Matrix4x4 Matrix4x4Sym;
+    typedef Matrix5x5 Matrix5x5Sym;
+    typedef Matrix6x6 Matrix6x6Sym;
+    typedef Matrix7x7 Matrix7x7Sym;
+}
\ No newline at end of file
diff --git a/core/include/Exception.h b/core/include/Exception.h
index 212e0244751cc65304039927553ea2356a4be617..25405802bf7427d939f4e066b22d4aa9a86a2132 100644
--- a/core/include/Exception.h
+++ b/core/include/Exception.h
@@ -55,7 +55,7 @@ class Exception : public std::exception {
    * @param file sourcefile in which the exception is created. Can be set through __FILE__ macro.
    */
   Exception(std::string excString, int line, std::string  file);
-  virtual ~Exception() throw();
+  virtual ~Exception() noexcept;
 
   //! Set fatal flag.
   void setFatal (bool b=true){fatal_=b;}
@@ -70,7 +70,7 @@ class Exception : public std::exception {
   void info();
 
   //! Standard error message handling for exceptions. use like "std::cerr << e.what();"
-  virtual const char* what() const throw();
+  virtual const char* what() const noexcept;
 
   std::string getExcString(){return excString_;}
 
diff --git a/core/include/FieldManager.h b/core/include/FieldManager.h
index ffec17becec161081cb900b6755e2c9344594b1e..9863fca889bf84cde5221b851493601ae91ae8f5 100644
--- a/core/include/FieldManager.h
+++ b/core/include/FieldManager.h
@@ -79,7 +79,14 @@ class FieldManager {
     field_=b;
   }
 
-  bool isInitialized() { return field_ != NULL; }
+  void destruct() {
+    if (instance_ != nullptr) {
+      delete instance_;
+      instance_ = nullptr;
+    }
+  }
+
+  bool isInitialized() { return field_ != nullptr; }
 
   void checkInitialized() {
     if(! isInitialized()){
@@ -91,7 +98,7 @@ class FieldManager {
   }
 
   static void checkInstanciated() {
-    if(instance_==NULL){
+    if(instance_==nullptr){
       errorOut << "FieldManager hasn't been instantiated yet, call getInstance() and init() before getFieldVal()!" << std::endl;
       std::string msg("FieldManager hasn't been instantiated yet, call getInstance() and init() before getFieldVal()!");
       std::runtime_error err(msg);
@@ -110,7 +117,7 @@ class FieldManager {
 
   //! Get singleton instance.
   static FieldManager* getInstance(){
-    if(instance_ == NULL) {
+    if(instance_ == nullptr) {
       instance_ = new FieldManager();
     }
     return instance_;
diff --git a/core/include/FitStatus.h b/core/include/FitStatus.h
index ec4e2fb8cae0499ee31698e2f445a0b2f3d63bbd..cd8b3248efc36c9d8b3bef68b6b2b31cdd3f7162 100644
--- a/core/include/FitStatus.h
+++ b/core/include/FitStatus.h
@@ -103,7 +103,9 @@ class FitStatus {
    * will return true.
    */
   bool isFitConverged(bool inAllPoints = true) const {
-    if (inAllPoints) return isFitConvergedFully_; return isFitConvergedPartially_;
+    if (inAllPoints)
+        return isFitConvergedFully_;
+    return isFitConvergedPartially_;
   }
   bool isFitConvergedFully() const {return isFitConvergedFully_;}
   bool isFitConvergedPartially() const {return isFitConvergedPartially_;}
diff --git a/core/include/Material.h b/core/include/Material.h
new file mode 100644
index 0000000000000000000000000000000000000000..e835bdf9837751f91355a18b72cc56008873bd32
--- /dev/null
+++ b/core/include/Material.h
@@ -0,0 +1,37 @@
+#ifndef genfit_Material_h
+#define genfit_Material_h
+
+#include "EigenMatrixTypedefs.h"
+
+#include <TObject.h>
+
+namespace genfit {
+
+    struct Material {
+        Scalar density;  /// Density in g / cm^3
+        Scalar Z;  /// Atomic number
+        Scalar A;  /// Mass number in g / mol
+        Scalar radiationLength;  /// Radiation Length in cm
+        Scalar mEE;  /// Mean excitaiton energy in eV
+
+        Material() : density(0), Z(0), A(0), radiationLength(0), mEE(0) {}
+
+        Material(Scalar density_, Scalar Z_, Scalar A_, Scalar radiationLength_, Scalar mEE_) :
+                density(density_), Z(Z_), A(A_), radiationLength(radiationLength_), mEE(mEE_) {}
+
+        Material(const Material &material) = default;
+
+        virtual ~Material() {};
+
+        void Print(const Option_t* = "") const;
+
+        ClassDef(Material, 1)
+    };
+
+    bool operator==(const Material &lhs, const Material &rhs);
+
+    bool operator!=(const Material &lhs, const Material &rhs);
+
+}
+
+#endif
\ No newline at end of file
diff --git a/core/include/MaterialProperties.h b/core/include/MaterialProperties.h
deleted file mode 100644
index b610efecc45b3048b506eb03ce0e2e1c21509714..0000000000000000000000000000000000000000
--- a/core/include/MaterialProperties.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Copyright 2008-2010, Technische Universitaet Muenchen,
-   Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
-
-   This file is part of GENFIT.
-
-   GENFIT is free software: you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published
-   by the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   GENFIT is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/** @addtogroup genfit
- * @{
- */
-
-#ifndef genfit_MaterialProperties_h
-#define genfit_MaterialProperties_h
-
-#include <TObject.h>
-
-namespace genfit {
-
-
-/**
- * @brief Material properties needed e.g. for material effects calculation.
- */
-class MaterialProperties {
-
- public:
-
-  //! Compare material parameters
-  friend bool operator== (const MaterialProperties& lhs, const MaterialProperties& rhs);
-  friend bool operator!= (const MaterialProperties& lhs, const MaterialProperties& rhs);
-
-  MaterialProperties();
-  MaterialProperties(const double& density,
-                     const double& Z,
-                     const double& A,
-                     const double& radiationLength,
-                     const double& mEE);
-  virtual ~MaterialProperties() {}; // Root I/O wants a virtual destructor.
-
-  double getDensity() const {return density_;}
-  double getZ() const {return Z_;}
-  double getA() const {return A_;}
-  double getRadLen() const {return radiationLength_;}
-  double getMEE() const {return mEE_;}
-
-  void getMaterialProperties(double& density,
-                             double& Z,
-                             double& A,
-                             double& radiationLength,
-                             double& mEE) const;
-
-  void setMaterialProperties(const double& density,
-                             const double& Z,
-                             const double& A,
-                             const double& radiationLength,
-                             const double& mEE);
-
-  void Print(const Option_t* = "") const;
-
- private:
-
-  // material variables
-  //! density of material
-  double density_;
-  //! Atomic number Z of material
-  double Z_;
-  //! Mass number A of material
-  double A_;
-  //! radiation length X0
-  double radiationLength_;
-  //! mean excitation energy [eV]
-  double mEE_;
-
-
- public:
-  ClassDef(MaterialProperties, 1)
-
-};
-
-
-inline MaterialProperties::MaterialProperties() :
-  density_(0),
-  Z_(0),
-  A_(0),
-  radiationLength_(0),
-  mEE_(0)
-{
-  ;
-}
-
-inline MaterialProperties::MaterialProperties(const double& density,
-                   const double& Z,
-                   const double& A,
-                   const double& radiationLength,
-                   const double& mEE) :
-  density_(density),
-  Z_(Z),
-  A_(A),
-  radiationLength_(radiationLength),
-  mEE_(mEE)
-{
-  ;
-}
-
-} /* End of namespace genfit */
-/** @} */
-
-#endif // genfit_MaterialProperties_h
diff --git a/core/include/MeasuredStateOnPlane.h b/core/include/MeasuredStateOnPlane.h
index c9922a1c685faaab87efa50c8ca3a0c4ec1e9555..65e38162a1d9d7996451e1ebdaf73715e89ee388 100644
--- a/core/include/MeasuredStateOnPlane.h
+++ b/core/include/MeasuredStateOnPlane.h
@@ -29,6 +29,7 @@
 
 #include <TMatrixDSym.h>
 
+#include <cassert>
 
 namespace genfit {
 
@@ -39,7 +40,7 @@ class MeasuredStateOnPlane : public StateOnPlane {
 
  public:
 
-  MeasuredStateOnPlane(const AbsTrackRep* rep = NULL);
+  MeasuredStateOnPlane(const AbsTrackRep* rep = nullptr);
   MeasuredStateOnPlane(const TVectorD& state, const TMatrixDSym& cov, const genfit::SharedPlanePtr& plane, const AbsTrackRep* rep);
   MeasuredStateOnPlane(const TVectorD& state, const TMatrixDSym& cov, const genfit::SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo);
   MeasuredStateOnPlane(const MeasuredStateOnPlane& o);
@@ -49,7 +50,7 @@ class MeasuredStateOnPlane : public StateOnPlane {
   void swap(MeasuredStateOnPlane& other); // nothrow
 
   virtual ~MeasuredStateOnPlane() {}
-  virtual MeasuredStateOnPlane* clone() const {return new MeasuredStateOnPlane(*this);}
+  virtual MeasuredStateOnPlane* clone() const override {return new MeasuredStateOnPlane(*this);}
 
 
   const TMatrixDSym& getCov() const {return cov_;}
@@ -73,14 +74,14 @@ class MeasuredStateOnPlane : public StateOnPlane {
   void setPosMomCov(const TVectorD& state6, const TMatrixDSym& cov6x6) {getRep()->setPosMomCov(*this, state6, cov6x6);}
 
 
-  virtual void Print(Option_t* option = "") const;
+  virtual void Print(Option_t* option = "") const override;
 
  protected:
 
   TMatrixDSym cov_;
 
  public:
-  ClassDef(MeasuredStateOnPlane,1)
+  ClassDefOverride(MeasuredStateOnPlane,1)
 
 };
 
@@ -100,7 +101,7 @@ inline void MeasuredStateOnPlane::swap(MeasuredStateOnPlane& other) {
 inline MeasuredStateOnPlane::MeasuredStateOnPlane(const AbsTrackRep* rep) :
   StateOnPlane(rep), cov_(0,0)
 {
-  if (rep != NULL) {
+  if (rep != nullptr) {
     cov_.ResizeTo(rep->getDim(), rep->getDim());
   }
 }
@@ -108,14 +109,14 @@ inline MeasuredStateOnPlane::MeasuredStateOnPlane(const AbsTrackRep* rep) :
 inline MeasuredStateOnPlane::MeasuredStateOnPlane(const TVectorD& state, const TMatrixDSym& cov, const SharedPlanePtr& plane, const AbsTrackRep* rep) :
   StateOnPlane(state, plane, rep), cov_(cov)
 {
-  assert(rep != NULL);
+  assert(rep != nullptr);
   //assert(cov_.GetNcols() == (signed)rep->getDim());
 }
 
 inline MeasuredStateOnPlane::MeasuredStateOnPlane(const TVectorD& state, const TMatrixDSym& cov, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo) :
   StateOnPlane(state, plane, rep, auxInfo), cov_(cov)
 {
-  assert(rep != NULL);
+  assert(rep != nullptr);
   //assert(cov_.GetNcols() == (signed)rep->getDim());
 }
 
diff --git a/core/include/MeasurementOnPlane.h b/core/include/MeasurementOnPlane.h
index 89f6a5be36c30fc9a6db913c4c71ce7b26214cfe..9eb46bf64e642b2f067d227808f4a488b4006919 100644
--- a/core/include/MeasurementOnPlane.h
+++ b/core/include/MeasurementOnPlane.h
@@ -30,6 +30,7 @@
 #include <TMatrixD.h>
 
 #include <cmath>
+#include <memory>
 
 
 namespace genfit {
@@ -46,8 +47,8 @@ class MeasurementOnPlane : public MeasuredStateOnPlane {
 
  public:
 
-  MeasurementOnPlane(const AbsTrackRep* rep = NULL) :
-    MeasuredStateOnPlane(rep), hMatrix_(NULL), weight_(0) {}
+  MeasurementOnPlane(const AbsTrackRep* rep = nullptr) :
+    MeasuredStateOnPlane(rep), hMatrix_(nullptr), weight_(0) {}
   MeasurementOnPlane(const TVectorD& state, const TMatrixDSym& cov, SharedPlanePtr plane, const AbsTrackRep* rep, const AbsHMatrix* hMatrix, double weight = 1.) :
     MeasuredStateOnPlane(state, cov, plane, rep), hMatrix_(hMatrix), weight_(weight) {}
 
@@ -67,7 +68,7 @@ class MeasurementOnPlane : public MeasuredStateOnPlane {
   void setHMatrix(const AbsHMatrix* hMatrix) {hMatrix_.reset(hMatrix);}
   void setWeight(double weight) {weight_ = fmax(weight, 1.E-10);}
 
-  void Print(Option_t* option = "") const ;
+  void Print(Option_t* option = "") const override ;
 
  private:
   TVector3 getPos() const;
@@ -92,15 +93,11 @@ class MeasurementOnPlane : public MeasuredStateOnPlane {
 
  protected:
 
-#ifndef __CINT__
-  boost::scoped_ptr<const AbsHMatrix> hMatrix_; // Ownership
-#else
-  const AbsHMatrix* hMatrix_; //! Ownership. Projection matrix
-#endif
+  std::unique_ptr<const AbsHMatrix> hMatrix_; // Ownership
   double weight_;
 
  public:
-  ClassDef(MeasurementOnPlane,1)
+  ClassDefOverride(MeasurementOnPlane,1)
 
 };
 
diff --git a/core/include/MeasurementProducer.h b/core/include/MeasurementProducer.h
index fe959f723f01f5831ad7a1990b2f3d164a84bbbe..d797a8d4dae3a83565bc81064c335cbf84808e54 100644
--- a/core/include/MeasurementProducer.h
+++ b/core/include/MeasurementProducer.h
@@ -103,7 +103,7 @@ MeasurementProducer<hit_T, measurement_T>::~MeasurementProducer() {
 
 template <class hit_T, class measurement_T>
 AbsMeasurement* MeasurementProducer<hit_T, measurement_T>::produce(int index, const TrackCandHit* hit) {
-  assert(hitArrayTClones_ != NULL);
+  assert(hitArrayTClones_ != nullptr);
   //std::cout << "hit array with " << hitArrayTClones_->GetEntries() << " entries, looking for entry " << index << "." << std::endl;
   if(hitArrayTClones_->At(index) == 0) {
     Exception e("In MeasurementProducer: index for hit in TClonesArray out of bounds",__LINE__,__FILE__);
diff --git a/core/include/SharedMaterialPropertiesPtr.h b/core/include/SharedMaterialPropertiesPtr.h
deleted file mode 100644
index 629c8af68daf6cc8d2f70855ebc30161d18ef20a..0000000000000000000000000000000000000000
--- a/core/include/SharedMaterialPropertiesPtr.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright 2008-2010, Technische Universitaet Muenchen,
-   Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
-
-   This file is part of GENFIT.
-
-   GENFIT is free software: you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published
-   by the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   GENFIT is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/** @addtogroup genfit
- * @{
- */
-
-#ifndef genfit_SharedMaterialPropertiesPtr_h
-#define genfit_SharedMaterialPropertiesPtr_h
-
-#include "MaterialProperties.h"
-
-#ifndef __CINT__
-#include <boost/shared_ptr.hpp>
-#endif
-
-
-
-namespace genfit {
-
-#ifndef __CINT__
-typedef boost::shared_ptr< const genfit::MaterialProperties > SharedMaterialPropertiesPtr;
-#else
-class SharedMaterialPropertiesPrt;
-#endif
-
-} /* End of namespace genfit */
-/** @} */
-
-#endif // genfit_SharedMaterialPropertiesPtr_h
diff --git a/core/include/SharedPlanePtr.h b/core/include/SharedPlanePtr.h
index dabffaa60b52e7731e51b34e9a3eff767eb70aec..c3d4907eb7f94554a598c96ef3901759bdd871ec 100644
--- a/core/include/SharedPlanePtr.h
+++ b/core/include/SharedPlanePtr.h
@@ -26,9 +26,7 @@
 
 #include "DetPlane.h"
 
-#ifndef __CINT__
-#include <boost/shared_ptr.hpp>
-#endif
+#include <memory>
 
 
 namespace genfit {
@@ -39,11 +37,22 @@ namespace genfit {
  * Ownership can be shared, e.g between multiple StateOnPlane objects.
  * The DetPlane will automatically be deleted, if no owner remains.
  */
-#ifndef __CINT__
-typedef boost::shared_ptr< genfit::DetPlane > SharedPlanePtr;
-#else
-class SharedPlanePtr;
-#endif
+    typedef std::shared_ptr< genfit::DetPlane > SharedPlanePtr;
+
+    /**
+     * Class allowing to create a SharedPlanePtr from a DetPlane from Python.
+     */
+    class SharedPlanePtrCreator {
+    public:
+      /**
+       * Function which allows to create a shared plane pointer from a DetPlane.
+       * @param plane : A DetPlane.
+       * @return SharedPlanePtr : A shared plane pointer to the provided plane.
+       */
+      static SharedPlanePtr getPlanePtr(DetPlane *plane) {
+          return SharedPlanePtr(plane);
+      }
+    };
 
 } /* End of namespace genfit */
 /** @} */
diff --git a/core/include/StateOnPlane.h b/core/include/StateOnPlane.h
index ac25150a882a0b55726d8d52d20bacf73ebd43d5..9fc9a3130dcdef5a1e6885fdc3eafa43fa917521 100644
--- a/core/include/StateOnPlane.h
+++ b/core/include/StateOnPlane.h
@@ -30,6 +30,8 @@
 #include <TObject.h>
 #include <TVectorD.h>
 
+#include <cassert>
+
 
 namespace genfit {
 
@@ -47,7 +49,7 @@ class StateOnPlane {
  public:
 
 
-  StateOnPlane(const AbsTrackRep* rep = NULL);
+  StateOnPlane(const AbsTrackRep* rep = nullptr);
   //! state is defined by the TrackReps parameterization
   StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep);
   StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo);
@@ -153,7 +155,7 @@ class StateOnPlane {
 inline StateOnPlane::StateOnPlane(const AbsTrackRep* rep) :
   state_(0), auxInfo_(0), sharedPlane_(), rep_(rep)
 {
-  if (rep != NULL) {
+  if (rep != nullptr) {
     state_.ResizeTo(rep->getDim());
   }
 }
@@ -161,15 +163,15 @@ inline StateOnPlane::StateOnPlane(const AbsTrackRep* rep) :
 inline StateOnPlane::StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep) :
   state_(state), auxInfo_(0), sharedPlane_(plane), rep_(rep)
 {
-  assert(rep != NULL);
-  assert(sharedPlane_.get() != NULL);
+  assert(rep != nullptr);
+  assert(sharedPlane_.get() != nullptr);
 }
 
 inline StateOnPlane::StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo) :
   state_(state), auxInfo_(auxInfo), sharedPlane_(plane), rep_(rep)
 {
-  assert(rep != NULL);
-  assert(sharedPlane_.get() != NULL);
+  assert(rep != nullptr);
+  assert(sharedPlane_.get() != nullptr);
 }
 
 inline StateOnPlane& StateOnPlane::operator=(StateOnPlane other) {
diff --git a/core/include/ThinScatterer.h b/core/include/ThinScatterer.h
index d4cfd25622b8d38a76209860f8aa5445b011ac44..a6885f01a6efbfaa20ad1dd7360c9b6eab408ef1 100644
--- a/core/include/ThinScatterer.h
+++ b/core/include/ThinScatterer.h
@@ -25,7 +25,7 @@
 #define genfit_ThinScatterer_h
 
 #include "SharedPlanePtr.h"
-#include "MaterialProperties.h"
+#include "Material.h"
 
 #include <TObject.h>
 
@@ -41,22 +41,22 @@ class ThinScatterer : public TObject {
 
   ThinScatterer() :
     TObject(), sharedPlane_(), material_() {;}
-  ThinScatterer(const SharedPlanePtr& sharedPlane, const MaterialProperties& material) :
+  ThinScatterer(const SharedPlanePtr& sharedPlane, const Material& material) :
     TObject(), sharedPlane_(sharedPlane), material_(material) {;}
 
   SharedPlanePtr getPlane() const {return sharedPlane_;}
-  const MaterialProperties& getMaterial() const {return material_;}
+  const Material& getMaterial() const {return material_;}
 
   void Print(const Option_t* = "") const;
 
  private:
 
   SharedPlanePtr sharedPlane_; //! Material boundary.  '!' shuts up ROOT.
-  MaterialProperties material_; // Material properties
+  Material material_; // Material properties
 
 
  public:
-  ClassDef(ThinScatterer, 1)
+  ClassDef(ThinScatterer, 2)
 
 };
 
diff --git a/core/include/Tools.h b/core/include/Tools.h
index 7cfcfbc5fa2c8abd238554342a3bb51a36d9c9c1..7f31984f0d6ef5751e40077e283c364f98434cb1 100644
--- a/core/include/Tools.h
+++ b/core/include/Tools.h
@@ -40,10 +40,10 @@ namespace tools {
 /** @brief Invert a matrix, throwing an Exception when inversion fails.
  * Optional calculation of determinant.
  */
-void invertMatrix(const TMatrixDSym& mat, TMatrixDSym& inv, double* determinant = NULL);
+void invertMatrix(const TMatrixDSym& mat, TMatrixDSym& inv, double* determinant = nullptr);
 /** @brief Same, replacing its argument.
  */
-void invertMatrix(TMatrixDSym& mat, double* determinant = NULL);
+void invertMatrix(TMatrixDSym& mat, double* determinant = nullptr);
 
 /** @brief Solves R^t x = b, replacing b with the solution for x.  R is
  *  assumed to be upper diagonal.
@@ -67,13 +67,6 @@ void QR(TMatrixD& A);
  */
 void QR(TMatrixD& A, TVectorD& b);
 
-/** @brief This averages the covariance matrices C1, C2 in a
- *  numerically stable way by using matrix square roots.  This code
- *  is in no way optimized so use with care if speed is a concern.
- */
-void safeAverage(const TMatrixDSym& C1, const TMatrixDSym& C2,
-		 TMatrixDSym& result);
-
 /** @brief Calculate a sqrt for the positive semidefinite noise
  *  matrix.  Rows corresponding to zero eigenvalues are omitted.
  *  This gives the transposed of the square root, i.e.
@@ -83,13 +76,6 @@ void
 noiseMatrixSqrt(const TMatrixDSym& noise,
 		TMatrixD& noiseSqrt);
 
-/** @brief Transport the state.
- */
-void
-kalmanPrediction(const TVectorD& x,
-		 const TVectorD& delta, const TMatrixD& F,
-		 TVectorD& xNew);
-
 /** @brief Calculates the square root of the covariance matrix after
  *  the Kalman prediction (i.e. extrapolation) with transport matrix F
  *  and the noise square root Q.  Gives the new covariance square
@@ -108,13 +94,6 @@ kalmanUpdateSqrt(const TMatrixD& S,
 		 const TVectorD& res, const TMatrixD& R, const AbsHMatrix* H,
 		 TVectorD& update, TMatrixD& SNew);
 
-void
-kalmanPredictionUpdateSqrt(const TMatrixD& S,
-			   const TMatrixD& F, const TMatrixD& Q,
-			   const TVectorD& res, const TMatrixD& R,
-			   const AbsHMatrix* H,
-			   TVectorD& update, TMatrixD& SNew);
-
 } /* End of namespace tools */
 } /* End of namespace genfit */
 /** @} */
diff --git a/core/include/Track.h b/core/include/Track.h
index 870e59691706b9b87a17fa9996880d4157147cde..089d6c628c99b62bc9d218a584aa7b620bdd28d9 100644
--- a/core/include/Track.h
+++ b/core/include/Track.h
@@ -90,7 +90,7 @@ class Track : public TObject {
    * big enough not to bias the fit too much, but not too big in order to avoid
    * numerical problems).
    */
-  Track(const TrackCand& trackCand, const MeasurementFactory<genfit::AbsMeasurement>& factory, AbsTrackRep* rep = NULL);
+  Track(const TrackCand& trackCand, const MeasurementFactory<genfit::AbsMeasurement>& factory, AbsTrackRep* rep = nullptr);
 
   Track(AbsTrackRep* trackRep, const TVectorD& stateSeed);
   Track(AbsTrackRep* trackRep, const TVector3& posSeed, const TVector3& momSeed);
@@ -113,8 +113,8 @@ class Track : public TObject {
   const std::vector< genfit::TrackPoint* > & getPointsWithMeasurement() const  {return trackPointsWithMeasurement_;}
   unsigned int getNumPointsWithMeasurement() const {return trackPointsWithMeasurement_.size();}
 
-  TrackPoint* getPointWithMeasurementAndFitterInfo(int id, const AbsTrackRep* rep = NULL) const;
-  TrackPoint* getPointWithFitterInfo(int id, const AbsTrackRep* rep = NULL) const;
+  TrackPoint* getPointWithMeasurementAndFitterInfo(int id, const AbsTrackRep* rep = nullptr) const;
+  TrackPoint* getPointWithFitterInfo(int id, const AbsTrackRep* rep = nullptr) const;
 
   /**
    * @brief Shortcut to get FittedStates.
@@ -125,7 +125,7 @@ class Track : public TObject {
    * with one or more AbsFitterInfo objects
    * is returned. If no AbsTrackRep is specified, the AbsFitterInfo of the cardinal rep will be used.
    */
-  const MeasuredStateOnPlane& getFittedState(int id = 0, const AbsTrackRep* rep = NULL, bool biased = true) const;
+  const MeasuredStateOnPlane& getFittedState(int id = 0, const AbsTrackRep* rep = nullptr, bool biased = true) const;
 
   AbsTrackRep* getTrackRep(int id) const {return trackReps_.at(id);}
   /// Return the track representations as a list of pointers.
@@ -149,14 +149,14 @@ class Track : public TObject {
   int getMcTrackId() const {return mcTrackId_;}
 
   //! Check if track has a FitStatus for given AbsTrackRep. Per default, check for cardinal rep.
-  bool hasFitStatus(const AbsTrackRep* rep = NULL) const;
+  bool hasFitStatus(const AbsTrackRep* rep = nullptr) const;
   //! Get FitStatus for a AbsTrackRep. Per default, return FitStatus for cardinalRep.
-  FitStatus* getFitStatus(const AbsTrackRep* rep = NULL) const {if (rep == NULL) rep = getCardinalRep(); return fitStatuses_.at(rep);}
+  FitStatus* getFitStatus(const AbsTrackRep* rep = nullptr) const {if (rep == nullptr) rep = getCardinalRep(); return fitStatuses_.at(rep);}
 
   //! Check if track has a KalmanFitStatus for given AbsTrackRep. Per default, check for cardinal rep.
-  bool hasKalmanFitStatus(const AbsTrackRep* rep = NULL) const;
-  //! If FitStatus is a KalmanFitStatus, return it. Otherwise return NULL
-  KalmanFitStatus* getKalmanFitStatus(const AbsTrackRep* rep = NULL) const;
+  bool hasKalmanFitStatus(const AbsTrackRep* rep = nullptr) const;
+  //! If FitStatus is a KalmanFitStatus, return it. Otherwise return nullptr
+  KalmanFitStatus* getKalmanFitStatus(const AbsTrackRep* rep = nullptr) const;
 
   void setFitStatus(FitStatus* fitStatus, const AbsTrackRep* rep);
 
@@ -196,7 +196,7 @@ class Track : public TObject {
   //! Creates a new TrackPoint containing the measurement, and adds it to the track
   void insertMeasurement(AbsMeasurement* measurement, int id = -1);
 
-  //! Delete all measurement information and the track points of the track. Does not delete fit status or track representations.
+  //! Delete all measurement information and the track points of the track. Does not delete track representations.
   void deleteTrackPointsAndFitStatus();
   /**
    * @brief Merge two tracks.
@@ -226,7 +226,7 @@ class Track : public TObject {
 
   //! Try to set the fitted state as seed. Return if it was successfull.
   //! Adapt the sign of all TrackReps' pdg to the actual fitted charge.
-  bool udpateSeed(int id = 0, AbsTrackRep* rep = NULL, bool biased = true);
+  bool udpateSeed(int id = 0, AbsTrackRep* rep = nullptr, bool biased = true);
 
   //! Flip the ordering of the TrackPoints
   void reverseTrackPoints();
@@ -236,8 +236,8 @@ class Track : public TObject {
     stateSeed_(3) *= -1; stateSeed_(4) *= -1; stateSeed_(5) *= -1;
   }
 
-  //! Switch the pdg signs of specified rep (of all reps if rep == NULL).
-  void switchPDGSigns(AbsTrackRep* rep = NULL);
+  //! Switch the pdg signs of specified rep (of all reps if rep == nullptr).
+  void switchPDGSigns(AbsTrackRep* rep = nullptr);
 
   //! Make track ready to be fitted in reverse direction
   /**
@@ -248,16 +248,25 @@ class Track : public TObject {
   void reverseTrack();
 
 
-  void deleteForwardInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = NULL); // delete in range [startId, endId]. If rep == NULL, delete for ALL reps, otherwise only for rep.
-  void deleteBackwardInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = NULL); // delete in range [startId, endId]. If rep == NULL, delete for ALL reps, otherwise only for rep.
-  void deleteReferenceInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = NULL); // delete in range [startId, endId]. If rep == NULL, delete for ALL reps, otherwise only for rep.
-  void deleteMeasurementInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = NULL); // delete in range [startId, endId]. If rep == NULL, delete for ALL reps, otherwise only for rep.
-  void deleteFitterInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = NULL); // delete in range [startId, endId]. If rep == NULL, delete for ALL reps, otherwise only for rep.
+  void deleteForwardInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = nullptr); // delete in range [startId, endId]. If rep == nullptr, delete for ALL reps, otherwise only for rep.
+  void deleteBackwardInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = nullptr); // delete in range [startId, endId]. If rep == nullptr, delete for ALL reps, otherwise only for rep.
+  void deleteReferenceInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = nullptr); // delete in range [startId, endId]. If rep == nullptr, delete for ALL reps, otherwise only for rep.
+  void deleteMeasurementInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = nullptr); // delete in range [startId, endId]. If rep == nullptr, delete for ALL reps, otherwise only for rep.
+  void deleteFitterInfo(int startId = 0, int endId = -1, const AbsTrackRep* rep = nullptr); // delete in range [startId, endId]. If rep == nullptr, delete for ALL reps, otherwise only for rep.
 
-  //! get TrackLength between to trackPoints (if NULL, for cardinal rep)
-  double getTrackLen(AbsTrackRep* rep = NULL, int startId = 0, int endId = -1) const;
-  //! get time of flight in ns between to trackPoints (if NULL, for cardinal rep)
-  double getTOF(AbsTrackRep* rep = NULL, int startId = 0, int endId = -1) const;
+  //! get TrackLength between to trackPoints (if nullptr, for cardinal rep)
+  double getTrackLen(AbsTrackRep* rep = nullptr, int startId = 0, int endId = -1) const;
+  //! get time of flight in ns between to trackPoints (if nullptr, for cardinal rep)
+  double getTOF(AbsTrackRep* rep = nullptr, int startId = 0, int endId = -1) const;
+
+  /**
+   * Delete the fit status and all the FitStates of the TrackPoints
+   * for the given hypothesis.
+   * This is equal to resetting the track for the rep, so another fit
+   * can start from scratch.
+   * Useful if you have changed some seeds.
+   */
+  void deleteFittedState(const genfit::AbsTrackRep* rep); 
 
   //! Construct a new TrackCand containing the hit IDs of the measurements
   /**
@@ -268,9 +277,9 @@ class Track : public TObject {
    */
   TrackCand* constructTrackCand() const;
 
-  //! Helper function: For all KalmanFitterInfos belonging to rep (if NULL, for all reps),
+  //! Helper function: For all KalmanFitterInfos belonging to rep (if nullptr, for all reps),
   //! call the fixWeights() function, so that e.g. the DAF will not alter weights anymore.
-  void fixWeights(AbsTrackRep* rep = NULL, int startId = 0, int endId = -1);
+  void fixWeights(AbsTrackRep* rep = nullptr, int startId = 0, int endId = -1);
 
   /**
    * @brief Delete unneeded information from the Track.
@@ -290,7 +299,7 @@ class Track : public TObject {
 
   void Print(const Option_t* = "") const;
 
-  bool checkConsistency() const;
+  void checkConsistency() const;
 
  private:
 
diff --git a/core/include/TrackPoint.h b/core/include/TrackPoint.h
index 4a2681b66f8f139facdf3e6215b4459a2d7c3e72..5dd193f260ef718b7d4ef00cd0f7dd107b082c54 100644
--- a/core/include/TrackPoint.h
+++ b/core/include/TrackPoint.h
@@ -33,10 +33,6 @@
 #include <vector>
 #include <memory>
 
-#ifndef __CINT__
-#include <boost/scoped_ptr.hpp>
-#endif
-
 
 namespace genfit {
 
@@ -80,7 +76,7 @@ class TrackPoint : public TObject {
    */
   TrackPoint(const TrackPoint& rhs,
       const std::map<const genfit::AbsTrackRep*, genfit::AbsTrackRep*>& map,
-      const std::vector<const genfit::AbsTrackRep*> * repsToIgnore = NULL);
+      const std::vector<const genfit::AbsTrackRep*> * repsToIgnore = nullptr);
 
   virtual ~TrackPoint();
 
@@ -97,20 +93,20 @@ class TrackPoint : public TObject {
   //! Get list of all fitterInfos
   std::vector< genfit::AbsFitterInfo* > getFitterInfos() const;
   //! Get fitterInfo for rep. Per default, use cardinal rep
-  AbsFitterInfo* getFitterInfo(const AbsTrackRep* rep = NULL) const;
+  AbsFitterInfo* getFitterInfo(const AbsTrackRep* rep = nullptr) const;
   //! Helper to avoid casting
-  KalmanFitterInfo* getKalmanFitterInfo(const AbsTrackRep* rep = NULL) const;
+  KalmanFitterInfo* getKalmanFitterInfo(const AbsTrackRep* rep = nullptr) const;
   bool hasFitterInfo(const AbsTrackRep* rep) const {
     return (fitterInfos_.find(rep) != fitterInfos_.end());
   }
 
   ThinScatterer* getMaterialInfo() const {return thinScatterer_.get();}
-  bool hasThinScatterer() const {return thinScatterer_.get() != NULL;}
+  bool hasThinScatterer() const {return thinScatterer_.get() != nullptr;}
 
 
   void setSortingParameter(double sortingParameter) {sortingParameter_ = sortingParameter;}
   //! Takes ownership and sets this as measurement's trackPoint
-  void addRawMeasurement(genfit::AbsMeasurement* rawMeasurement) {assert(rawMeasurement!=NULL); rawMeasurement->setTrackPoint(this); rawMeasurements_.push_back(rawMeasurement);}
+  void addRawMeasurement(genfit::AbsMeasurement* rawMeasurement) {assert(rawMeasurement!=nullptr); rawMeasurement->setTrackPoint(this); rawMeasurements_.push_back(rawMeasurement);}
   void deleteRawMeasurements();
   //! Takes Ownership
   void setFitterInfo(genfit::AbsFitterInfo* fitterInfo);
@@ -141,18 +137,14 @@ class TrackPoint : public TObject {
   std::map< const AbsTrackRep*, AbsFitterInfo* > fitterInfos_; //! Ownership over FitterInfos
 
   /**
-   * The following vector is read while streaming.  After reading the
+   * The following map is read while streaming.  After reading the
    * TrackPoint, the Track's streamer will call fixupRepsForReading,
-   * and this vector will be translated into the map fitterInfos. The
-   * vector is indexed by the ids of the corresponding TrackReps.
+   * and this map will be translated into the map fitterInfos. The
+   * map is indexed by the ids of the corresponding TrackReps.
    */
-  std::vector< AbsFitterInfo* > vFitterInfos_; //!
+  std::map<unsigned int, AbsFitterInfo*> vFitterInfos_; //!
 
-#ifndef __CINT__
-  boost::scoped_ptr<ThinScatterer> thinScatterer_; // Ownership
-#else
-  class ThinScatterer* thinScatterer_;
-#endif
+  std::unique_ptr<ThinScatterer> thinScatterer_; // Ownership
 
  public:
 
diff --git a/core/include/Units.h b/core/include/Units.h
new file mode 100644
index 0000000000000000000000000000000000000000..8310e8a2403ce50b80f2bec59a7f2b0c67ae9702
--- /dev/null
+++ b/core/include/Units.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "EigenMatrixTypedefs.h"
+
+namespace genfit {
+
+    namespace Unit {
+
+        constexpr Scalar GeV = 1;
+        constexpr Scalar MeV = 1e-3 * Unit::GeV;
+        constexpr Scalar keV = 1e-6 * Unit::GeV;
+        constexpr Scalar eV = 1e-9 * Unit::GeV;
+
+    }
+
+}
\ No newline at end of file
diff --git a/core/src/AbsFitter.cc b/core/src/AbsFitter.cc
index 84e1bbbe482af44a542c95bd26801d65cbbb3551..f0b89bcdc30600724c16d548c07ce97cabe984a7 100644
--- a/core/src/AbsFitter.cc
+++ b/core/src/AbsFitter.cc
@@ -33,8 +33,7 @@ void AbsFitter::processTrack(Track* tr, bool resortHits) {
       processTrackWithRep(tr, tr->getTrackRep(i), false);
   }
 
-  // self check
-  assert(tr->checkConsistency());
+  tr->checkConsistency();
 }
 
 } /* End of namespace genfit */
diff --git a/core/src/AbsFitterInfo.cc b/core/src/AbsFitterInfo.cc
index 965510b6c37a4a881656572b31f3b02b4206f01b..7277a7f16d5b36d676a7f4560ea1a0fb07460b0b 100644
--- a/core/src/AbsFitterInfo.cc
+++ b/core/src/AbsFitterInfo.cc
@@ -25,8 +25,8 @@
 namespace genfit {
 
 AbsFitterInfo::AbsFitterInfo() :
-  trackPoint_(NULL),
-  rep_(NULL)
+  trackPoint_(nullptr),
+  rep_(nullptr)
 {
   ;
 }
diff --git a/core/src/AbsTrackRep.cc b/core/src/AbsTrackRep.cc
index 3311cd12790c426983ba59f39e1b336758056c1c..41c3238d117af46856c5ecb40a770553c2d2798b 100644
--- a/core/src/AbsTrackRep.cc
+++ b/core/src/AbsTrackRep.cc
@@ -92,7 +92,7 @@ void AbsTrackRep::get6DStateCov(const MeasuredStateOnPlane& state, TVectorD& sta
 
 double AbsTrackRep::getPDGCharge() const {
   TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(pdgCode_);
-  assert(particle != NULL);
+  assert(particle != nullptr);
   return particle->Charge()/(3.);
 }
 
@@ -182,7 +182,7 @@ void AbsTrackRep::calcJacobianNumerically(const genfit::StateOnPlane& origState,
 
 bool AbsTrackRep::switchPDGSign() {
   TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(-pdgCode_);
-  if(particle != NULL) {
+  if(particle != nullptr) {
     pdgCode_ *= -1;
     return true;
   }
diff --git a/core/src/DetPlane.cc b/core/src/DetPlane.cc
index ffe9d52b12dc1163259e9d8f1e3bfb786cdeb6ca..a7904fac133a52dd2662864cdfab51d98febca3b 100644
--- a/core/src/DetPlane.cc
+++ b/core/src/DetPlane.cc
@@ -224,7 +224,7 @@ void DetPlane::Print(const Option_t* option) const
      <<"v("<<v_.X()<<", "<<v_.Y()<<", "<<v_.Z()<<") "
      <<"n("<<getNormal().X()<<", "<<getNormal().Y()<<", "<<getNormal().Z()<<") "
        <<std::endl;
-  if(finitePlane_ != NULL) {
+  if(finitePlane_ != nullptr) {
     finitePlane_->Print(option);
   }
 
diff --git a/core/src/Exception.cc b/core/src/Exception.cc
index c5439d22b48a48bb824f8ad5af663f5fdc5926ce..4b292080cc29c84430a87c87ef3de84d4b52a256 100644
--- a/core/src/Exception.cc
+++ b/core/src/Exception.cc
@@ -34,7 +34,7 @@ Exception::Exception(std::string excString, int line, std::string  file) :
   errorMessage_ = ErrMsgStream.str();
 }
 
-Exception::~Exception() throw() {
+Exception::~Exception() noexcept {
 }
 
 void Exception::setNumbers(std::string _numbersLabel,
@@ -49,7 +49,7 @@ void Exception::setMatrices(std::string _matricesLabel,
   matrices_ = _matrices;
 }
 
-const char* Exception::what() const throw(){
+const char* Exception::what() const noexcept{
   return errorMessage_.c_str();
 }
 
diff --git a/core/src/FieldManager.cc b/core/src/FieldManager.cc
index b5c0261ccc27d652caab9515255d6b47d8082263..16dacc50bbb6ea38e5606dcee33095b1c350bec4 100644
--- a/core/src/FieldManager.cc
+++ b/core/src/FieldManager.cc
@@ -23,13 +23,13 @@
 
 namespace genfit {
 
-FieldManager* FieldManager::instance_ = NULL;
-AbsBField* FieldManager::field_ = NULL;
+FieldManager* FieldManager::instance_ = nullptr;
+AbsBField* FieldManager::field_ = nullptr;
 
 #ifdef CACHE
 bool FieldManager::useCache_ = false;
 unsigned int FieldManager::n_buckets_ = 8;
-fieldCache* FieldManager::cache_ = NULL;
+fieldCache* FieldManager::cache_ = nullptr;
 #endif
 
 //#define DEBUG
diff --git a/core/src/FitStatus.cc b/core/src/FitStatus.cc
index 5872d3b85a2f273b6cade72c0bf25adc712e4500..8f43b44792a87a32a5f988468806e594b496abc5 100644
--- a/core/src/FitStatus.cc
+++ b/core/src/FitStatus.cc
@@ -90,19 +90,23 @@ void FitStatus::Print(const Option_t*) const
   printOut << "fitStatus \n";
   if (isFitted_) {
     printOut << " track has been fitted,";
-    if (isFitConvergedFully_)
+    if (isFitConvergedFully_) {
       printOut << " fit has converged fully,";
-    else if (isFitConvergedPartially_)
+    } else if (isFitConvergedPartially_) {
       printOut << " fit has converged partially,";
-    else
+    } else {
       printOut << " fit has NOT converged,";
+    }
     printOut << " " << nFailedPoints_ << " TrackPoints could not be processed,";
-    if (trackHasChanged_) printOut << " track has changed since the fit,";
+    if (trackHasChanged_) {
+      printOut << " track has changed since the fit,";
+    }
     printOut << " fitted charge = " << charge_ << ", ";
     pruneFlags_.Print();
   }
-  else
+  else {
     printOut << " track has NOT been fitted,";
+  }
 }
 
 } /* End of namespace genfit */
diff --git a/core/src/Material.cc b/core/src/Material.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ce3ec35eed4724bbb735aeb83b826646fe6897b7
--- /dev/null
+++ b/core/src/Material.cc
@@ -0,0 +1,31 @@
+#include "Material.h"
+
+#include "IO.h"
+
+namespace genfit {
+
+    bool operator== (const Material& lhs, const Material& rhs){
+        if (&lhs == &rhs)
+            return true;
+
+        return !(lhs.density != rhs.density or
+                 lhs.Z != rhs.Z or
+                 lhs.A != rhs.A or
+                 lhs.radiationLength != rhs.radiationLength or
+                 lhs.mEE != rhs.mEE);
+
+    }
+
+    bool operator!= (const Material& lhs, const Material& rhs) {
+        return !(lhs==rhs);
+    }
+
+    void Material::Print(const Option_t*) const {
+        printOut << "Density = " << density << ", \t"
+                 << "Z = " << Z << ", \t"
+                 << "A = " << A << ", \t"
+                 << "radiationLength = " << radiationLength << ", \t"
+                 << "mEE = " << mEE << "\n";
+    }
+    
+}
\ No newline at end of file
diff --git a/core/src/MaterialProperties.cc b/core/src/MaterialProperties.cc
deleted file mode 100644
index 0da4a0fed90ffedc6835d44ecbd73c20bf2ddc0c..0000000000000000000000000000000000000000
--- a/core/src/MaterialProperties.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright 2008-2009, Technische Universitaet Muenchen,
-   Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
-
-   This file is part of GENFIT.
-
-   GENFIT is free software: you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published
-   by the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   GENFIT is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "MaterialProperties.h"
-
-#include "IO.h"
-
-namespace genfit {
-
-bool operator== (const MaterialProperties& lhs, const MaterialProperties& rhs){
-  if (&lhs == &rhs)
-    return true;
-  if (lhs.density_ != rhs.density_ ||
-      lhs.Z_ != rhs.Z_ ||
-      lhs.A_ != rhs.A_ ||
-      lhs.radiationLength_ != rhs.radiationLength_ ||
-      lhs.mEE_ != rhs.mEE_)
-    return false;
-
-  return true;
-}
-
-bool operator!= (const MaterialProperties& lhs, const MaterialProperties& rhs) {
-  return !(lhs==rhs);
-}
-
-
-void MaterialProperties::getMaterialProperties(double& density,
-                                               double& Z,
-                                               double& A,
-                                               double& radiationLength,
-                                               double& mEE) const {
-  density = density_;
-  Z = Z_;
-  A = A_;
-  radiationLength = radiationLength_;
-  mEE = mEE_;
-}
-
-
-void MaterialProperties::setMaterialProperties(const double& density,
-                                               const double& Z,
-                                               const double& A,
-                                               const double& radiationLength,
-                                               const double& mEE) {
-  density_ = density;
-  Z_ = Z;
-  A_ = A;
-  radiationLength_ = radiationLength;
-  mEE_ = mEE;
-}
-
-
-void MaterialProperties::Print(const Option_t*) const {
-  printOut << "Density = " << density_ << ", \t"
-           << "Z = " << Z_ << ", \t"
-           << "A = " << A_ << ", \t"
-           << "radiationLength = " << radiationLength_ << ", \t"
-           << "mEE = " << mEE_ << "\n";
-}
-
-
-} /* End of namespace genfit */
diff --git a/core/src/MeasuredStateOnPlane.cc b/core/src/MeasuredStateOnPlane.cc
index b69f74215b4526f503efdd5f1b1fd93c1d9a1b0f..794b5bd5aef7634864096440bd39750b9011963d 100644
--- a/core/src/MeasuredStateOnPlane.cc
+++ b/core/src/MeasuredStateOnPlane.cc
@@ -34,7 +34,7 @@ void MeasuredStateOnPlane::Print(Option_t*) const {
   printOut << "my address " << this << " my plane's address " << this->sharedPlane_.get() << "; use count: " << sharedPlane_.use_count() << std::endl;
   printOut << " state vector: "; state_.Print();
   printOut << " covariance matrix: "; cov_.Print();
-  if (sharedPlane_ != NULL) {
+  if (sharedPlane_ != nullptr) {
     printOut << " defined in plane "; sharedPlane_->Print();
     TVector3 pos, mom;
     TMatrixDSym cov(6,6);
diff --git a/core/src/MeasurementOnPlane.cc b/core/src/MeasurementOnPlane.cc
index 51cf245e1f6653aa153fb61151a7f35729a6c159..5880534f512883f7a99c69675772308d11d56cc7 100644
--- a/core/src/MeasurementOnPlane.cc
+++ b/core/src/MeasurementOnPlane.cc
@@ -52,8 +52,10 @@ void MeasurementOnPlane::Print(Option_t*) const
   printOut << "genfit::MeasurementOnPlane, weight = " << weight_ << "\n";
   printOut << " state vector: "; state_.Print();
   printOut << " covariance matrix: "; cov_.Print();
-  if (sharedPlane_ != NULL)
-    printOut << " defined in plane "; sharedPlane_->Print();
+  if (sharedPlane_ != nullptr) {
+      printOut << " defined in plane ";
+      sharedPlane_->Print();
+  }
   printOut << " hMatrix: "; hMatrix_->Print();
 
 }
diff --git a/core/src/StateOnPlane.cc b/core/src/StateOnPlane.cc
index 499042c1d7e509922385242803bba1246298cbff..0dd2b44ddb97c32f827dfce231bbbf3698e92bff 100644
--- a/core/src/StateOnPlane.cc
+++ b/core/src/StateOnPlane.cc
@@ -30,7 +30,7 @@ namespace genfit {
 void StateOnPlane::Print(Option_t*) const {
   printOut << "genfit::StateOnPlane ";
   printOut << " state vector: "; state_.Print();
-  if (sharedPlane_ != NULL) {
+  if (sharedPlane_ != nullptr) {
     printOut << " defined in plane "; sharedPlane_->Print();
     TVector3 pos(0,0,0), mom(0,0,0);
     getRep()->getPosMom(*this, pos, mom);
@@ -54,7 +54,7 @@ void StateOnPlane::Streamer(TBuffer &R__b)
       state_.Streamer(R__b);
       auxInfo_.Streamer(R__b);
       sharedPlane_.reset();  // needs to be set by owner;
-      rep_ = NULL;  // needs to be set by owner
+      rep_ = nullptr;  // needs to be set by owner
       R__b.CheckByteCount(R__s, R__c, thisClass::IsA());
    } else {
       R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
diff --git a/core/src/Tools.cc b/core/src/Tools.cc
index f4f33551110bf03db1143a51bdace418a14c14e8..b7531e6fe4bfc4daf14832eec5a2571021aa3b4d 100644
--- a/core/src/Tools.cc
+++ b/core/src/Tools.cc
@@ -32,8 +32,6 @@
 #include "AbsHMatrix.h"
 #include "Exception.h"
 
-// Use Cramer inversion for small matrices?
-static const bool useCramer = false;
 
 namespace genfit {
 
@@ -49,14 +47,14 @@ void tools::invertMatrix(const TMatrixDSym& mat, TMatrixDSym& inv, double* deter
   }
   // do the trivial inversions for 1x1 and 2x2 matrices manually
   if (mat.GetNrows() == 1){
-    if (determinant != NULL) *determinant = mat(0,0);
+    if (determinant != nullptr) *determinant = mat(0,0);
     inv(0,0) = 1./mat(0,0);
     return;
   }
 
   if (mat.GetNrows() == 2){
     double det = mat(0,0)*mat(1,1) - mat(1,0)*mat(1,0);
-    if (determinant != NULL) *determinant = det;
+    if (determinant != nullptr) *determinant = det;
     if(fabs(det) < 1E-50){
       Exception e("Tools::invertMatrix() - cannot invert matrix , determinant = 0",
           __LINE__,__FILE__);
@@ -70,32 +68,6 @@ void tools::invertMatrix(const TMatrixDSym& mat, TMatrixDSym& inv, double* deter
     return;
   }
 
-
-  if (useCramer && mat.GetNrows() <= 6){
-    Bool_t (*inversion)(TMatrixDSym&, Double_t*) = 0;
-    inv.ResizeTo(mat);
-    inv = mat;
-    switch (mat.GetNrows()) {
-    case 3:
-      inversion = TMatrixTSymCramerInv::Inv3x3; break;
-    case 4:
-      inversion = TMatrixTSymCramerInv::Inv4x4; break;
-    case 5:
-      inversion = TMatrixTSymCramerInv::Inv5x5; break;
-    case 6:
-      inversion = TMatrixTSymCramerInv::Inv6x6; break;
-    }
-
-    Bool_t success = inversion(inv, determinant);
-    if (!success){
-      Exception e("Tools::invertMatrix() - cannot invert matrix, determinant = 0",
-          __LINE__,__FILE__);
-      e.setFatal();
-      throw e;
-    }
-    return;
-  }
-
   // else use TDecompChol
   bool status = 0;
   TDecompChol invertAlgo(mat, 1E-50);
@@ -108,7 +80,7 @@ void tools::invertMatrix(const TMatrixDSym& mat, TMatrixDSym& inv, double* deter
     throw e;
   }
 
-  if (determinant != NULL) {
+  if (determinant != nullptr) {
     double d1, d2;
     invertAlgo.Det(d1, d2);
     *determinant = ldexp(d1, d2);
@@ -125,7 +97,7 @@ void tools::invertMatrix(TMatrixDSym& mat, double* determinant){
   }
   // do the trivial inversions for 1x1 and 2x2 matrices manually
   if (mat.GetNrows() == 1){
-    if (determinant != NULL) *determinant = mat(0,0);
+    if (determinant != nullptr) *determinant = mat(0,0);
     mat(0,0) = 1./mat(0,0);
     return;
   }
@@ -133,7 +105,7 @@ void tools::invertMatrix(TMatrixDSym& mat, double* determinant){
   if (mat.GetNrows() == 2){
     double *arr = mat.GetMatrixArray();
     double det = arr[0]*arr[3] - arr[1]*arr[1];
-    if (determinant != NULL) *determinant = det;
+    if (determinant != nullptr) *determinant = det;
     if(fabs(det) < 1E-50){
       Exception e("Tools::invertMatrix() - cannot invert matrix, determinant = 0",
           __LINE__,__FILE__);
@@ -152,29 +124,6 @@ void tools::invertMatrix(TMatrixDSym& mat, double* determinant){
     return;
   }
 
-  if (useCramer && mat.GetNrows() <= 6){
-    Bool_t (*inversion)(TMatrixDSym&, Double_t*) = 0;
-    switch (mat.GetNrows()) {
-    case 3:
-      inversion = TMatrixTSymCramerInv::Inv3x3; break;
-    case 4:
-      inversion = TMatrixTSymCramerInv::Inv4x4; break;
-    case 5:
-      inversion = TMatrixTSymCramerInv::Inv5x5; break;
-    case 6:
-      inversion = TMatrixTSymCramerInv::Inv6x6; break;
-    }
-
-    Bool_t success = inversion(mat, determinant);
-    if (!success){
-      Exception e("Tools::invertMatrix() - cannot invert matrix, determinant = 0",
-          __LINE__,__FILE__);
-      e.setFatal();
-      throw e;
-    }
-    return;
-  }
-
   // else use TDecompChol
   bool status = 0;
   TDecompChol invertAlgo(mat, 1E-50);
@@ -187,7 +136,7 @@ void tools::invertMatrix(TMatrixDSym& mat, double* determinant){
     throw e;
   }
 
-  if (determinant != NULL) {
+  if (determinant != nullptr) {
     double d1, d2;
     invertAlgo.Det(d1, d2);
     *determinant = ldexp(d1, d2);
@@ -384,60 +333,6 @@ void tools::QR(TMatrixD& A, TVectorD& b)
       ak[i*nCols + j] = 0.;
 }
 
-// This averages the covariance matrices C1, C2 in a numerically
-// stable way by using matrix square roots.  No optimizations
-// performed, so use with care.
-void tools::safeAverage(const TMatrixDSym& C1, const TMatrixDSym& C2,
-			TMatrixDSym& result)
-{
-  /*
-    The algorithm proceeds as follows:
-    write C1 = S1 S1' (prime for transpose),
-          C2 = S2 S2'
-    Then the inverse of the average can be written as ("." for matrix
-    multiplication)
-         C^-1 = ((S1'^-1, S2'^-1) . (S1'^-1) )
-                (                   (S2'^-1) )
-    Inserting an orthogonal matrix T in the middle:
-         C^-1 = ((S1'^-1, S2'^-1) . T . T' . (S1'^-1) )
-                (                            (S2'^-1) )
-    doesn't change this because T.T' = 1.
-    Now choose T s.t. T'.(S1'^-1, S2'^-1)' is an upper right matrix.  We
-    use Tools::QR for the purpose, as we don't actually need T.
-
-    Then the inverse needed to obtain the covariance matrix can be
-    obtained by inverting the upper right matrix, which is squared to
-    obtained the new covariance matrix.  */
-  TDecompChol dec1(C1);
-  dec1.Decompose();
-  TDecompChol dec2(C2);
-  dec2.Decompose();
-
-  const TMatrixD& S1 = dec1.GetU();
-  const TMatrixD& S2 = dec2.GetU();
-
-  TMatrixD S1inv, S2inv;
-  transposedInvert(S1, S1inv);
-  transposedInvert(S2, S2inv);
-
-  TMatrixD A(2 * S1.GetNrows(), S1.GetNcols());
-  for (int i = 0; i < S1.GetNrows(); ++i) {
-    for (int j = 0; j < S2.GetNcols(); ++j) {
-      A(i, j) = S1inv(i, j);
-      A(i + S1.GetNrows(), j) = S2inv(i, j);
-    }
-  }
-
-  QR(A);
-  A.ResizeTo(S1.GetNrows(), S1.GetNrows());
-
-  TMatrixD inv;
-  transposedInvert(A, inv);
-
-  result.ResizeTo(inv.GetNcols(), inv.GetNcols());
-  result = TMatrixDSym(TMatrixDSym::kAtA, inv);
-}
-
 
 void
 tools::noiseMatrixSqrt(const TMatrixDSym& noise,
@@ -472,16 +367,6 @@ tools::noiseMatrixSqrt(const TMatrixDSym& noise,
   // noiseSqrt * noiseSqrt' = noise
 }
 
-// Transports the state.
-void
-tools::kalmanPrediction(const TVectorD& x,
-			const TVectorD& delta, const TMatrixD& F,
-			TVectorD& xNew)
-{
-  xNew = x;
-  xNew *= F;
-  xNew += delta;
-}
 
 // Transports the square root of the covariance matrix using a
 // square-root formalism
@@ -538,42 +423,4 @@ tools::kalmanUpdateSqrt(const TMatrixD& S,
   update *= K;
 }
 
-
-// Kalman transport + measurement update
-// S : covariance square root (pre-prediction)
-// transport matrix F and noise matrix square root Q
-// res, R, H : residual, measurement covariance square root, H matrix of the measurement
-// The new state is xnew = F*xold + update
-void
-tools::kalmanPredictionUpdateSqrt(const TMatrixD& S,
-				  const TMatrixD& F, const TMatrixD& Q,
-				  const TVectorD& res, const TMatrixD& R,
-				  const AbsHMatrix* H,
-				  TVectorD& update, TMatrixD& SNew)
-{
-  TMatrixD pre(S.GetNrows() + Q.GetNrows() + R.GetNrows(),
-	       S.GetNcols() + R.GetNcols());
-  TMatrixD SFt(S, TMatrixD::kMultTranspose, F);
-  pre.SetSub(                        0,  0,          R);   /*           upper right block is zero               */
-  pre.SetSub(             R.GetNrows(),  0,H->MHt(SFt));   pre.SetSub(R.GetNrows(),             R.GetNcols(),SFt);
-  if (Q.GetNcols() > 0) { // needed to suppress warnings when inserting an empty Q
-    TMatrixD Qt(TMatrixD::kTransposed, Q);
-    pre.SetSub(S.GetNrows()+R.GetNrows(),0,H->MHt(Qt));    pre.SetSub(S.GetNrows()+R.GetNrows(),R.GetNcols(), Qt);
-  }
-
-  tools::QR(pre);
-  const TMatrixD& r = pre;
-
-  TMatrixD a(r.GetSub(0, R.GetNrows()-1, 0, R.GetNcols()-1));
-  TMatrixD K(TMatrixD::kTransposed, r.GetSub(0, R.GetNrows()-1, R.GetNcols(), pre.GetNcols()-1));
-  SNew = r.GetSub(R.GetNrows(), R.GetNrows() + S.GetNrows() - 1,
-		  R.GetNcols(), pre.GetNcols() - 1);
-
-  update.ResizeTo(res);
-  update = res;
-  tools::transposedForwardSubstitution(a, update);
-  update *= K;
-}
-
-
 } /* End of namespace genfit */
diff --git a/core/src/Track.cc b/core/src/Track.cc
index 816fab95d6295eb569dc9d840cb8332d506f74dd..82829c9f5a69e5bd64b69956ef314da069115034 100644
--- a/core/src/Track.cc
+++ b/core/src/Track.cc
@@ -53,7 +53,7 @@ Track::Track(const TrackCand& trackCand, const MeasurementFactory<AbsMeasurement
   cardinalRep_(0), fitStatuses_(), stateSeed_(6), covSeed_(6)
 {
 
-  if (rep != NULL)
+  if (rep != nullptr)
     addTrackRep(rep);
 
   createMeasurements(trackCand, factory);
@@ -68,8 +68,7 @@ Track::Track(const TrackCand& trackCand, const MeasurementFactory<AbsMeasurement
   // fill cache
   fillPointsWithMeasurement();
 
-  // self test
-  assert(checkConsistency());
+  checkConsistency();
 }
 
 void
@@ -123,7 +122,7 @@ Track::Track(const Track& rhs) :
   cardinalRep_(rhs.cardinalRep_), mcTrackId_(rhs.mcTrackId_), timeSeed_(rhs.timeSeed_),
   stateSeed_(rhs.stateSeed_), covSeed_(rhs.covSeed_)
 {
-  assert(rhs.checkConsistency());
+  rhs.checkConsistency();
 
   std::map<const AbsTrackRep*, AbsTrackRep*> oldRepNewRep;
 
@@ -145,8 +144,7 @@ Track::Track(const Track& rhs) :
 
   fillPointsWithMeasurement();
 
-  // self test
-  assert(checkConsistency());
+  checkConsistency();
 }
 
 Track& Track::operator=(Track other) {
@@ -158,8 +156,7 @@ Track& Track::operator=(Track other) {
 
   fillPointsWithMeasurement();
 
-  // self test
-  assert(checkConsistency());
+  checkConsistency();
 
   return *this;
 }
@@ -226,7 +223,7 @@ TrackPoint* Track::getPointWithMeasurement(int id) const {
 
 
 TrackPoint* Track::getPointWithMeasurementAndFitterInfo(int id, const AbsTrackRep* rep) const {
-  if (rep == NULL)
+  if (rep == nullptr)
     rep = getCardinalRep();
 
   if (id >= 0) {
@@ -256,7 +253,7 @@ TrackPoint* Track::getPointWithMeasurementAndFitterInfo(int id, const AbsTrackRe
 
 
 TrackPoint* Track::getPointWithFitterInfo(int id, const AbsTrackRep* rep) const {
-  if (rep == NULL)
+  if (rep == nullptr)
     rep = getCardinalRep();
 
   if (id >= 0) {
@@ -286,11 +283,11 @@ TrackPoint* Track::getPointWithFitterInfo(int id, const AbsTrackRep* rep) const
 
 
 const MeasuredStateOnPlane& Track::getFittedState(int id, const AbsTrackRep* rep, bool biased) const {
-  if (rep == NULL)
+  if (rep == nullptr)
     rep = getCardinalRep();
 
   TrackPoint* point = getPointWithFitterInfo(id, rep);
-  if (point == NULL) {
+  if (point == nullptr) {
     Exception exc("Track::getFittedState ==> no trackPoint with fitterInfo for rep",__LINE__,__FILE__);
     exc.setFatal();
     throw exc;
@@ -312,24 +309,24 @@ int Track::getIdForRep(const AbsTrackRep* rep) const
 
 
 bool Track::hasFitStatus(const AbsTrackRep* rep) const {
-  if (rep == NULL)
+  if (rep == nullptr)
     rep = getCardinalRep();
 
   if (fitStatuses_.find(rep) == fitStatuses_.end())
     return false;
 
-  return (fitStatuses_.at(rep) != NULL);
+  return (fitStatuses_.at(rep) != nullptr);
 }
 
 
 bool Track::hasKalmanFitStatus(const AbsTrackRep* rep) const {
-  if (rep == NULL)
+  if (rep == nullptr)
     rep = getCardinalRep();
 
   if (fitStatuses_.find(rep) == fitStatuses_.end())
     return false;
 
-  return (dynamic_cast<KalmanFitStatus*>(fitStatuses_.at(rep)) != NULL);
+  return (dynamic_cast<KalmanFitStatus*>(fitStatuses_.at(rep)) != nullptr);
 }
 
 
@@ -367,7 +364,7 @@ void Track::insertPoint(TrackPoint* point, int id) {
   #ifdef DEBUG
   debugOut << "Track::insertPoint at position " << id  << "\n";
   #endif
-  assert(point!=NULL);
+  assert(point!=nullptr);
   trackHasChanged();
 
   point->setTrack(this);
@@ -508,6 +505,20 @@ void Track::deletePoint(int id) {
 void Track::insertMeasurement(AbsMeasurement* measurement, int id) {
   insertPoint(new TrackPoint(measurement, this), id);
 }
+  
+void Track::deleteFittedState(const genfit::AbsTrackRep* rep) {
+  if(hasFitStatus(rep)) {
+    delete fitStatuses_.at(rep);
+    fitStatuses_.erase(rep);
+  }
+
+  // delete FitterInfos related to the deleted TrackRep
+  for (const auto& trackPoint : trackPoints_) {
+    if(trackPoint->hasFitterInfo(rep)) {
+      trackPoint->deleteFitterInfo(rep);
+    }
+  }
+}
 
 
 void Track::mergeTrack(const Track* other, int id) {
@@ -614,7 +625,7 @@ void Track::determineCardinalRep() {
     return;
 
   double minChi2(9.E99);
-  const AbsTrackRep* bestRep(NULL);
+  const AbsTrackRep* bestRep(nullptr);
 
   for (std::map< const AbsTrackRep*, FitStatus* >::const_iterator it = fitStatuses_.begin(); it != fitStatuses_.end(); ++it) {
     if (it->second->isFitConverged()) {
@@ -625,7 +636,7 @@ void Track::determineCardinalRep() {
     }
   }
 
-  if (bestRep != NULL) {
+  if (bestRep != nullptr) {
     setCardinalRep(getIdForRep(bestRep));
   }
 }
@@ -716,7 +727,7 @@ void Track::reverseTrackPoints() {
 
 
 void Track::switchPDGSigns(AbsTrackRep* rep) {
-  if (rep != NULL) {
+  if (rep != nullptr) {
     rep->switchPDGSign();
     return;
   }
@@ -751,7 +762,7 @@ void Track::deleteForwardInfo(int startId, int endId, const AbsTrackRep* rep) {
   assert (endId >= startId);
 
   for (std::vector<TrackPoint*>::const_iterator pointIt = trackPoints_.begin() + startId; pointIt != trackPoints_.begin() + endId; ++pointIt) {
-    if (rep != NULL) {
+    if (rep != nullptr) {
       if ((*pointIt)->hasFitterInfo(rep))
         (*pointIt)->getFitterInfo(rep)->deleteForwardInfo();
     }
@@ -782,7 +793,7 @@ void Track::deleteBackwardInfo(int startId, int endId, const AbsTrackRep* rep) {
 
 
   for (std::vector<TrackPoint*>::const_iterator pointIt = trackPoints_.begin() + startId; pointIt != trackPoints_.begin() + endId; ++pointIt) {
-    if (rep != NULL) {
+    if (rep != nullptr) {
       if ((*pointIt)->hasFitterInfo(rep))
         (*pointIt)->getFitterInfo(rep)->deleteBackwardInfo();
     }
@@ -812,7 +823,7 @@ void Track::deleteReferenceInfo(int startId, int endId, const AbsTrackRep* rep)
   assert (endId >= startId);
 
   for (std::vector<TrackPoint*>::const_iterator pointIt = trackPoints_.begin() + startId; pointIt != trackPoints_.begin() + endId; ++pointIt) {
-    if (rep != NULL) {
+    if (rep != nullptr) {
       if ((*pointIt)->hasFitterInfo(rep))
         (*pointIt)->getFitterInfo(rep)->deleteReferenceInfo();
     }
@@ -842,7 +853,7 @@ void Track::deleteMeasurementInfo(int startId, int endId, const AbsTrackRep* rep
   assert (endId >= startId);
 
   for (std::vector<TrackPoint*>::const_iterator pointIt = trackPoints_.begin() + startId; pointIt != trackPoints_.begin() + endId; ++pointIt) {
-    if (rep != NULL) {
+    if (rep != nullptr) {
       if ((*pointIt)->hasFitterInfo(rep))
         (*pointIt)->getFitterInfo(rep)->deleteMeasurementInfo();
     }
@@ -872,7 +883,7 @@ void Track::deleteFitterInfo(int startId, int endId, const AbsTrackRep* rep) {
   assert (endId >= startId);
 
   for (std::vector<TrackPoint*>::const_iterator pointIt = trackPoints_.begin() + startId; pointIt != trackPoints_.begin() + endId; ++pointIt) {
-    if (rep != NULL) {
+    if (rep != nullptr) {
       if ((*pointIt)->hasFitterInfo(rep))
         (*pointIt)->deleteFitterInfo(rep);
     }
@@ -903,7 +914,7 @@ double Track::getTrackLen(AbsTrackRep* rep, int startId, int endId) const {
 
   endId += 1;
 
-  if (rep == NULL)
+  if (rep == nullptr)
     rep = getCardinalRep();
 
   double trackLen(0);
@@ -978,7 +989,7 @@ double Track::getTOF(AbsTrackRep* rep, int startId, int endId) const {
 
   endId += 1;
 
-  if (rep == NULL)
+  if (rep == nullptr)
     rep = getCardinalRep();
 
   StateOnPlane state;
@@ -1013,7 +1024,7 @@ void Track::fixWeights(AbsTrackRep* rep, int startId, int endId) {
 
   for (std::vector<TrackPoint*>::iterator tp = trackPoints_.begin() + startId; tp != trackPoints_.begin() + endId; ++tp) {
     fis.clear();
-    if (rep == NULL) {
+    if (rep == nullptr) {
       fis = (*tp)->getFitterInfos();
     }
     else if ((*tp)->hasFitterInfo(rep)) {
@@ -1022,7 +1033,7 @@ void Track::fixWeights(AbsTrackRep* rep, int startId, int endId) {
 
     for (std::vector< AbsFitterInfo* >::iterator fi = fis.begin(); fi != fis.end(); ++fi) {
       KalmanFitterInfo* kfi = dynamic_cast<KalmanFitterInfo*>(*fi);
-      if (kfi == NULL)
+      if (kfi == nullptr)
         continue;
 
       kfi->fixWeights();
@@ -1085,7 +1096,7 @@ void Track::prune(const Option_t* option) {
       else if (f.hasFlags("LI"))
         fis[j]->deleteBackwardInfo();
 
-      if (f.hasFlags("U") && dynamic_cast<KalmanFitterInfo*>(fis[j]) != NULL) {
+      if (f.hasFlags("U") && dynamic_cast<KalmanFitterInfo*>(fis[j]) != nullptr) {
         static_cast<KalmanFitterInfo*>(fis[j])->deletePredictions();
       }
 
@@ -1272,96 +1283,98 @@ void Track::Print(const Option_t* option) const {
 }
 
 
-bool Track::checkConsistency() const {
+void Track::checkConsistency() const {
 
-  bool retVal(true);
+  bool consistent = true;
+  std::stringstream failures;
 
   std::map<const AbsTrackRep*, const KalmanFitterInfo*> prevFis;
 
   // check if seed is 6D
   if (stateSeed_.GetNrows() != 6) {
-    errorOut << "Track::checkConsistency(): stateSeed_ dimension != 6" << std::endl;
-    retVal = false;
+    failures << "Track::checkConsistency(): stateSeed_ dimension != 6" << std::endl;
+    consistent = false;
   }
 
   if (covSeed_.GetNrows() != 6) {
-    errorOut << "Track::checkConsistency(): covSeed_ dimension != 6" << std::endl;
-    retVal = false;
+    failures << "Track::checkConsistency(): covSeed_ dimension != 6" << std::endl;
+    consistent = false;
   }
 
   if (covSeed_.Max() == 0.) {
-    errorOut << "Track::checkConsistency(): Warning: covSeed_ is zero" << std::endl;
-    //retVal = false;
+    // Nota bene: The consistency is not set to false when this occurs, because it does not break the consistency of
+    // the track. However, when something else fails we keep this as additional error information.
+    failures << "Track::checkConsistency(): Warning: covSeed_ is zero" << std::endl;
   }
 
   // check if correct number of fitStatuses
   if (fitStatuses_.size() != trackReps_.size()) {
-    errorOut << "Track::checkConsistency(): Number of fitStatuses is != number of TrackReps " << std::endl;
-    retVal = false;
+    failures << "Track::checkConsistency(): Number of fitStatuses is != number of TrackReps " << std::endl;
+    consistent = false;
   }
 
   // check if cardinalRep_ is in range of trackReps_
   if (trackReps_.size() && cardinalRep_ >= trackReps_.size()) {
-    errorOut << "Track::checkConsistency(): cardinalRep id " << cardinalRep_ << " out of bounds" << std::endl;
-    retVal = false;
+    failures << "Track::checkConsistency(): cardinalRep id " << cardinalRep_ << " out of bounds" << std::endl;
+    consistent = false;
   }
 
   for (std::vector<AbsTrackRep*>::const_iterator rep = trackReps_.begin(); rep != trackReps_.end(); ++rep) {
-    // check for NULL
-    if ((*rep) == NULL) {
-      errorOut << "Track::checkConsistency(): TrackRep is NULL" << std::endl;
-      retVal = false;
+    // check for nullptr
+    if ((*rep) == nullptr) {
+      failures << "Track::checkConsistency(): TrackRep is nullptr" << std::endl;
+      consistent = false;
     }
 
     // check for valid pdg code
     TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle((*rep)->getPDG());
-    if (particle == NULL) {
-      errorOut << "Track::checkConsistency(): TrackRep pdg ID " << (*rep)->getPDG() << " is not valid" << std::endl;
-      retVal = false;
+    if (particle == nullptr) {
+      failures << "Track::checkConsistency(): TrackRep pdg ID " << (*rep)->getPDG() << " is not valid" << std::endl;
+      consistent = false;
     }
 
     // check if corresponding FitStatus is there
-    if (fitStatuses_.find(*rep) == fitStatuses_.end() and fitStatuses_.find(*rep)->second != NULL) {
-      errorOut << "Track::checkConsistency(): No FitStatus for Rep or FitStatus is NULL" << std::endl;
-      retVal = false;
+    if (fitStatuses_.find(*rep) == fitStatuses_.end() and fitStatuses_.find(*rep)->second != nullptr) {
+      failures << "Track::checkConsistency(): No FitStatus for Rep or FitStatus is nullptr" << std::endl;
+      consistent = false;
     }
   }
 
   // check TrackPoints
   for (std::vector<TrackPoint*>::const_iterator tp = trackPoints_.begin(); tp != trackPoints_.end(); ++tp) {
-    // check for NULL
-    if ((*tp) == NULL) {
-      errorOut << "Track::checkConsistency(): TrackPoint is NULL" << std::endl;
-      retVal = false;
+    // check for nullptr
+    if ((*tp) == nullptr) {
+      failures << "Track::checkConsistency(): TrackPoint is nullptr" << std::endl;
+      consistent = false;
     }
     // check if trackPoint points back to this track
     if ((*tp)->getTrack() != this) {
-      errorOut << "Track::checkConsistency(): TrackPoint does not point back to this track" << std::endl;
-      retVal = false;
+      failures << "Track::checkConsistency(): TrackPoint does not point back to this track" << std::endl;
+      consistent = false;
     }
 
     // check rawMeasurements
     const std::vector<AbsMeasurement*>& rawMeasurements = (*tp)->getRawMeasurements();
     for (std::vector<AbsMeasurement*>::const_iterator m = rawMeasurements.begin(); m != rawMeasurements.end(); ++m) {
-      // check for NULL
-      if ((*m) == NULL) {
-        errorOut << "Track::checkConsistency(): Measurement is NULL" << std::endl;
-        retVal = false;
+      // check for nullptr
+      if ((*m) == nullptr) {
+        failures << "Track::checkConsistency(): Measurement is nullptr" << std::endl;
+        consistent = false;
       }
       // check if measurement points back to TrackPoint
       if ((*m)->getTrackPoint() != *tp) {
-        errorOut << "Track::checkConsistency(): Measurement does not point back to correct TrackPoint" << std::endl;
-        retVal = false;
+        failures << "Track::checkConsistency(): Measurement does not point back to correct TrackPoint" << std::endl;
+        consistent = false;
       }
     }
 
     // check fitterInfos
     std::vector<AbsFitterInfo*> fitterInfos = (*tp)->getFitterInfos();
     for (std::vector<AbsFitterInfo*>::const_iterator fi = fitterInfos.begin(); fi != fitterInfos.end(); ++fi) {
-      // check for NULL
-      if ((*fi) == NULL) {
-        errorOut << "Track::checkConsistency(): FitterInfo is NULL. TrackPoint: " << *tp << std::endl;
-        retVal = false;
+      // check for nullptr
+      if ((*fi) == nullptr) {
+        failures << "Track::checkConsistency(): FitterInfo is nullptr. TrackPoint: " << *tp << std::endl;
+        consistent = false;
       }
 
       // check if fitterInfos point to valid TrackReps in trackReps_
@@ -1372,33 +1385,33 @@ bool Track::checkConsistency() const {
         }
       }
       if (mycount ==  0) {
-        errorOut << "Track::checkConsistency(): fitterInfo points to TrackRep which is not in Track" << std::endl;
-        retVal = false;
+        failures << "Track::checkConsistency(): fitterInfo points to TrackRep which is not in Track" << std::endl;
+        consistent = false;
       }
 
       if (!( (*fi)->checkConsistency(&(this->getFitStatus((*fi)->getRep())->getPruneFlags())) ) ) {
-        errorOut << "Track::checkConsistency(): FitterInfo not consistent. TrackPoint: " << *tp << std::endl;
-        retVal = false;
+        failures << "Track::checkConsistency(): FitterInfo not consistent. TrackPoint: " << *tp << std::endl;
+        consistent = false;
       }
 
-      if (dynamic_cast<KalmanFitterInfo*>(*fi) != NULL) {
-        if (prevFis[(*fi)->getRep()] != NULL &&
+      if (dynamic_cast<KalmanFitterInfo*>(*fi) != nullptr) {
+        if (prevFis[(*fi)->getRep()] != nullptr &&
             static_cast<KalmanFitterInfo*>(*fi)->hasReferenceState() &&
             prevFis[(*fi)->getRep()]->hasReferenceState() ) {
           double len = static_cast<KalmanFitterInfo*>(*fi)->getReferenceState()->getForwardSegmentLength();
           double prevLen = prevFis[(*fi)->getRep()]->getReferenceState()->getBackwardSegmentLength();
           if (fabs(prevLen + len) > 1E-10 ) {
-            errorOut << "Track::checkConsistency(): segment lengths of reference states for rep " << (*fi)->getRep() << " (id " << getIdForRep((*fi)->getRep()) << ") at TrackPoint " << (*tp) << " don't match" << std::endl;
-            errorOut << prevLen << " + " << len << " = " << prevLen + len << std::endl;
-            errorOut << "TrackPoint " << *tp << ", FitterInfo " << *fi << ", rep " << getIdForRep((*fi)->getRep()) << std::endl;
-            retVal = false;
+            failures << "Track::checkConsistency(): segment lengths of reference states for rep " << (*fi)->getRep() << " (id " << getIdForRep((*fi)->getRep()) << ") at TrackPoint " << (*tp) << " don't match" << std::endl;
+            failures << prevLen << " + " << len << " = " << prevLen + len << std::endl;
+            failures << "TrackPoint " << *tp << ", FitterInfo " << *fi << ", rep " << getIdForRep((*fi)->getRep()) << std::endl;
+            consistent = false;
           }
         }
 
         prevFis[(*fi)->getRep()] = static_cast<KalmanFitterInfo*>(*fi);
       }
       else
-        prevFis[(*fi)->getRep()] = NULL;
+        prevFis[(*fi)->getRep()] = nullptr;
 
     } // end loop over FitterInfos
 
@@ -1415,20 +1428,22 @@ bool Track::checkConsistency() const {
   }
 
   if (trackPointsWithMeasurement.size() != trackPointsWithMeasurement_.size()) {
-    errorOut << "Track::checkConsistency(): trackPointsWithMeasurement_ has incorrect size" << std::endl;
-    retVal = false;
+    failures << "Track::checkConsistency(): trackPointsWithMeasurement_ has incorrect size" << std::endl;
+    consistent = false;
   }
 
   for (unsigned int i = 0; i < trackPointsWithMeasurement.size(); ++i) {
     if (trackPointsWithMeasurement[i] != trackPointsWithMeasurement_[i]) {
-      errorOut << "Track::checkConsistency(): trackPointsWithMeasurement_ is not correct" << std::endl;
-      errorOut << "has         id " << i << ", address " << trackPointsWithMeasurement_[i] << std::endl;
-      errorOut << "should have id " << i << ", address " << trackPointsWithMeasurement[i] << std::endl;
-      retVal = false;
+      failures << "Track::checkConsistency(): trackPointsWithMeasurement_ is not correct" << std::endl;
+      failures << "has         id " << i << ", address " << trackPointsWithMeasurement_[i] << std::endl;
+      failures << "should have id " << i << ", address " << trackPointsWithMeasurement[i] << std::endl;
+      consistent = false;
     }
   }
 
-  return retVal;
+  if (not consistent) {
+    throw genfit::Exception(failures.str(), __LINE__, __FILE__);
+  }
 }
 
 
diff --git a/core/src/TrackPoint.cc b/core/src/TrackPoint.cc
index c21b0b23992850de610bf28b8b1d58fe2f53147c..9342e823830dd1d42b3d03125979c64ca2ea10eb 100644
--- a/core/src/TrackPoint.cc
+++ b/core/src/TrackPoint.cc
@@ -24,24 +24,25 @@
 #include "KalmanFitterInfo.h"
 #include "IO.h"
 
+#include <algorithm>
 #include <TBuffer.h>
 
 namespace genfit {
 
 TrackPoint::TrackPoint() :
-  sortingParameter_(0), track_(NULL), thinScatterer_(NULL)
+  sortingParameter_(0), track_(nullptr), thinScatterer_(nullptr)
 {
   ;
 }
 
 TrackPoint::TrackPoint(Track* track) :
-  sortingParameter_(0), track_(track), thinScatterer_(NULL)
+  sortingParameter_(0), track_(track), thinScatterer_(nullptr)
 {
   ;
 }
 
 TrackPoint::TrackPoint(const std::vector< genfit::AbsMeasurement* >& rawMeasurements, Track* track) :
-  sortingParameter_(0), track_(track), thinScatterer_(NULL)
+  sortingParameter_(0), track_(track), thinScatterer_(nullptr)
 {
   rawMeasurements_.reserve(rawMeasurements.size());
 
@@ -51,7 +52,7 @@ TrackPoint::TrackPoint(const std::vector< genfit::AbsMeasurement* >& rawMeasurem
 }
 
 TrackPoint::TrackPoint(AbsMeasurement* rawMeasurement, Track* track) :
-  sortingParameter_(0), track_(track), thinScatterer_(NULL)
+  sortingParameter_(0), track_(track), thinScatterer_(nullptr)
 {
   addRawMeasurement(rawMeasurement);
 }
@@ -59,7 +60,7 @@ TrackPoint::TrackPoint(AbsMeasurement* rawMeasurement, Track* track) :
 
 TrackPoint::TrackPoint(const TrackPoint& rhs) :
   TObject(rhs),
-  sortingParameter_(rhs.sortingParameter_), track_(rhs.track_), thinScatterer_(NULL)
+  sortingParameter_(rhs.sortingParameter_), track_(rhs.track_), thinScatterer_(nullptr)
 {
   // clone rawMeasurements
   for (std::vector<AbsMeasurement*>::const_iterator it = rhs.rawMeasurements_.begin(); it != rhs.rawMeasurements_.end(); ++it) {
@@ -74,14 +75,14 @@ TrackPoint::TrackPoint(const TrackPoint& rhs) :
     setFitterInfo(fi);
   }
 
-  if (rhs.thinScatterer_ != NULL)
+  if (rhs.thinScatterer_ != nullptr)
     thinScatterer_.reset(new ThinScatterer(*(rhs.thinScatterer_)));
 }
 
 TrackPoint::TrackPoint(const TrackPoint& rhs,
     const std::map<const AbsTrackRep*, AbsTrackRep*>& map,
     const std::vector<const genfit::AbsTrackRep*> * repsToIgnore) :
-  sortingParameter_(rhs.sortingParameter_), track_(rhs.track_), thinScatterer_(NULL)
+  sortingParameter_(rhs.sortingParameter_), track_(rhs.track_), thinScatterer_(nullptr)
 {
   // clone rawMeasurements
   for (std::vector<AbsMeasurement*>::const_iterator it = rhs.rawMeasurements_.begin(); it!=rhs.rawMeasurements_.end(); ++it) {
@@ -91,7 +92,7 @@ TrackPoint::TrackPoint(const TrackPoint& rhs,
 
   // copy fitterInfos
   for (std::map<const AbsTrackRep*, AbsFitterInfo* >::const_iterator it = rhs.fitterInfos_.begin(); it != rhs.fitterInfos_.end();  ++it ) {
-    if (repsToIgnore != NULL) {
+    if (repsToIgnore != nullptr) {
       if (std::find(repsToIgnore->begin(), repsToIgnore->end(), it->first) != repsToIgnore->end())
         continue;
     }
@@ -101,7 +102,7 @@ TrackPoint::TrackPoint(const TrackPoint& rhs,
     setFitterInfo(fi);
   }
 
-  if (rhs.thinScatterer_ != NULL)
+  if (rhs.thinScatterer_ != nullptr)
     thinScatterer_.reset(new ThinScatterer(*(rhs.thinScatterer_)));
 }
 
@@ -171,7 +172,7 @@ AbsFitterInfo* TrackPoint::getFitterInfo(const AbsTrackRep* rep) const {
     rep = track_->getCardinalRep();
   std::map<const AbsTrackRep*, AbsFitterInfo*>::const_iterator it = fitterInfos_.find(rep);
   if (it == fitterInfos_.end())
-    return NULL;
+    return nullptr;
   return fitterInfos_.at(rep);
 }
 
@@ -191,7 +192,7 @@ void TrackPoint::deleteRawMeasurements() {
 
 
 void TrackPoint::setFitterInfo(genfit::AbsFitterInfo* fitterInfo) {
-  assert (fitterInfo != NULL);
+  assert (fitterInfo != nullptr);
   if (hasFitterInfo(fitterInfo->getRep()))
     delete fitterInfos_[fitterInfo->getRep()];
 
@@ -251,10 +252,9 @@ void TrackPoint::Streamer(TBuffer &R__b)
           R__stl.push_back(R__t);
         }
       }
-      track_ = NULL;
+      track_ = nullptr;
       size_t nTrackReps;
       R__b >> nTrackReps;
-      vFitterInfos_.resize(nTrackReps);
       for (size_t i = 0; i < nTrackReps; ++i)  {
         int id;
         R__b >> id;
@@ -277,10 +277,10 @@ void TrackPoint::Streamer(TBuffer &R__b)
       for (size_t i = 0; i < rawMeasurements_.size(); ++i) {
         rawMeasurements_[i]->setTrackPoint(this);
       }
-      for (size_t i = 0; i < vFitterInfos_.size(); ++i) {
-        // May not have FitterInfos for all reps.
-        if (vFitterInfos_[i])
-          vFitterInfos_[i]->setTrackPoint(this);
+      for (auto& trackRepIDWithFitterInfo : vFitterInfos_) {
+        AbsFitterInfo* fitterInfo = trackRepIDWithFitterInfo.second;
+        if (fitterInfo)
+          fitterInfo->setTrackPoint(this);
       }
    } else {
       R__c = R__b.WriteVersion(thisClass::IsA(), kTRUE);
@@ -318,14 +318,18 @@ void TrackPoint::Streamer(TBuffer &R__b)
 
 void TrackPoint::fixupRepsForReading()
 {
-  for (size_t i = 0; i < vFitterInfos_.size(); ++i) {
-    // The vector is filled such that i corresponds to the id of the TrackRep.
-    
+  for (auto& trackRepIDWithFitterInfo : vFitterInfos_) {
+    // The map is filled such that i corresponds to the id of the TrackRep.
+    const unsigned int id = trackRepIDWithFitterInfo.first;
+    AbsFitterInfo* fitterInfo = trackRepIDWithFitterInfo.second;
+
     // May not have FitterInfos for all reps.
-    if (!vFitterInfos_[i])
+    if (!fitterInfo)
       continue;
-    fitterInfos_[track_->getTrackRep(i)] = vFitterInfos_[i];
-    fitterInfos_[track_->getTrackRep(i)]->setRep(track_->getTrackRep(i));
+    AbsTrackRep* trackRep = track_->getTrackRep(id);
+
+    fitterInfos_[trackRep] = fitterInfo;
+    fitterInfos_[trackRep]->setRep(trackRep);
   }
   vFitterInfos_.clear();
 }
diff --git a/core/src/coreLinkDef.h b/core/src/coreLinkDef.h
index f7346b1e01bfb4ce2412cd5a1115b00747e816c9..1aebbf65f3a6bb6d6f2fe7762defa42944e71a19 100644
--- a/core/src/coreLinkDef.h
+++ b/core/src/coreLinkDef.h
@@ -1,25 +1,22 @@
-#ifdef __CINT__
-
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
 
-#ifdef __CLING__
 #pragma link C++ nestedclass;
 #pragma link C++ nestedtypedef;
 
 #pragma link C++ namespace genfit;
-#endif
 
 // These need no special treatment.
 #pragma link C++ class genfit::AbsFinitePlane+;
 #pragma link C++ class genfit::AbsHMatrix+;
 #pragma link C++ class genfit::RectangularFinitePlane+;
 #pragma link C++ class genfit::FitStatus+;
-#pragma link C++ class genfit::MaterialProperties+;
+#pragma link C++ class genfit::Material+;
 #pragma link C++ class genfit::PruneFlags+;
 #pragma link C++ class genfit::TrackCand+;
 #pragma link C++ class genfit::TrackCandHit+;
+#pragma link C++ class genfit::SharedPlanePtrCreator-;
 
 // These inherit from classes with custom streamers, or reference shared_ptrs in their interfaces.
 #pragma link C++ class genfit::AbsTrackRep+;
@@ -60,6 +57,3 @@
   targetClass="genfit::TrackCand"                          \
   source="" target="time_"                                 \
   code="{ time_ = 0; }"
-
-
-#endif
diff --git a/eventDisplay/src/EventDisplay.cc b/eventDisplay/src/EventDisplay.cc
index 83e9d6e55cebd74c9365ceb936ce9bb17d13360f..b64d002cfda1dce00f4c31dcde9ccc03f6f040e8 100644
--- a/eventDisplay/src/EventDisplay.cc
+++ b/eventDisplay/src/EventDisplay.cc
@@ -54,15 +54,12 @@
 #include <TVectorD.h>
 #include <TSystem.h>
 
-#include "boost/scoped_ptr.hpp"
-
-
-ClassImp(genfit::EventDisplay)
+#include <memory>
 
 namespace genfit {
 
 
-EventDisplay* EventDisplay::eventDisplay_ = NULL;
+EventDisplay* EventDisplay::eventDisplay_ = nullptr;
 
 EventDisplay::EventDisplay() :
   errorScale_(1.),
@@ -139,7 +136,7 @@ double EventDisplay::getErrScale() { return errorScale_; }
 
 EventDisplay* EventDisplay::getInstance() {
 
-  if(eventDisplay_ == NULL) {
+  if(eventDisplay_ == nullptr) {
     eventDisplay_ = new EventDisplay();
   }
   return eventDisplay_;
@@ -279,13 +276,13 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
   // draw the geometry, does not really work yet. If it's fixed, the docu in the header file should be changed.
   if(drawGeometry_) {
     TGeoNode* top_node = gGeoManager->GetTopNode();
-    assert(top_node != NULL);
+    assert(top_node != nullptr);
 
     //Set transparency & color of geometry
     TObjArray* volumes = gGeoManager->GetListOfVolumes();
     for(int i = 0; i < volumes->GetEntriesFast(); i++) {
       TGeoVolume* volume = dynamic_cast<TGeoVolume*>(volumes->At(i));
-      assert(volume != NULL);
+      assert(volume != nullptr);
       volume->SetLineColor(12);
       volume->SetTransparency(50);
     }
@@ -302,18 +299,19 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
       continue;
 
     Track* track = events_[id]->at(i);
-    if (! track->checkConsistency()){
-      std::cerr<<"track is not consistent"<<std::endl;
+    try {
+      track->checkConsistency();
+    } catch (genfit::Exception& e) {
+      std::cerr<< e.getExcString() <<std::endl;
       continue;
     }
 
-
-    boost::scoped_ptr<Track> refittedTrack(NULL);
+    std::unique_ptr<Track> refittedTrack(nullptr);
     if (refit_) {
 
       std::cout << "Refit track:" << std::endl;
 
-      boost::scoped_ptr<AbsKalmanFitter> fitter;
+      std::unique_ptr<AbsKalmanFitter> fitter;
       switch (fitterId_) {
         case SimpleKalman:
           fitter.reset(new KalmanFitter(nMaxIter_, dPVal_));
@@ -353,9 +351,9 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
       timeval startcputime, endcputime;
 
       try{
-        gettimeofday(&startcputime, NULL);
+        gettimeofday(&startcputime, nullptr);
         fitter->processTrack(refittedTrack.get(), resort_);
-        gettimeofday(&endcputime, NULL);
+        gettimeofday(&endcputime, nullptr);
       }
       catch(genfit::Exception& e){
         std::cerr << e.what();
@@ -366,8 +364,10 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
       int microseconds = 1000000*(endcputime.tv_sec - startcputime.tv_sec) + (endcputime.tv_usec - startcputime.tv_usec);
       std::cout << "it took " << double(microseconds) /  1000 << " ms of CPU to fit the track\n";
 
-      if (! refittedTrack->checkConsistency()){
-        std::cerr<<"refittedTrack is not consistent"<<std::endl;
+      try {
+        refittedTrack->checkConsistency();
+      } catch (genfit::Exception& e) {
+        std::cerr<< e.getExcString() <<std::endl;
         continue;
       }
 
@@ -415,12 +415,12 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
 
     KalmanFitterInfo* fi;
     KalmanFitterInfo* prevFi = 0;
-    const MeasuredStateOnPlane* fittedState(NULL);
-    const MeasuredStateOnPlane* prevFittedState(NULL);
+    const MeasuredStateOnPlane* fittedState(nullptr);
+    const MeasuredStateOnPlane* prevFittedState(nullptr);
 
     for(unsigned int j = 0; j < numhits; j++) { // loop over all hits in the track
 
-      fittedState = NULL;
+      fittedState = nullptr;
 
       TrackPoint* tp = track->getPointWithMeasurement(j);
       if (! tp->hasRawMeasurements()) {
@@ -455,7 +455,7 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
       AbsFitterInfo* fitterInfo = tp->getFitterInfo(rep);
 
       fi = dynamic_cast<KalmanFitterInfo*>(fitterInfo);
-      if(fi == NULL) {
+      if(fi == nullptr) {
         std::cerr<<"can only display KalmanFitterInfo"<<std::endl;
         continue;
       }
@@ -470,14 +470,14 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
         catch (Exception& e) {
           std::cerr << e.what();
           std::cerr<<"can not get fitted state"<<std::endl;
-          fittedState = NULL;
+          fittedState = nullptr;
           prevFi = fi;
           prevFittedState = fittedState;
           continue;
         }
       }
 
-      if (fittedState == NULL) {
+      if (fittedState == nullptr) {
         if (fi->hasForwardUpdate()) {
           fittedState = fi->getForwardUpdate();
         }
@@ -492,7 +492,7 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
         }
       }
 
-      if (fittedState == NULL) {
+      if (fittedState == nullptr) {
         std::cout << "cannot get any state from fitterInfo, continue.\n";
         prevFi = fi;
         prevFittedState = fittedState;
@@ -506,12 +506,12 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
 
 
       // determine measurement type
-      bool full_hit =  (dynamic_cast<const FullMeasurement*>(m) != NULL);
-      bool planar_hit = (dynamic_cast<const PlanarMeasurement*>(m) != NULL);
+      bool full_hit =  (dynamic_cast<const FullMeasurement*>(m) != nullptr);
+      bool planar_hit = (dynamic_cast<const PlanarMeasurement*>(m) != nullptr);
       bool planar_pixel_hit = planar_hit && hit_coords_dim == 2;
-      bool space_hit = (dynamic_cast<const SpacepointMeasurement*>(m) != NULL);
+      bool space_hit = (dynamic_cast<const SpacepointMeasurement*>(m) != nullptr);
       bool wire_hit = m && m->isLeftRightMeasurement();
-      bool wirepoint_hit = wire_hit &&  (dynamic_cast<const WirePointMeasurement*>(m) != NULL);
+      bool wirepoint_hit = wire_hit &&  (dynamic_cast<const WirePointMeasurement*>(m) != nullptr);
       if (!full_hit && !planar_hit && !planar_pixel_hit && !space_hit && !wire_hit && !wirepoint_hit) {
         std::cout << "Track " << i << ", Hit " << j << ": Unknown measurement type: skipping hit!" << std::endl;
         continue;
@@ -543,7 +543,7 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
 
         if(planar_hit) {
           if(!planar_pixel_hit) {
-            if (dynamic_cast<RKTrackRep*>(rep) != NULL) {
+            if (dynamic_cast<RKTrackRep*>(rep) != nullptr) {
               const TMatrixD& H = mop->getHMatrix()->getMatrix();
               stripDir.Set(H(0,3), H(0,4));
             }
@@ -589,7 +589,7 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
                   makeLines(&update, fi->getBackwardUpdate(), rep, kMagenta, 1, drawTrackMarkers_, drawErrors_, 1);
               }
             }
-            if (j > 0 && prevFi != NULL) {
+            if (j > 0 && prevFi != nullptr) {
               if(drawTrack_) {
                 makeLines(prevFittedState, fittedState, rep, charge > 0 ? kRed : kBlue, 1, drawTrackMarkers_, drawErrors_, 3);
                 if (drawErrors_) { // make sure to draw errors in both directions
@@ -611,8 +611,8 @@ void EventDisplay::drawEvent(unsigned int id, bool resetCam) {
               if(drawRefTrack_ && fi->hasReferenceState() && prevFi->hasReferenceState())
                 makeLines(prevFi->getReferenceState(), fi->getReferenceState(), rep, charge > 0 ? kRed + 2 : kBlue + 2, 2, drawTrackMarkers_, false, 3);
             }
-            else if (j > 0 && prevFi == NULL) {
-              std::cout << "previous FitterInfo == NULL \n";
+            else if (j > 0 && prevFi == nullptr) {
+              std::cout << "previous FitterInfo == nullptr \n";
             }
         }
         catch (Exception& e) {
@@ -986,8 +986,8 @@ TEveBox* EventDisplay::boxCreator(TVector3 o, TVector3 u, TVector3 v, float ud,
 void EventDisplay::makeLines(const StateOnPlane* prevState, const StateOnPlane* state, const AbsTrackRep* rep,
     const Color_t& color, const Style_t& style, bool drawMarkers, bool drawErrors, double lineWidth, int markerPos)
 {
-  if (prevState == NULL || state == NULL) {
-    std::cerr << "prevState == NULL || state == NULL\n";
+  if (prevState == nullptr || state == nullptr) {
+    std::cerr << "prevState == nullptr || state == nullptr\n";
     return;
   }
 
@@ -1028,7 +1028,7 @@ void EventDisplay::makeLines(const StateOnPlane* prevState, const StateOnPlane*
     else
       measuredState = dynamic_cast<const MeasuredStateOnPlane*>(state);
 
-    if (measuredState != NULL) {
+    if (measuredState != nullptr) {
 
       // step for evaluate at a distance from the original plane
       TVector3 eval;
diff --git a/eventDisplay/src/eventDisplayLinkDef.h b/eventDisplay/src/eventDisplayLinkDef.h
index 2051fd52b61dc7f0e14cbe0fbe98cddd2230ddae..487066ac618eb80a16b29f0791229f66ed4aa6d0 100644
--- a/eventDisplay/src/eventDisplayLinkDef.h
+++ b/eventDisplay/src/eventDisplayLinkDef.h
@@ -1,17 +1,11 @@
-#ifdef __CINT__
-
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
 
-#ifdef __CLING__
 #pragma link C++ nestedclass;
 #pragma link C++ nestedtypedef;
 
 #pragma link C++ namespace genfit;
-#endif
 
 // These need no special treatment.
 #pragma link C++ class genfit::EventDisplay+;
-
-#endif
diff --git a/fitters/include/DAF.h b/fitters/include/DAF.h
index 1968530d9632684394e4f93377d3d669ba9c3062..1a585b5bb9057151d287bebf74c160bec9621f8d 100644
--- a/fitters/include/DAF.h
+++ b/fitters/include/DAF.h
@@ -27,6 +27,7 @@
 
 #include <vector>
 #include <map>
+#include <memory>
 
 
 namespace genfit {
@@ -59,15 +60,15 @@ class DAF : public AbsKalmanFitter {
    *
    * @param useRefKalman If false, use KalmanFitter as fitter.
    */
-  DAF(bool useRefKalman = true, double deltaWeight = 1e-3, double deltaPval = 1e-3);
+  DAF(bool useRefKalman = true, double deltaPval = 1e-3, double deltaWeight = 1e-3);
   /**
    * @brief Create DAF. Use the provided AbsKalmanFitter as fitter.
    */
-  DAF(AbsKalmanFitter* kalman, double deltaWeight = 1e-3, double deltaPval = 1e-3);
+  DAF(AbsKalmanFitter* kalman, double deltaPval = 1e-3, double deltaWeight = 1e-3);
   ~DAF() {};
 
   //! Process a track using the DAF.
-  void processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits = false);
+  void processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits = false) override;
 
   /** @brief Set the probability cut for the weight calculation for the hits.
    *
@@ -80,15 +81,7 @@ class DAF : public AbsKalmanFitter {
   //! Set the probability cut for the weight calculation for the hits for a specific measurement dimensionality.
   void addProbCut(const double prob_cut, const int measDim);
 
-  /** @brief Configure the annealing scheme.
-   *
-   * In the current implementation you need to provide at least one temperature
-   * and not more then ten temperatures.
-   * Also sets #minIterations_ and #maxIterations_.
-   */
-  void setBetas(double b1,double b2=-1, double b3=-1., double b4=-1., double b5=-1., double b6=-1., double b7=-1., double b8=-1., double b9=-1., double b10=-1.);
-
-  const std::vector<double>& getBetas() {return betas_;}
+  const std::vector<double>& getBetas() const {return betas_;}
 
   /** @brief Configure the annealing scheme.
    *
@@ -97,16 +90,16 @@ class DAF : public AbsKalmanFitter {
    */
   void setAnnealingScheme(double bStart, double bFinal, unsigned int nSteps);
 
-  void setMaxIterations(unsigned int n) {maxIterations_ = n; betas_.resize(maxIterations_,betas_.back());}
+  void setMaxIterations(unsigned int n) override {maxIterations_ = n; betas_.resize(maxIterations_,betas_.back());}
 
   //! If all weights change less than delta between two iterations, the fit is regarded as converged.
   void setConvergenceDeltaWeight(double delta) {deltaWeight_ = delta;}
 
   AbsKalmanFitter* getKalman() const {return kalman_.get();}
 
-  virtual void setMaxFailedHits(int val) {getKalman()->setMaxFailedHits(val);}
+  virtual void setMaxFailedHits(int val) override {getKalman()->setMaxFailedHits(val);}
 
-  virtual void setDebugLvl(unsigned int lvl = 1) {AbsFitter::setDebugLvl(lvl); if (lvl > 1) getKalman()->setDebugLvl(lvl-1);}
+  virtual void setDebugLvl(unsigned int lvl = 1) override {AbsFitter::setDebugLvl(lvl); if (lvl > 1) getKalman()->setDebugLvl(lvl-1);}
 
  private:
 
@@ -123,15 +116,12 @@ class DAF : public AbsKalmanFitter {
 			// parameter, i.e. we're living in 3D space,
 			// where time may be used in the fit.  Zeroth
 			// entry is not used.
-#ifndef __CINT__
-  boost::scoped_ptr<AbsKalmanFitter> kalman_;
-#else
-  AbsKalmanFitter* kalman_;
-#endif
+
+  std::unique_ptr<AbsKalmanFitter> kalman_;
 
  public:
 
-  ClassDef(DAF,2)
+  ClassDefOverride(DAF,2)
 
 };
 
diff --git a/fitters/include/KalmanFitStatus.h b/fitters/include/KalmanFitStatus.h
index bef5725c1e4a38ebe948d4ab3b941f4782555eeb..0b01d2cd0edd4d995669e95bc933bf0ae02bee34 100644
--- a/fitters/include/KalmanFitStatus.h
+++ b/fitters/include/KalmanFitStatus.h
@@ -43,7 +43,7 @@ class KalmanFitStatus : public FitStatus {
 
   virtual ~KalmanFitStatus() {};
 
-  virtual FitStatus* clone() const {return new KalmanFitStatus(*this);}
+  virtual FitStatus* clone() const override {return new KalmanFitStatus(*this);}
 
   unsigned int getNumIterations() const {return numIterations_;}
   bool isFittedWithDaf() const {return fittedWithDaf_;}
@@ -66,7 +66,7 @@ class KalmanFitStatus : public FitStatus {
   void setForwardNdf(double fNdf) {fNdf_ = fNdf;}
   void setBackwardNdf(double bNdf) {FitStatus::setNdf(bNdf);}
 
-  virtual void Print(const Option_t* = "") const;
+  virtual void Print(const Option_t* = "") const override;
 
  protected:
 
@@ -82,7 +82,7 @@ class KalmanFitStatus : public FitStatus {
 
  public:
 
-  ClassDef(KalmanFitStatus, 1)
+  ClassDefOverride(KalmanFitStatus, 1)
 
 };
 
diff --git a/fitters/include/KalmanFitter.h b/fitters/include/KalmanFitter.h
index 21d8947dd4c43b1024664daf51bf006c5d231a3a..4e52744cdd4d4f1496b3e9de23867eec229fa0f4 100644
--- a/fitters/include/KalmanFitter.h
+++ b/fitters/include/KalmanFitter.h
@@ -25,9 +25,7 @@
 
 #include "AbsKalmanFitter.h"
 
-#ifndef __CINT__
-#include <boost/scoped_ptr.hpp>
-#endif
+#include <memory>
 
 
 namespace genfit {
@@ -50,14 +48,14 @@ class KalmanFitter : public AbsKalmanFitter {
  public:
 
   KalmanFitter(unsigned int maxIterations = 4, double deltaPval = 1e-3, double blowUpFactor = 1e3, bool squareRootFormalism = false)
-    : AbsKalmanFitter(maxIterations, deltaPval, blowUpFactor), currentState_(NULL),
+    : AbsKalmanFitter(maxIterations, deltaPval, blowUpFactor), currentState_(nullptr),
       squareRootFormalism_(squareRootFormalism)
   {}
 
   ~KalmanFitter() {}
 
   //! Hit resorting currently NOT supported.
-  void processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits = false);
+  void processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits = false) override;
 
   //! process only a part of the track. Can also be used to process the track only in backward direction.
   //! Does not alter the FitStatus and does not do multiple iterations.
@@ -70,16 +68,12 @@ class KalmanFitter : public AbsKalmanFitter {
   void processTrackPoint(TrackPoint* tp,
       const AbsTrackRep* rep, double& chi2, double& ndf, int direction);
 
-#ifndef __CINT__
-  boost::scoped_ptr<MeasuredStateOnPlane> currentState_;
-#else
-  MeasuredStateOnPlane* currentState_;
-#endif
+  std::unique_ptr<MeasuredStateOnPlane> currentState_;
 
   bool squareRootFormalism_;
 
  public:
-  ClassDef(KalmanFitter,1)
+  ClassDefOverride(KalmanFitter,1)
 
 };
 
diff --git a/fitters/include/KalmanFitterInfo.h b/fitters/include/KalmanFitterInfo.h
index 4ceb20feb33b9210623de6ffce3bdfaeab5a6dec..8c70b6955579309dbb6760d9d4b2eafb873cb042 100644
--- a/fitters/include/KalmanFitterInfo.h
+++ b/fitters/include/KalmanFitterInfo.h
@@ -32,9 +32,7 @@
 
 #include <vector>
 
-#ifndef __CINT__
-#include <boost/scoped_ptr.hpp>
-#endif
+#include <memory>
 
 
 namespace genfit {
@@ -51,7 +49,7 @@ class KalmanFitterInfo : public AbsFitterInfo {
   KalmanFitterInfo(const TrackPoint* trackPoint, const AbsTrackRep* rep);
   virtual ~KalmanFitterInfo();
 
-  virtual KalmanFitterInfo* clone() const;
+  virtual KalmanFitterInfo* clone() const override;
 
   ReferenceStateOnPlane* getReferenceState() const {return referenceState_.get();}
   MeasuredStateOnPlane* getForwardPrediction() const {return forwardPrediction_.get();}
@@ -73,18 +71,18 @@ class KalmanFitterInfo : public AbsFitterInfo {
   //! Are the weights fixed?
   bool areWeightsFixed() const {return fixWeights_;}
   //! Get unbiased or biased (default) smoothed state.
-  const MeasuredStateOnPlane& getFittedState(bool biased = true) const;
+  const MeasuredStateOnPlane& getFittedState(bool biased = true) const override;
   //! Get unbiased (default) or biased residual from ith measurement.
-  MeasurementOnPlane getResidual(unsigned int iMeasurement = 0, bool biased = false, bool onlyMeasurementErrors = true) const; // calculate residual, track and measurement errors are added if onlyMeasurementErrors is false
-  double getSmoothedChi2(unsigned int iMeasurement = 0);
-
-  bool hasMeasurements() const {return getNumMeasurements() > 0;}
-  bool hasReferenceState() const {return (referenceState_.get() != NULL);}
-  bool hasForwardPrediction() const {return (forwardPrediction_.get()  != NULL);}
-  bool hasBackwardPrediction() const {return (backwardPrediction_.get() != NULL);}
-  bool hasForwardUpdate() const {return (forwardUpdate_.get() != NULL);}
-  bool hasBackwardUpdate() const {return (backwardUpdate_.get() != NULL);}
-  bool hasUpdate(int direction) const {if (direction < 0) return hasBackwardUpdate(); return hasForwardUpdate();}
+  MeasurementOnPlane getResidual(unsigned int iMeasurement = 0, bool biased = false, bool onlyMeasurementErrors = true) const override; // calculate residual, track and measurement errors are added if onlyMeasurementErrors is false
+  double getSmoothedChi2(unsigned int iMeasurement = 0) const;
+
+  bool hasMeasurements() const override {return getNumMeasurements() > 0;}
+  bool hasReferenceState() const override {return (referenceState_.get() != nullptr);}
+  bool hasForwardPrediction() const override {return (forwardPrediction_.get()  != nullptr);}
+  bool hasBackwardPrediction() const override {return (backwardPrediction_.get() != nullptr);}
+  bool hasForwardUpdate() const override {return (forwardUpdate_.get() != nullptr);}
+  bool hasBackwardUpdate() const override {return (backwardUpdate_.get() != nullptr);}
+  bool hasUpdate(int direction) const override {if (direction < 0) return hasBackwardUpdate(); return hasForwardUpdate();}
   bool hasPredictionsAndUpdates() const {return (hasForwardPrediction() && hasBackwardPrediction() && hasForwardUpdate() && hasBackwardUpdate());}
 
   void setReferenceState(ReferenceStateOnPlane* referenceState);
@@ -100,40 +98,28 @@ class KalmanFitterInfo : public AbsFitterInfo {
   //! Set weights of measurements.
   void setWeights(const std::vector<double>&);
   void fixWeights(bool arg = true) {fixWeights_ = arg;}
-  void setRep(const AbsTrackRep* rep);
+  void setRep(const AbsTrackRep* rep) override;
 
-  void deleteForwardInfo();
-  void deleteBackwardInfo();
+  void deleteForwardInfo() override;
+  void deleteBackwardInfo() override;
   void deletePredictions();
-  void deleteReferenceInfo() {setReferenceState(NULL);}
-  void deleteMeasurementInfo();
+  void deleteReferenceInfo() override {setReferenceState(nullptr);}
+  void deleteMeasurementInfo() override;
 
-  virtual void Print(const Option_t* = "") const;
+  virtual void Print(const Option_t* = "") const override;
 
-  virtual bool checkConsistency(const genfit::PruneFlags* = NULL) const;
+  virtual bool checkConsistency(const genfit::PruneFlags* = nullptr) const override;
 
  private:
 
-
-#ifndef __CINT__
   //! Reference state. Used by KalmanFitterRefTrack.
-  boost::scoped_ptr<ReferenceStateOnPlane> referenceState_; // Ownership
-  boost::scoped_ptr<MeasuredStateOnPlane> forwardPrediction_; // Ownership
-  boost::scoped_ptr<KalmanFittedStateOnPlane> forwardUpdate_; // Ownership
-  boost::scoped_ptr<MeasuredStateOnPlane> backwardPrediction_; // Ownership
-  boost::scoped_ptr<KalmanFittedStateOnPlane> backwardUpdate_; // Ownership
-  mutable boost::scoped_ptr<MeasuredStateOnPlane> fittedStateUnbiased_; //!  cache
-  mutable boost::scoped_ptr<MeasuredStateOnPlane> fittedStateBiased_; //!  cache
-#else
-  class ReferenceStateOnPlane* referenceState_;
-  class MeasuredStateOnPlane* forwardPrediction_;
-  class KalmanFittedStateOnPlane* forwardUpdate_;
-  class MeasuredStateOnPlane* backwardPrediction_;
-  class KalmanFittedStateOnPlane* backwardUpdate_;
-  class MeasuredStateOnPlane* fittedStateUnbiased_; //!  cache
-  class MeasuredStateOnPlane* fittedStateBiased_; //!  cache
-#endif
-
+  std::unique_ptr<ReferenceStateOnPlane> referenceState_; // Ownership
+  std::unique_ptr<MeasuredStateOnPlane> forwardPrediction_; // Ownership
+  std::unique_ptr<KalmanFittedStateOnPlane> forwardUpdate_; // Ownership
+  std::unique_ptr<MeasuredStateOnPlane> backwardPrediction_; // Ownership
+  std::unique_ptr<KalmanFittedStateOnPlane> backwardUpdate_; // Ownership
+  mutable std::unique_ptr<MeasuredStateOnPlane> fittedStateUnbiased_; //!  cache
+  mutable std::unique_ptr<MeasuredStateOnPlane> fittedStateBiased_; //!  cache
 
  //> TODO ! ptr implement: to the special ownership version
   /* class owned_pointer_vector : private std::vector<MeasuredStateOnPlane*> {
@@ -153,7 +139,7 @@ class KalmanFitterInfo : public AbsFitterInfo {
 
  public:
 
-  ClassDef(KalmanFitterInfo,1)
+  ClassDefOverride(KalmanFitterInfo,1)
 
 };
 
diff --git a/fitters/include/KalmanFitterRefTrack.h b/fitters/include/KalmanFitterRefTrack.h
index fe932a0011ce5cbb4a7f88271aabadc390e24cf2..23804a344181909b42cf5d6d5d39332567762aed 100644
--- a/fitters/include/KalmanFitterRefTrack.h
+++ b/fitters/include/KalmanFitterRefTrack.h
@@ -50,7 +50,7 @@ class KalmanFitterRefTrack : public AbsKalmanFitter {
    */
   TrackPoint* fitTrack(Track* tr, const AbsTrackRep* rep, double& chi2, double& ndf, int direction);
 
-  void processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits = false);
+  void processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits = false) override;
 
   /** @brief Prepare the track
    *
@@ -109,7 +109,7 @@ class KalmanFitterRefTrack : public AbsKalmanFitter {
   bool squareRootFormalism_;
 
  public:
-  ClassDef(KalmanFitterRefTrack, 1)
+  ClassDefOverride(KalmanFitterRefTrack, 1)
 
 };
 
diff --git a/fitters/include/ReferenceStateOnPlane.h b/fitters/include/ReferenceStateOnPlane.h
index 433f31fbba18379c75336cbef6dba532338119c3..348591e99c730eba0f08b87af5f9a1fc1cde6c96 100644
--- a/fitters/include/ReferenceStateOnPlane.h
+++ b/fitters/include/ReferenceStateOnPlane.h
@@ -87,7 +87,7 @@ class ReferenceStateOnPlane : public StateOnPlane {
   void resetForward();
   void resetBackward();
 
-  virtual void Print(Option_t* option = "") const;
+  virtual void Print(Option_t* option = "") const override;
 
  protected:
 
@@ -103,7 +103,7 @@ class ReferenceStateOnPlane : public StateOnPlane {
 
  public:
 
-  ClassDef(ReferenceStateOnPlane,1)
+  ClassDefOverride(ReferenceStateOnPlane,1)
 
 };
 
diff --git a/fitters/src/AbsKalmanFitter.cc b/fitters/src/AbsKalmanFitter.cc
index dc9309189de005e15ba1b120416f3f8d007d3958..c5376dd88761f0610aefc2a5022cdf9ec35c9c44 100644
--- a/fitters/src/AbsKalmanFitter.cc
+++ b/fitters/src/AbsKalmanFitter.cc
@@ -61,8 +61,8 @@ void AbsKalmanFitter::getChiSquNdf(const Track* tr, const AbsTrackRep* rep,
     KalmanFittedStateOnPlane* fup = fi->getForwardUpdate();
     KalmanFittedStateOnPlane* bup = fi->getBackwardUpdate();
 
-    if (fup == NULL || bup == NULL) {
-      Exception exc("AbsKalmanFitter::getChiSqu(): fup == NULL || bup == NULL", __LINE__,__FILE__);
+    if (fup == nullptr || bup == nullptr) {
+      Exception exc("AbsKalmanFitter::getChiSqu(): fup == nullptr || bup == nullptr", __LINE__,__FILE__);
       throw exc;
     }
 
diff --git a/fitters/src/DAF.cc b/fitters/src/DAF.cc
index 514e13823ac42f4ed5c4e8d5002f2ca243244364..ffb56065a3ee00c65c592bf9a4632c186678aab5 100644
--- a/fitters/src/DAF.cc
+++ b/fitters/src/DAF.cc
@@ -64,7 +64,7 @@ DAF::DAF(AbsKalmanFitter* kalman, double deltaPval, double deltaWeight)
   kalman_->setMultipleMeasurementHandling(weightedAverage); // DAF makes no sense otherwise
   kalman_->setMaxIterations(1);
 
-  if (dynamic_cast<KalmanFitterRefTrack*>(kalman_.get()) != NULL) {
+  if (dynamic_cast<KalmanFitterRefTrack*>(kalman_.get()) != nullptr) {
     static_cast<KalmanFitterRefTrack*>(kalman_.get())->setRefitAll();
   }
 
@@ -131,7 +131,7 @@ void DAF::processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits
     try{
       converged = calcWeights(tr, rep, betas_.at(iBeta));
       if (!converged && iBeta >= minIterations_-1 &&
-          status->getBackwardPVal() != 0 && abs(lastPval - status->getBackwardPVal()) < this->deltaPval_) {
+          status->getBackwardPVal() != 0 && fabs(lastPval - status->getBackwardPVal()) < this->deltaPval_) {
         if (debugLvl_ > 0) {
           debugOut << "converged by Pval = " << status->getBackwardPVal() << " even though weights changed at iBeta = " << iBeta << std::endl;
         }
@@ -191,43 +191,6 @@ void DAF::addProbCut(const double prob_cut, const int measDim){
   chi2Cuts_[measDim] = ROOT::Math::chisquared_quantile_c( prob_cut, measDim);
 }
 
-
-void DAF::setBetas(double b1,double b2,double b3,double b4,double b5,double b6,double b7,double b8,double b9,double b10){
-  betas_.clear();
-  assert(b1>0);betas_.push_back(b1);
-  if(b2>0){
-    assert(b2<=b1);betas_.push_back(b2);
-    if(b3>=0.) {
-      assert(b3<=b2);betas_.push_back(b3);
-      if(b4>=0.) {
-        assert(b4<=b3);betas_.push_back(b4);
-        if(b5>=0.) {
-          assert(b5<=b4);betas_.push_back(b5);
-          if(b6>=0.) {
-            assert(b6<=b5);betas_.push_back(b6);
-            if(b7>=0.) {
-              assert(b7<=b6);betas_.push_back(b7);
-              if(b8>=0.) {
-                assert(b8<=b7);betas_.push_back(b8);
-                if(b9>=0.) {
-                  assert(b9<=b8);betas_.push_back(b9);
-                  if(b10>=0.) {
-                    assert(b10<=b9);betas_.push_back(b10);
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-  minIterations_ = betas_.size();
-  maxIterations_ = betas_.size() + 4;
-  betas_.resize(maxIterations_,betas_.back()); //make sure main loop has a maximum of maxIterations_ and also make sure the last beta value is used for if more iterations are needed then the ones set by the user.
-}
-
-
 void DAF::setAnnealingScheme(double bStart, double bFinal, unsigned int nSteps) {
   // The betas are calculated as a geometric series that takes nSteps
   // steps to go from bStart to bFinal.
@@ -267,7 +230,7 @@ bool DAF::calcWeights(Track* tr, const AbsTrackRep* rep, double beta) {
       continue;
     }
     AbsFitterInfo* fi = (*tp)->getFitterInfo(rep);
-    if (dynamic_cast<KalmanFitterInfo*>(fi) == NULL){
+    if (dynamic_cast<KalmanFitterInfo*>(fi) == nullptr){
       Exception exc("DAF::getWeights ==> can only use KalmanFitterInfos",__LINE__,__FILE__);
       throw exc;
     }
diff --git a/fitters/src/KalmanFitter.cc b/fitters/src/KalmanFitter.cc
index f9e910666d08869ea430a1571571244dea512385..335b67b66faa46bf9811d9462107fbe48dcb7f9c 100644
--- a/fitters/src/KalmanFitter.cc
+++ b/fitters/src/KalmanFitter.cc
@@ -112,7 +112,7 @@ bool KalmanFitter::fitTrack(Track* tr, const AbsTrackRep* rep,
 void KalmanFitter::processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool)
 {
 
-  if (tr->getFitStatus(rep) != NULL && tr->getFitStatus(rep)->isTrackPruned()) {
+  if (tr->hasFitStatus(rep) and tr->getFitStatus(rep)->isTrackPruned()) {
     Exception exc("KalmanFitter::processTrack: Cannot process pruned track!", __LINE__,__FILE__);
     throw exc;
   }
@@ -120,7 +120,7 @@ void KalmanFitter::processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool)
   TrackPoint* trackPoint = tr->getPointWithMeasurement(0);
 
   if (trackPoint->hasFitterInfo(rep) &&
-      dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(rep)) != NULL &&
+      dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(rep)) != nullptr &&
       static_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(rep))->hasUpdate(-1)) {
     MeasuredStateOnPlane* update = static_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(rep))->getUpdate(-1);
     currentState_.reset(new MeasuredStateOnPlane(*update));
@@ -129,7 +129,7 @@ void KalmanFitter::processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool)
   }
   if (rep != tr->getCardinalRep() &&
       trackPoint->hasFitterInfo(tr->getCardinalRep()) &&
-      dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep())) != NULL &&
+      dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep())) != nullptr &&
       static_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep()))->hasPredictionsAndUpdates() ) {
     if (debugLvl_ > 0)
       debugOut << "take smoothed state of cardinal rep fit as seed \n";
@@ -286,7 +286,7 @@ void KalmanFitter::processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool)
   status->setIsFitted();
   double charge(0);
   TrackPoint* tp = tr->getPointWithMeasurementAndFitterInfo(0, rep);
-  if (tp != NULL) {
+  if (tp != nullptr) {
     if (static_cast<KalmanFitterInfo*>(tp->getFitterInfo(rep))->hasBackwardUpdate())
       charge = static_cast<KalmanFitterInfo*>(tp->getFitterInfo(rep))->getBackwardUpdate()->getCharge();
   }
@@ -303,7 +303,7 @@ void KalmanFitter::processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool)
 void
 KalmanFitter::processTrackPartially(Track* tr, const AbsTrackRep* rep, int startId, int endId) {
 
-  if (tr->getFitStatus(rep) != NULL && tr->getFitStatus(rep)->isTrackPruned()) {
+  if (tr->getFitStatus(rep) != nullptr && tr->getFitStatus(rep)->isTrackPruned()) {
     Exception exc("KalmanFitter::processTrack: Cannot process pruned track!", __LINE__,__FILE__);
     throw exc;
   }
@@ -319,7 +319,7 @@ KalmanFitter::processTrackPartially(Track* tr, const AbsTrackRep* rep, int start
 
 
   TrackPoint* trackPoint = tr->getPointWithMeasurement(startId);
-  TrackPoint* prevTrackPoint(NULL);
+  TrackPoint* prevTrackPoint(nullptr);
 
 
   if (direction == 1 && startId > 0)
@@ -328,9 +328,9 @@ KalmanFitter::processTrackPartially(Track* tr, const AbsTrackRep* rep, int start
     prevTrackPoint = tr->getPointWithMeasurement(startId + 1);
 
 
-  if (prevTrackPoint != NULL &&
+  if (prevTrackPoint != nullptr &&
       prevTrackPoint->hasFitterInfo(rep) &&
-      dynamic_cast<KalmanFitterInfo*>(prevTrackPoint->getFitterInfo(rep)) != NULL &&
+      dynamic_cast<KalmanFitterInfo*>(prevTrackPoint->getFitterInfo(rep)) != nullptr &&
       static_cast<KalmanFitterInfo*>(prevTrackPoint->getFitterInfo(rep))->hasUpdate(direction)) {
     currentState_.reset(new MeasuredStateOnPlane(*(static_cast<KalmanFitterInfo*>(prevTrackPoint->getFitterInfo(rep))->getUpdate(direction))));
     if (debugLvl_ > 0)
@@ -338,7 +338,7 @@ KalmanFitter::processTrackPartially(Track* tr, const AbsTrackRep* rep, int start
   }
   else if (rep != tr->getCardinalRep() &&
       trackPoint->hasFitterInfo(tr->getCardinalRep()) &&
-      dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep())) != NULL &&
+      dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep())) != nullptr &&
       static_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep()))->hasPredictionsAndUpdates() ) {
     if (debugLvl_ > 0)
       debugOut << "take smoothed state of cardinal rep fit as seed \n";
diff --git a/fitters/src/KalmanFitterInfo.cc b/fitters/src/KalmanFitterInfo.cc
index 7bcaa49ab79047cb4ec6a56d0049f8d78011623b..4f0b13db14acfe0cc69779bec8ab6ec93266043c 100644
--- a/fitters/src/KalmanFitterInfo.cc
+++ b/fitters/src/KalmanFitterInfo.cc
@@ -138,7 +138,7 @@ MeasurementOnPlane KalmanFitterInfo::getAvgWeightedMeasurementOnPlane(bool ignor
 
 MeasurementOnPlane* KalmanFitterInfo::getClosestMeasurementOnPlane(const StateOnPlane* sop) const {
   if(measurementsOnPlane_.size() == 0)
-    return NULL;
+    return nullptr;
 
   if(measurementsOnPlane_.size() == 1)
     return getMeasurementOnPlane(0);
@@ -347,7 +347,7 @@ MeasurementOnPlane KalmanFitterInfo::getResidual(unsigned int iMeasurement, bool
 }
 
 
-double KalmanFitterInfo::getSmoothedChi2(unsigned int iMeasurement) {
+double KalmanFitterInfo::getSmoothedChi2(unsigned int iMeasurement) const {
   const MeasurementOnPlane& res = getResidual(iMeasurement, true, false);
 
   TMatrixDSym Rinv;
@@ -478,22 +478,22 @@ void KalmanFitterInfo::setWeights(const std::vector<double>& weights) {
 
 
 void KalmanFitterInfo::deleteForwardInfo() {
-  setForwardPrediction(NULL);
-  setForwardUpdate(NULL);
+  setForwardPrediction(nullptr);
+  setForwardUpdate(nullptr);
   fittedStateUnbiased_.reset();
   fittedStateBiased_.reset();
 }
 
 void KalmanFitterInfo::deleteBackwardInfo() {
-  setBackwardPrediction(NULL);
-  setBackwardUpdate(NULL);
+  setBackwardPrediction(nullptr);
+  setBackwardUpdate(nullptr);
   fittedStateUnbiased_.reset();
   fittedStateBiased_.reset();
 }
 
 void KalmanFitterInfo::deletePredictions() {
-  setForwardPrediction(NULL);
-  setBackwardPrediction(NULL);
+  setForwardPrediction(nullptr);
+  setBackwardPrediction(nullptr);
   fittedStateUnbiased_.reset();
   fittedStateBiased_.reset();
 }
@@ -542,22 +542,22 @@ bool KalmanFitterInfo::checkConsistency(const genfit::PruneFlags* flags) const {
 
   // check if in a TrackPoint
   if (!trackPoint_) {
-    errorOut << "KalmanFitterInfo::checkConsistency(): trackPoint_ is NULL" << std::endl;
+    errorOut << "KalmanFitterInfo::checkConsistency(): trackPoint_ is nullptr" << std::endl;
     retVal = false;
   }
 
   // check if there is a reference state
   /*if (!referenceState_) {
-    errorOut << "KalmanFitterInfo::checkConsistency(): referenceState_ is NULL" << std::endl;
+    errorOut << "KalmanFitterInfo::checkConsistency(): referenceState_ is nullptr" << std::endl;
     retVal = false;
   }*/
 
   SharedPlanePtr plane = getPlane();
 
-  if (plane.get() == NULL) {
+  if (plane.get() == nullptr) {
     if (!(referenceState_ || forwardPrediction_ || forwardUpdate_ || backwardPrediction_ || backwardUpdate_ || measurementsOnPlane_.size() > 0))
       return true;
-    errorOut << "KalmanFitterInfo::checkConsistency(): plane is NULL" << std::endl;
+    errorOut << "KalmanFitterInfo::checkConsistency(): plane is nullptr" << std::endl;
     retVal = false;
   }
 
@@ -669,7 +669,7 @@ bool KalmanFitterInfo::checkConsistency(const genfit::PruneFlags* flags) const {
     }
   }
 
-  if (flags == NULL or !flags->hasFlags("U")) { // if predictions have not been pruned
+  if (flags == nullptr or !flags->hasFlags("U")) { // if predictions have not been pruned
     // see if there is an update w/o prediction or measurement
     if (forwardUpdate_ && !forwardPrediction_) {
       errorOut << "KalmanFitterInfo::checkConsistency(): forwardUpdate_ w/o forwardPrediction_" << std::endl;
@@ -682,7 +682,7 @@ bool KalmanFitterInfo::checkConsistency(const genfit::PruneFlags* flags) const {
       retVal = false;
     }
 
-    if (flags == NULL or !flags->hasFlags("M")) {
+    if (flags == nullptr or !flags->hasFlags("M")) {
       if (forwardUpdate_ && measurementsOnPlane_.size() == 0) {
         errorOut << "KalmanFitterInfo::checkConsistency(): forwardUpdate_ w/o measurement" << std::endl;
         retVal = false;
diff --git a/fitters/src/KalmanFitterRefTrack.cc b/fitters/src/KalmanFitterRefTrack.cc
index 32a286048e9504a583257f890ce3894bbb67e0fd..af7202ebd5a9c6ea0ba635f994a73f5155720b0d 100644
--- a/fitters/src/KalmanFitterRefTrack.cc
+++ b/fitters/src/KalmanFitterRefTrack.cc
@@ -29,8 +29,6 @@
 #include "KalmanFitterInfo.h"
 #include "KalmanFitStatus.h"
 
-#include "boost/scoped_ptr.hpp"
-
 #include <TDecompChol.h>
 #include <Math/ProbFunc.h>
 
@@ -50,9 +48,9 @@ TrackPoint* KalmanFitterRefTrack::fitTrack(Track* tr, const AbsTrackRep* rep, do
 
   chi2 = 0;
   ndf = -1. * dim;
-  KalmanFitterInfo* prevFi(NULL);
+  KalmanFitterInfo* prevFi(nullptr);
 
-  TrackPoint* retVal(NULL);
+  TrackPoint* retVal(nullptr);
 
   if (debugLvl_ > 0) {
     debugOut << tr->getNumPoints() << " TrackPoints with measurements in this track." << std::endl;
@@ -107,8 +105,7 @@ TrackPoint* KalmanFitterRefTrack::fitTrack(Track* tr, const AbsTrackRep* rep, do
 
 void KalmanFitterRefTrack::processTrackWithRep(Track* tr, const AbsTrackRep* rep, bool resortHits)
 {
-
-  if (tr->getFitStatus(rep) != NULL && tr->getFitStatus(rep)->isTrackPruned()) {
+  if (tr->hasFitStatus(rep) && tr->getFitStatus(rep)->isTrackPruned()) {
     Exception exc("KalmanFitterRefTrack::processTrack: Cannot process pruned track!", __LINE__,__FILE__);
     throw exc;
   }
@@ -198,7 +195,7 @@ void KalmanFitterRefTrack::processTrackWithRep(Track* tr, const AbsTrackRep* rep
       }
 
       // backward fit must not necessarily start at last hit, set prediction = forward update and blow up cov
-      if (lastProcessedPoint != NULL) {
+      if (lastProcessedPoint != nullptr) {
         KalmanFitterInfo* lastInfo = static_cast<KalmanFitterInfo*>(lastProcessedPoint->getFitterInfo(rep));
         if (! lastInfo->hasBackwardPrediction()) {
           lastInfo->setBackwardPrediction(new MeasuredStateOnPlane(*(lastInfo->getForwardUpdate())));
@@ -299,13 +296,13 @@ void KalmanFitterRefTrack::processTrackWithRep(Track* tr, const AbsTrackRep* rep
   TrackPoint* tp = tr->getPointWithMeasurementAndFitterInfo(0, rep);
 
   double charge(0);
-  if (tp != NULL) {
+  if (tp != nullptr) {
     if (static_cast<KalmanFitterInfo*>(tp->getFitterInfo(rep))->hasBackwardUpdate())
       charge = static_cast<KalmanFitterInfo*>(tp->getFitterInfo(rep))->getBackwardUpdate()->getCharge();
   }
   status->setCharge(charge);
 
-  if (tp != NULL) {
+  if (tp != nullptr) {
     status->setIsFitted();
   }
   else { // none of the trackPoints has a fitterInfo
@@ -352,14 +349,14 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
   backwardDeltaState_.ResizeTo(rep->getDim());
 
   // declare stuff
-  KalmanFitterInfo* prevFitterInfo(NULL);
-  boost::scoped_ptr<MeasuredStateOnPlane> firstBackwardUpdate;
+  KalmanFitterInfo* prevFitterInfo(nullptr);
+  std::unique_ptr<MeasuredStateOnPlane> firstBackwardUpdate;
 
-  ReferenceStateOnPlane* referenceState(NULL);
-  ReferenceStateOnPlane* prevReferenceState(NULL);
+  ReferenceStateOnPlane* referenceState(nullptr);
+  ReferenceStateOnPlane* prevReferenceState(nullptr);
 
-  const MeasuredStateOnPlane* smoothedState(NULL);
-  const MeasuredStateOnPlane* prevSmoothedState(NULL);
+  const MeasuredStateOnPlane* smoothedState(nullptr);
+  const MeasuredStateOnPlane* prevSmoothedState(nullptr);
 
   double trackLen(0);
 
@@ -396,12 +393,12 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
 
 
       // get fitterInfo
-      KalmanFitterInfo* fitterInfo(NULL);
+      KalmanFitterInfo* fitterInfo(nullptr);
       if (trackPoint->hasFitterInfo(rep))
         fitterInfo = dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(rep));
 
       // create new fitter info if none available
-      if (fitterInfo == NULL) {
+      if (fitterInfo == nullptr) {
         if (debugLvl_ > 0) {
           debugOut << "create new KalmanFitterInfo \n";
         }
@@ -414,7 +411,7 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
           debugOut << "TrackPoint " << i << " (" << trackPoint << ") already has KalmanFitterInfo \n";
         }
 
-        if (prevFitterInfo == NULL) {
+        if (prevFitterInfo == nullptr) {
           if (fitterInfo->hasBackwardUpdate())
             firstBackwardUpdate.reset(new MeasuredStateOnPlane(*(fitterInfo->getBackwardUpdate())));
         }
@@ -429,7 +426,7 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
         }
       }
       else {
-        smoothedState = NULL;
+        smoothedState = nullptr;
       }
 
 
@@ -455,9 +452,9 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
         }
 
 
-        if (prevReferenceState == NULL) {
+        if (prevReferenceState == nullptr) {
           if (debugLvl_ > 0) {
-            debugOut << "TrackPoint already has referenceState but previous referenceState is NULL -> reset forward info of current reference state and continue \n";
+            debugOut << "TrackPoint already has referenceState but previous referenceState is nullptr -> reset forward info of current reference state and continue \n";
           }
 
           referenceState->resetForward();
@@ -528,19 +525,19 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
 
       // Construct plane
       SharedPlanePtr plane;
-      if (smoothedState != NULL) {
+      if (smoothedState != nullptr) {
         if (debugLvl_ > 0)
           debugOut << "construct plane with smoothedState \n";
         plane = trackPoint->getRawMeasurement(0)->constructPlane(*smoothedState);
       }
-      else if (prevSmoothedState != NULL) {
+      else if (prevSmoothedState != nullptr) {
         if (debugLvl_ > 0) {
           debugOut << "construct plane with prevSmoothedState \n";
           //prevSmoothedState->Print();
         }
         plane = trackPoint->getRawMeasurement(0)->constructPlane(*prevSmoothedState);
       }
-      else if (prevReferenceState != NULL) {
+      else if (prevReferenceState != nullptr) {
         if (debugLvl_ > 0) {
           debugOut << "construct plane with prevReferenceState \n";
         }
@@ -548,7 +545,7 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
       }
       else if (rep != tr->getCardinalRep() &&
                 trackPoint->hasFitterInfo(tr->getCardinalRep()) &&
-                dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep())) != NULL &&
+                dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep())) != nullptr &&
                 static_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep()))->hasPredictionsAndUpdates() ) {
         if (debugLvl_ > 0) {
           debugOut << "construct plane with smoothed state of cardinal rep fit \n";
@@ -570,8 +567,8 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
         plane = trackPoint->getRawMeasurement(0)->constructPlane(seedFromTrack);
       }
 
-      if (plane.get() == NULL) {
-        Exception exc("KalmanFitterRefTrack::prepareTrack ==> construced plane is NULL!",__LINE__,__FILE__);
+      if (plane.get() == nullptr) {
+        Exception exc("KalmanFitterRefTrack::prepareTrack ==> construced plane is nullptr!",__LINE__,__FILE__);
         exc.setFatal();
         throw exc;
       }
@@ -579,18 +576,18 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
 
 
       // do extrapolation and set reference state infos
-      boost::scoped_ptr<StateOnPlane> stateToExtrapolate(NULL);
-      if (prevFitterInfo == NULL) { // first measurement
+      std::unique_ptr<StateOnPlane> stateToExtrapolate(nullptr);
+      if (prevFitterInfo == nullptr) { // first measurement
         if (debugLvl_ > 0) {
-          debugOut << "prevFitterInfo == NULL \n";
+          debugOut << "prevFitterInfo == nullptr \n";
         }
-        if (smoothedState != NULL) {
+        if (smoothedState != nullptr) {
           if (debugLvl_ > 0) {
             debugOut << "extrapolate smoothedState to plane\n";
           }
           stateToExtrapolate.reset(new StateOnPlane(*smoothedState));
         }
-        else if (referenceState != NULL) {
+        else if (referenceState != nullptr) {
           if (debugLvl_ > 0) {
             debugOut << "extrapolate referenceState to plane\n";
           }
@@ -598,7 +595,7 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
         }
         else if (rep != tr->getCardinalRep() &&
                   trackPoint->hasFitterInfo(tr->getCardinalRep()) &&
-                  dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep())) != NULL &&
+                  dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep())) != nullptr &&
                   static_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep()))->hasPredictionsAndUpdates() ) {
           if (debugLvl_ > 0) {
             debugOut << "extrapolate smoothed state of cardinal rep fit to plane\n";
@@ -606,6 +603,7 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
           TVector3 pos, mom;
           const MeasuredStateOnPlane& fittedState = static_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(tr->getCardinalRep()))->getFittedState(true);
           stateToExtrapolate.reset(new StateOnPlane(fittedState));
+          stateToExtrapolate->setRep(rep);
         }
         else {
           if (debugLvl_ > 0) {
@@ -613,18 +611,18 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
           }
           stateToExtrapolate.reset(new StateOnPlane(rep));
           rep->setPosMom(*stateToExtrapolate, tr->getStateSeed());
-	  rep->setTime(*stateToExtrapolate, tr->getTimeSeed());
+      	  rep->setTime(*stateToExtrapolate, tr->getTimeSeed());
         }
-      } // end if (prevFitterInfo == NULL)
+      } // end if (prevFitterInfo == nullptr)
       else {
-        if (prevSmoothedState != NULL) {
+        if (prevSmoothedState != nullptr) {
           if (debugLvl_ > 0) {
             debugOut << "extrapolate prevSmoothedState to plane \n";
           }
           stateToExtrapolate.reset(new StateOnPlane(*prevSmoothedState));
         }
         else {
-          assert (prevReferenceState != NULL);
+          assert (prevReferenceState != nullptr);
           if (debugLvl_ > 0) {
             debugOut << "extrapolate prevReferenceState to plane \n";
           }
@@ -633,11 +631,11 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
       }
 
       // make sure track is consistent if extrapolation fails
-      if (prevReferenceState != NULL)
+      if (prevReferenceState != nullptr)
         prevReferenceState->resetBackward();
       fitterInfo->deleteReferenceInfo();
 
-      if (prevFitterInfo != NULL) {
+      if (prevFitterInfo != nullptr) {
         rep->extrapolateToPlane(*stateToExtrapolate, prevFitterInfo->getPlane());
         if (debugLvl_ > 0) {
           debugOut << "extrapolated stateToExtrapolate to plane of prevFitterInfo (plane could have changed!) \n";
@@ -677,7 +675,7 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
 
 
       // set backward matrices for previous reference state
-      if (prevReferenceState != NULL) {
+      if (prevReferenceState != nullptr) {
         prevReferenceState->setBackwardSegmentLength(-segmentLen);
         prevReferenceState->setBackwardTransportMatrix(BTransportMatrix_);
         prevReferenceState->setBackwardNoiseMatrix(BNoiseMatrix_);
@@ -708,7 +706,7 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
       fitterInfo->deleteMeasurementInfo();
       const std::vector<AbsMeasurement*>& rawMeasurements = trackPoint->getRawMeasurements();
       for ( std::vector< genfit::AbsMeasurement* >::const_iterator measurement = rawMeasurements.begin(), lastMeasurement = rawMeasurements.end(); measurement != lastMeasurement; ++measurement) {
-        assert((*measurement) != NULL);
+        assert((*measurement) != nullptr);
         fitterInfo->addMeasurementsOnPlane((*measurement)->constructMeasurementsOnPlane(*referenceState));
       }
       if (oldWeights.size() == fitterInfo->getNumMeasurements()) {
@@ -735,8 +733,8 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
       ++nFailedHits;
       if (maxFailedHits_<0 || nFailedHits <= maxFailedHits_) {
         prevNewRefState = true;
-        referenceState = NULL;
-        smoothedState = NULL;
+        referenceState = nullptr;
+        smoothedState = nullptr;
         tr->getPoint(i)->deleteFitterInfo(rep);
 
         if (setSortingParams)
@@ -788,7 +786,7 @@ bool KalmanFitterRefTrack::prepareTrack(Track* tr, const AbsTrackRep* rep, bool
   }
 
   KalmanFitStatus* fitStatus = dynamic_cast<KalmanFitStatus*>(tr->getFitStatus(rep));
-  if (fitStatus != NULL)
+  if (fitStatus != nullptr)
     fitStatus->setTrackLen(trackLen);
 
   if (debugLvl_ > 0) {
@@ -830,11 +828,11 @@ KalmanFitterRefTrack::removeOutdated(Track* tr, const AbsTrackRep* rep, int& not
     }
 
     // get fitterInfo
-    KalmanFitterInfo* fitterInfo(NULL);
+    KalmanFitterInfo* fitterInfo(nullptr);
     if (trackPoint->hasFitterInfo(rep))
       fitterInfo = dynamic_cast<KalmanFitterInfo*>(trackPoint->getFitterInfo(rep));
 
-    if (fitterInfo == NULL)
+    if (fitterInfo == nullptr)
       continue;
 
 
@@ -936,7 +934,7 @@ KalmanFitterRefTrack::processTrackPoint(KalmanFitterInfo* fi, const KalmanFitter
   C_.Zero(); // C_{k|k-1}
 
   // predict
-  if (prevFi != NULL) {
+  if (prevFi != nullptr) {
     const TMatrixD& F = fi->getReferenceState()->getTransportMatrix(direction); // Transport matrix
     assert(F.GetNcols() == (int)dim);
     const TMatrixDSym& N = fi->getReferenceState()->getNoiseMatrix(direction); // Noise matrix
@@ -1061,7 +1059,7 @@ KalmanFitterRefTrack::processTrackPoint(KalmanFitterInfo* fi, const KalmanFitter
       res_.Print();
     }
 
-    // only calculate chi2inc if res != NULL.
+    // only calculate chi2inc if res != nullptr.
     // If matrix inversion fails, chi2inc = 0
     if (res_ != 0) {
       Rinv_.ResizeTo(C_);
@@ -1116,7 +1114,9 @@ KalmanFitterRefTrack::processTrackPoint(KalmanFitterInfo* fi, const KalmanFitter
   }
 
   // check
-  assert(fi->checkConsistency());
+  if (not fi->checkConsistency()) {
+    throw genfit::Exception("Consistency check failed ", __LINE__, __FILE__);
+  }
 
 }
 
@@ -1139,7 +1139,7 @@ KalmanFitterRefTrack::processTrackPointSqrt(KalmanFitterInfo* fi, const KalmanFi
   TMatrixD S(dim, dim); // sqrt(C_);
 
   // predict
-  if (prevFi != NULL) {
+  if (prevFi != nullptr) {
     const TMatrixD& F = fi->getReferenceState()->getTransportMatrix(direction); // Transport matrix
     assert(F.GetNcols() == (int)dim);
     const TMatrixDSym& N = fi->getReferenceState()->getNoiseMatrix(direction); // Noise matrix
@@ -1324,6 +1324,8 @@ KalmanFitterRefTrack::processTrackPointSqrt(KalmanFitterInfo* fi, const KalmanFi
   }
 
   // check
-  assert(fi->checkConsistency());
+  if (not fi->checkConsistency()) {
+    throw genfit::Exception("Consistency check failed ", __LINE__, __FILE__);
+  }
 
 }
diff --git a/fitters/src/fittersLinkDef.h b/fitters/src/fittersLinkDef.h
index 7171c4ce51c57b11225b2030280d0538895f443f..9218e8a86000ca100a38994059deacaafeacc466 100644
--- a/fitters/src/fittersLinkDef.h
+++ b/fitters/src/fittersLinkDef.h
@@ -1,15 +1,11 @@
-#ifdef __CINT__
-
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
 
-#ifdef __CLING__
 #pragma link C++ nestedclass;
 #pragma link C++ nestedtypedef;
 
 #pragma link C++ namespace genfit;
-#endif
 
 // these need no special tratment
 #pragma link C++ class genfit::AbsKalmanFitter+;
@@ -24,5 +20,3 @@
 #pragma link C++ class genfit::KalmanFitter-;
 #pragma link C++ class genfit::KalmanFitterInfo-;
 #pragma link C++ class genfit::DAF-;
-
-#endif
diff --git a/gtest/TestConstField.cpp b/gtest/TestConstField.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..600dfb5df222cbd538ba04e932d84c875fadad27
--- /dev/null
+++ b/gtest/TestConstField.cpp
@@ -0,0 +1,44 @@
+#include <gtest/gtest.h>
+
+#include <TVector3.h>
+
+#include <Exception.h>
+#include <ConstField.h>
+#include <FieldManager.h>
+
+namespace genfit {
+
+    class ConstFieldUninitializedTests : public ::testing::Test {
+    protected:
+    };
+
+    TEST_F (ConstFieldUninitializedTests, UninitializedBehaviour) {
+        EXPECT_EQ(false, genfit::FieldManager::getInstance()->isInitialized());
+        EXPECT_THROW(genfit::FieldManager::getInstance()->getField(), std::runtime_error);
+        EXPECT_THROW(genfit::FieldManager::getInstance()->checkInitialized(), std::runtime_error);
+        EXPECT_THROW(genfit::FieldManager::getInstance()->getFieldVal(TVector3(1, 1, 1)), std::runtime_error);
+    }
+
+
+    class ConstFieldInitializedTests : public ::testing::Test {
+    protected:
+        virtual void SetUp() {
+            const double bFieldZ = 20;  // kGauss. Is 1.5T
+            m_constField = new genfit::ConstField(0., 0., bFieldZ);
+            genfit::FieldManager::getInstance()->init(m_constField);
+        }
+        virtual void TearDown() {
+            genfit::FieldManager::getInstance()->destruct();
+
+        }
+        genfit::ConstField* m_constField;
+    };
+
+    TEST_F (ConstFieldInitializedTests, InitializedBehaviour) {
+        EXPECT_EQ(true, genfit::FieldManager::getInstance()->isInitialized());
+        EXPECT_NO_THROW(genfit::FieldManager::getInstance()->checkInstanciated());
+        EXPECT_NO_THROW(genfit::FieldManager::getInstance()->checkInitialized());
+        EXPECT_EQ(TVector3(0, 0, 20), genfit::FieldManager::getInstance()->getFieldVal(TVector3(1, 1, 1)));
+    }
+
+}
\ No newline at end of file
diff --git a/gtest/TestMaterial.cpp b/gtest/TestMaterial.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5b9c67e1ceda94806e90af91f4d76a67ae3b8d3a
--- /dev/null
+++ b/gtest/TestMaterial.cpp
@@ -0,0 +1,43 @@
+#include <gtest/gtest.h>
+
+#include <Material.h>
+
+namespace genfit {
+
+    class MaterialTests : public ::testing::Test {
+    protected:
+    };
+
+    TEST_F (MaterialTests, Constructor01) {
+        Material myMaterial;
+        EXPECT_FLOAT_EQ(0, myMaterial.density);
+        EXPECT_FLOAT_EQ(0, myMaterial.Z);
+        EXPECT_FLOAT_EQ(0, myMaterial.A);
+        EXPECT_FLOAT_EQ(0, myMaterial.radiationLength);
+        EXPECT_FLOAT_EQ(0, myMaterial.mEE);
+    }
+
+    TEST_F (MaterialTests, Constructor02) {
+        Material myMaterial(1, 2, 3, 4, 5);
+        EXPECT_FLOAT_EQ(1, myMaterial.density);
+        EXPECT_FLOAT_EQ(2, myMaterial.Z);
+        EXPECT_FLOAT_EQ(3, myMaterial.A);
+        EXPECT_FLOAT_EQ(4, myMaterial.radiationLength);
+        EXPECT_FLOAT_EQ(5, myMaterial.mEE);
+    }
+
+    TEST_F (MaterialTests, ComparisonOperators) {
+        Material myMaterial01(0, 0, 0, 0, 0);
+        Material myMaterial02(1, 2, 3, 4, 5);
+        Material myMaterial03(1, 2, 3, 4, 5);
+
+        EXPECT_FALSE(myMaterial01 == myMaterial02);
+        EXPECT_TRUE(myMaterial02 == myMaterial02);
+        EXPECT_TRUE(myMaterial02 == myMaterial03);
+
+        EXPECT_TRUE(myMaterial01 != myMaterial02);
+        EXPECT_FALSE(myMaterial02 != myMaterial02);
+        EXPECT_FALSE(myMaterial02 != myMaterial03);
+    }
+
+}
diff --git a/gtest/TestMaterialEffects.cpp b/gtest/TestMaterialEffects.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5e1fa5a3a221c1bdf32f972de41eb146ac5fcc62
--- /dev/null
+++ b/gtest/TestMaterialEffects.cpp
@@ -0,0 +1,22 @@
+#include <gtest/gtest.h>
+
+#include <AbsMaterialInterface.h>
+#include <MaterialEffects.h>
+
+namespace genfit {
+
+    class MaterialEffectsTests : public ::testing::Test {
+    protected:
+        virtual void SetUp() {
+            genfit::MaterialEffects::getInstance()->init(nullptr);
+        }
+
+        virtual void TearDown() {
+            genfit::MaterialEffects::getInstance()->destruct();
+        }
+    };
+
+
+    // TODO: Write a ConstMaterialInterface similiar to the ConstMagneticField for testing purposes.
+    // TODO: We can easily check the formulas then! Yeah...
+}
\ No newline at end of file
diff --git a/gtest/TestRKMatrixEigenTransformations.cpp b/gtest/TestRKMatrixEigenTransformations.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3c8eee69cdf02d24b452892b1398081f88b9c7ad
--- /dev/null
+++ b/gtest/TestRKMatrixEigenTransformations.cpp
@@ -0,0 +1,54 @@
+#include <gtest/gtest.h>
+
+#include <RKTools.h>
+#include <EigenMatrixTypedefs.h>
+#include <RKMatrixEigenTransformations.h>
+
+namespace genfit {
+
+    class RKMatrixEigenTransformations : public::testing::Test {
+        protected:
+    };
+
+    TEST_F(RKMatrixEigenTransformations, VectorTransformation)
+    {
+        RKMatrix<1, 4> myVector4 = {{ 1, 2, 3, 4 }};
+
+        auto myEigenMatrix(RKMatrixToEigenMatrix<1, 4>(myVector4));
+        EXPECT_EQ(myVector4[0], myEigenMatrix[0]);
+        EXPECT_EQ(myVector4[1], myEigenMatrix[1]);
+        EXPECT_EQ(myVector4[2], myEigenMatrix[2]);
+        EXPECT_EQ(myVector4[3], myEigenMatrix[3]);
+
+        auto myRKMatrix(eigenMatrixToRKMatrix<1, 4>(myEigenMatrix));
+        EXPECT_EQ(myVector4[0], myRKMatrix[0]);
+        EXPECT_EQ(myVector4[1], myRKMatrix[1]);
+        EXPECT_EQ(myVector4[2], myRKMatrix[2]);
+        EXPECT_EQ(myVector4[3], myRKMatrix[3]);
+    }
+
+    TEST_F(RKMatrixEigenTransformations, MatrixTransformation)
+    {
+        RKMatrix<2, 3> myMatrix2x3 = {
+                1, 2, 3,
+                4, 5, 6,
+        };
+
+        auto myEigenMatrix(RKMatrixToEigenMatrix<2, 3>(myMatrix2x3));
+        EXPECT_EQ(myMatrix2x3(0, 0), myEigenMatrix(0, 0));
+        EXPECT_EQ(myMatrix2x3(0, 1), myEigenMatrix(0, 1));
+        EXPECT_EQ(myMatrix2x3(0, 2), myEigenMatrix(0, 2));
+        EXPECT_EQ(myMatrix2x3(1, 0), myEigenMatrix(1, 0));
+        EXPECT_EQ(myMatrix2x3(1, 1), myEigenMatrix(1, 1));
+        EXPECT_EQ(myMatrix2x3(1, 2), myEigenMatrix(1, 2));
+
+        auto myRKMatrix(eigenMatrixToRKMatrix<2, 3>(myEigenMatrix));
+        EXPECT_EQ(myMatrix2x3(0, 0), myRKMatrix(0, 0));
+        EXPECT_EQ(myMatrix2x3(0, 1), myRKMatrix(0, 1));
+        EXPECT_EQ(myMatrix2x3(0, 2), myRKMatrix(0, 2));
+        EXPECT_EQ(myMatrix2x3(1, 0), myRKMatrix(1, 0));
+        EXPECT_EQ(myMatrix2x3(1, 1), myRKMatrix(1, 1));
+        EXPECT_EQ(myMatrix2x3(1, 2), myRKMatrix(1, 2));
+    }
+
+}
\ No newline at end of file
diff --git a/gtest/TestRKTrackRep.cpp b/gtest/TestRKTrackRep.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a8d387cc8dccd257ced51bf9799c88bfa0201026
--- /dev/null
+++ b/gtest/TestRKTrackRep.cpp
@@ -0,0 +1,355 @@
+#include <gtest/gtest.h>
+
+#include <TVector3.h>
+
+#include <Exception.h>
+#include <RKTrackRep.h>
+#include <ConstField.h>
+#include <FieldManager.h>
+#include <StateOnPlane.h>
+#include <SharedPlanePtr.h>
+#include <MeasurementOnPlane.h>
+
+
+namespace genfit {
+
+    class RKTrackRepTests : public ::testing::Test {
+
+    protected:
+        virtual void SetUp() {
+            const double bFieldZ = 20;  // kGauss. Is 1.5T
+            m_constField = new genfit::ConstField(0., 0., bFieldZ);
+            genfit::FieldManager::getInstance()->init(m_constField);
+        }
+        virtual void TearDown() {
+            genfit::FieldManager::getInstance()->destruct();
+        }
+        genfit::ConstField* m_constField;
+    };
+
+    TEST_F (RKTrackRepTests, RKStep) {
+        genfit::RKStep myRKStep;
+
+        EXPECT_EQ(0, myRKStep.state7_[0]);
+        EXPECT_EQ(0, myRKStep.state7_[1]);
+        EXPECT_EQ(0, myRKStep.state7_[2]);
+        EXPECT_EQ(0, myRKStep.state7_[3]);
+        EXPECT_EQ(0, myRKStep.state7_[4]);
+        EXPECT_EQ(0, myRKStep.state7_[5]);
+        EXPECT_EQ(0, myRKStep.state7_[6]);
+    }
+
+    TEST_F (RKTrackRepTests, ExtrapStep) {
+        genfit::ExtrapStep myExtrapStep;
+
+        EXPECT_EQ(0, myExtrapStep.jac7_(0, 0));
+        EXPECT_EQ(0, myExtrapStep.jac7_(0, 1));
+        EXPECT_EQ(0, myExtrapStep.jac7_(0, 2));
+        EXPECT_EQ(0, myExtrapStep.jac7_(0, 3));
+        EXPECT_EQ(0, myExtrapStep.jac7_(0, 4));
+        EXPECT_EQ(0, myExtrapStep.jac7_(0, 5));
+        EXPECT_EQ(0, myExtrapStep.jac7_(0, 6));
+
+        EXPECT_EQ(0, myExtrapStep.jac7_(1, 0));
+        EXPECT_EQ(0, myExtrapStep.jac7_(1, 1));
+        EXPECT_EQ(0, myExtrapStep.jac7_(1, 2));
+        EXPECT_EQ(0, myExtrapStep.jac7_(1, 3));
+        EXPECT_EQ(0, myExtrapStep.jac7_(1, 4));
+        EXPECT_EQ(0, myExtrapStep.jac7_(1, 5));
+        EXPECT_EQ(0, myExtrapStep.jac7_(1, 6));
+
+        EXPECT_EQ(0, myExtrapStep.jac7_(2, 0));
+        EXPECT_EQ(0, myExtrapStep.jac7_(2, 1));
+        EXPECT_EQ(0, myExtrapStep.jac7_(2, 2));
+        EXPECT_EQ(0, myExtrapStep.jac7_(2, 3));
+        EXPECT_EQ(0, myExtrapStep.jac7_(2, 4));
+        EXPECT_EQ(0, myExtrapStep.jac7_(2, 5));
+        EXPECT_EQ(0, myExtrapStep.jac7_(2, 6));
+
+        EXPECT_EQ(0, myExtrapStep.jac7_(3, 0));
+        EXPECT_EQ(0, myExtrapStep.jac7_(3, 1));
+        EXPECT_EQ(0, myExtrapStep.jac7_(3, 2));
+        EXPECT_EQ(0, myExtrapStep.jac7_(3, 3));
+        EXPECT_EQ(0, myExtrapStep.jac7_(3, 4));
+        EXPECT_EQ(0, myExtrapStep.jac7_(3, 5));
+        EXPECT_EQ(0, myExtrapStep.jac7_(3, 6));
+
+        EXPECT_EQ(0, myExtrapStep.jac7_(4, 0));
+        EXPECT_EQ(0, myExtrapStep.jac7_(4, 1));
+        EXPECT_EQ(0, myExtrapStep.jac7_(4, 2));
+        EXPECT_EQ(0, myExtrapStep.jac7_(4, 3));
+        EXPECT_EQ(0, myExtrapStep.jac7_(4, 4));
+        EXPECT_EQ(0, myExtrapStep.jac7_(4, 5));
+        EXPECT_EQ(0, myExtrapStep.jac7_(4, 6));
+
+        EXPECT_EQ(0, myExtrapStep.jac7_(5, 0));
+        EXPECT_EQ(0, myExtrapStep.jac7_(5, 1));
+        EXPECT_EQ(0, myExtrapStep.jac7_(5, 2));
+        EXPECT_EQ(0, myExtrapStep.jac7_(5, 3));
+        EXPECT_EQ(0, myExtrapStep.jac7_(5, 4));
+        EXPECT_EQ(0, myExtrapStep.jac7_(5, 5));
+        EXPECT_EQ(0, myExtrapStep.jac7_(5, 6));
+
+        EXPECT_EQ(0, myExtrapStep.jac7_(6, 0));
+        EXPECT_EQ(0, myExtrapStep.jac7_(6, 1));
+        EXPECT_EQ(0, myExtrapStep.jac7_(6, 2));
+        EXPECT_EQ(0, myExtrapStep.jac7_(6, 3));
+        EXPECT_EQ(0, myExtrapStep.jac7_(6, 4));
+        EXPECT_EQ(0, myExtrapStep.jac7_(6, 5));
+        EXPECT_EQ(0, myExtrapStep.jac7_(6, 6));
+
+        EXPECT_EQ(0, myExtrapStep.noise7_(0, 0));
+        EXPECT_EQ(0, myExtrapStep.noise7_(0, 1));
+        EXPECT_EQ(0, myExtrapStep.noise7_(0, 2));
+        EXPECT_EQ(0, myExtrapStep.noise7_(0, 3));
+        EXPECT_EQ(0, myExtrapStep.noise7_(0, 4));
+        EXPECT_EQ(0, myExtrapStep.noise7_(0, 5));
+        EXPECT_EQ(0, myExtrapStep.noise7_(0, 6));
+
+        EXPECT_EQ(0, myExtrapStep.noise7_(1, 0));
+        EXPECT_EQ(0, myExtrapStep.noise7_(1, 1));
+        EXPECT_EQ(0, myExtrapStep.noise7_(1, 2));
+        EXPECT_EQ(0, myExtrapStep.noise7_(1, 3));
+        EXPECT_EQ(0, myExtrapStep.noise7_(1, 4));
+        EXPECT_EQ(0, myExtrapStep.noise7_(1, 5));
+        EXPECT_EQ(0, myExtrapStep.noise7_(1, 6));
+
+        EXPECT_EQ(0, myExtrapStep.noise7_(2, 0));
+        EXPECT_EQ(0, myExtrapStep.noise7_(2, 1));
+        EXPECT_EQ(0, myExtrapStep.noise7_(2, 2));
+        EXPECT_EQ(0, myExtrapStep.noise7_(2, 3));
+        EXPECT_EQ(0, myExtrapStep.noise7_(2, 4));
+        EXPECT_EQ(0, myExtrapStep.noise7_(2, 5));
+        EXPECT_EQ(0, myExtrapStep.noise7_(2, 6));
+
+        EXPECT_EQ(0, myExtrapStep.noise7_(3, 0));
+        EXPECT_EQ(0, myExtrapStep.noise7_(3, 1));
+        EXPECT_EQ(0, myExtrapStep.noise7_(3, 2));
+        EXPECT_EQ(0, myExtrapStep.noise7_(3, 3));
+        EXPECT_EQ(0, myExtrapStep.noise7_(3, 4));
+        EXPECT_EQ(0, myExtrapStep.noise7_(3, 5));
+        EXPECT_EQ(0, myExtrapStep.noise7_(3, 6));
+
+        EXPECT_EQ(0, myExtrapStep.noise7_(4, 0));
+        EXPECT_EQ(0, myExtrapStep.noise7_(4, 1));
+        EXPECT_EQ(0, myExtrapStep.noise7_(4, 2));
+        EXPECT_EQ(0, myExtrapStep.noise7_(4, 3));
+        EXPECT_EQ(0, myExtrapStep.noise7_(4, 4));
+        EXPECT_EQ(0, myExtrapStep.noise7_(4, 5));
+        EXPECT_EQ(0, myExtrapStep.noise7_(4, 6));
+
+        EXPECT_EQ(0, myExtrapStep.noise7_(5, 0));
+        EXPECT_EQ(0, myExtrapStep.noise7_(5, 1));
+        EXPECT_EQ(0, myExtrapStep.noise7_(5, 2));
+        EXPECT_EQ(0, myExtrapStep.noise7_(5, 3));
+        EXPECT_EQ(0, myExtrapStep.noise7_(5, 4));
+        EXPECT_EQ(0, myExtrapStep.noise7_(5, 5));
+        EXPECT_EQ(0, myExtrapStep.noise7_(5, 6));
+
+        EXPECT_EQ(0, myExtrapStep.noise7_(6, 0));
+        EXPECT_EQ(0, myExtrapStep.noise7_(6, 1));
+        EXPECT_EQ(0, myExtrapStep.noise7_(6, 2));
+        EXPECT_EQ(0, myExtrapStep.noise7_(6, 3));
+        EXPECT_EQ(0, myExtrapStep.noise7_(6, 4));
+        EXPECT_EQ(0, myExtrapStep.noise7_(6, 5));
+        EXPECT_EQ(0, myExtrapStep.noise7_(6, 6));
+    }
+
+    /// Black-Box-Test
+    TEST_F (RKTrackRepTests, RKPropagate01) {
+        genfit::M1x7 myState7;
+        myState7.vals[0] = 0;
+        myState7.vals[1] = 0;
+        myState7.vals[2] = 0;
+        myState7.vals[3] = 0;
+        myState7.vals[4] = 0;
+        myState7.vals[5] = 1;
+        myState7.vals[6] = 1;
+        genfit::M7x7* myJacobian = nullptr;
+        genfit::M1x3 mySA;
+        double myS = 0.5;
+        const bool varField = false;
+        const bool calcOnlyLastRowOfJ = false;
+
+        genfit::RKTrackRep myRKTrackRep;
+        EXPECT_EQ(10, myRKTrackRep.RKPropagate(myState7, myJacobian, mySA, myS, varField, calcOnlyLastRowOfJ));
+        EXPECT_EQ(0, myState7[0]);
+        EXPECT_EQ(0, myState7[1]);
+        EXPECT_EQ(0.5, myState7[2]);
+        EXPECT_EQ(0, myState7[3]);
+        EXPECT_EQ(0, myState7[4]);
+        EXPECT_EQ(1, myState7[5]);
+        EXPECT_EQ(1, myState7[6]);
+        EXPECT_EQ(0, mySA[0]);
+        EXPECT_EQ(0, mySA[1]);
+        EXPECT_EQ(0, mySA[2]);
+    }
+
+    /// Black-Box-Test
+    TEST_F (RKTrackRepTests, RKPropagate02) {
+        genfit::M1x7 myState7;
+        myState7.vals[0] = 1;
+        myState7.vals[1] = 1;
+        myState7.vals[2] = 1;
+        myState7.vals[3] = 1;
+        myState7.vals[4] = 1;
+        myState7.vals[5] = 1;
+        myState7.vals[6] = 1;
+        genfit::M7x7* myJacobian = nullptr;
+        genfit::M1x3 mySA;
+        double myS = 0.1;
+        const bool varField = false;
+        const bool calcOnlyLastRowOfJ = false;
+
+        genfit::RKTrackRep myRKTrackRep;
+        EXPECT_FLOAT_EQ(10, myRKTrackRep.RKPropagate(myState7, myJacobian, mySA, myS, varField, calcOnlyLastRowOfJ));
+        EXPECT_FLOAT_EQ(1.1000299732532006, myState7[0]);
+        EXPECT_FLOAT_EQ(1.0999700147633968, myState7[1]);
+        EXPECT_FLOAT_EQ(1.1, myState7[2]);
+        EXPECT_FLOAT_EQ(0.5776963359022331, myState7[3]);
+        EXPECT_FLOAT_EQ(0.5770039949184069, myState7[4]);
+        EXPECT_FLOAT_EQ(0.5773502691896258, myState7[5]);
+        EXPECT_FLOAT_EQ(1, myState7[6]);
+        EXPECT_FLOAT_EQ(0.000599405129044106, mySA[0]);
+        EXPECT_FLOAT_EQ(-0.0005997646311051152, mySA[1]);
+        EXPECT_FLOAT_EQ(0., mySA[2]);
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, getState7) {
+        RKTrackRep myRKTrackRep;
+        genfit::M1x7 myState7;
+        myState7.vals[0] = 0;
+        myState7.vals[1] = 0;
+        myState7.vals[2] = 0;
+        myState7.vals[3] = 0;
+        myState7.vals[4] = 0;
+        myState7.vals[5] = 0;
+        myState7.vals[6] = 0;
+
+        genfit::MeasurementOnPlane myMeasurementOnPlane;
+        EXPECT_THROW(myRKTrackRep.getState7(myMeasurementOnPlane, myState7), genfit::Exception);
+        EXPECT_EQ(0, myState7[0]);
+        EXPECT_EQ(0, myState7[1]);
+        EXPECT_EQ(0, myState7[2]);
+        EXPECT_EQ(0, myState7[3]);
+        EXPECT_EQ(0, myState7[4]);
+        EXPECT_EQ(0, myState7[5]);
+        EXPECT_EQ(0, myState7[6]);
+
+        TVectorD myState5(5);
+        myState5[0] = -1;
+        myState5[1] = 1;
+        myState5[2] = 1;
+        myState5[3] = 0.1;
+        myState5[4] = 0.1;
+        genfit::SharedPlanePtr mySharedPlanePtr(new genfit::DetPlane(TVector3(0, 0, 1), TVector3(0, 0, 1), nullptr));
+        genfit::StateOnPlane myStateOnPlane(myState5, mySharedPlanePtr, &myRKTrackRep);
+        EXPECT_NO_THROW(myRKTrackRep.getState7(myStateOnPlane, myState7));
+        EXPECT_FLOAT_EQ(-0.1, myState7[0]);
+        EXPECT_FLOAT_EQ(-0.1, myState7[1]);
+        EXPECT_FLOAT_EQ(1, myState7[2]);
+        EXPECT_FLOAT_EQ(-0.57735, myState7[3]);
+        EXPECT_FLOAT_EQ(-0.57735, myState7[4]);
+        EXPECT_FLOAT_EQ(0.57735, myState7[5]);
+        EXPECT_FLOAT_EQ(-1, myState7[6]);
+
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, getState5) {
+        RKTrackRep myRKTrackRep;
+        genfit::M1x7 myState7;
+        // state7 must already lie on plane of state
+        // We take the values from the getState7 test, because we know them.
+        myState7[0] = -0.1;
+        myState7[1] = -0.1;
+        myState7[2] = 1;
+        myState7[3] = -0.57735;
+        myState7[4] = -0.57735;
+        myState7[5] = 0.57735;
+        myState7[6] = -1;
+        TVectorD myState5(5);
+        genfit::SharedPlanePtr mySharedPlanePtr(new genfit::DetPlane(TVector3(0, 0, 1), TVector3(0, 0, 1), nullptr));
+        genfit::StateOnPlane myStateOnPlane(myState5, mySharedPlanePtr, &myRKTrackRep);
+        EXPECT_NO_THROW(myRKTrackRep.getState5(myStateOnPlane, myState7));
+        EXPECT_FLOAT_EQ(-0.1, myState7[0]);
+        EXPECT_FLOAT_EQ(-0.1, myState7[1]);
+        EXPECT_FLOAT_EQ(1, myState7[2]);
+        EXPECT_FLOAT_EQ(-0.57735, myState7[3]);
+        EXPECT_FLOAT_EQ(-0.57735, myState7[4]);
+        EXPECT_FLOAT_EQ(0.57735, myState7[5]);
+        EXPECT_FLOAT_EQ(-1, myState7[6]);
+
+        EXPECT_EQ(-1, myStateOnPlane.getState()[0]);
+        EXPECT_EQ(1, myStateOnPlane.getState()[1]);
+        EXPECT_EQ(1, myStateOnPlane.getState()[2]);
+        EXPECT_EQ(0.1, myStateOnPlane.getState()[3]);
+        EXPECT_EQ(0.1, myStateOnPlane.getState()[4]);
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, calcJ_pM_5x7) {
+        // TODO: Implement
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, transformPM6) {
+        // TODO: Implement
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, calcJ_Mp_7x5) {
+        // TODO: Implement
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, calcForwardJacobianAndNoise) {
+        const TVector3 startPlaneO(0, 0, 1);
+        const TVector3 startPlaneN(0, 0, 1);
+        const TVector3 destPlaneO(0, 0, -1);
+        const TVector3 destPlaneN(0, 0, 1);
+
+        genfit::RKTrackRep myRKTrackRep;
+        genfit::DetPlane myStartPlane(startPlaneO, startPlaneN);
+        genfit::DetPlane myDestPlane(destPlaneO, destPlaneN);
+        genfit::M1x7 myStartState;
+        genfit::M1x7 myDestState;
+
+        EXPECT_EQ(0, myRKTrackRep.ExtrapSteps_.size());
+        EXPECT_THROW(myRKTrackRep.calcForwardJacobianAndNoise(myStartState, myStartPlane, myDestState, myDestPlane),
+                     genfit::Exception);
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, transformM6P) {
+        // TODO: Implement
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, RKutta) {
+        // TODO: Implement
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, estimateStep) {
+        // TODO: Implement
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, Extrap) {
+        // TODO: Implement
+    }
+
+    /// White-Box-Test
+    TEST_F (RKTrackRepTests, momMag) {
+        genfit::RKTrackRep myRKTrackRep;
+        genfit::M1x7 myState7 = {0, 0, 0, 0, 0, 0, 0};
+        EXPECT_EQ(std::numeric_limits<double>::infinity(), myRKTrackRep.momMag(myState7));
+        myState7 = {0, 0, 0, 0, 0, 0, 1};
+        EXPECT_EQ(1.0, myRKTrackRep.momMag(myState7));
+        myState7 = {0, 0, 0, 0, 0, 0, -1};
+        EXPECT_EQ(1.0, myRKTrackRep.momMag(myState7));
+    }
+
+}
diff --git a/gtest/TestRootEigenTransformations.cpp b/gtest/TestRootEigenTransformations.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0f175d2393c9073006d57b341c348b221e828d4b
--- /dev/null
+++ b/gtest/TestRootEigenTransformations.cpp
@@ -0,0 +1,187 @@
+#include <gtest/gtest.h>
+
+#include <TVectorD.h>
+#include <Eigen/Dense>
+
+#include <RootEigenTransformations.h>
+
+namespace genfit {
+
+    class RootEigenTransformations : public ::testing::Test {
+    protected:
+    };
+
+    TEST_F(RootEigenTransformations, VectorTransformation) {
+        TVectorD myTVectorD(5);
+        myTVectorD(0) = 0.5;
+        myTVectorD(0) = 0.4;
+        myTVectorD(0) = 0.3;
+        myTVectorD(0) = 0.2;
+        myTVectorD(0) = 0.1;
+
+        const auto myEigenVector(rootVectorToEigenVector<5>(myTVectorD));
+        EXPECT_EQ(myTVectorD(0), myEigenVector(0));
+        EXPECT_EQ(myTVectorD(1), myEigenVector(1));
+        EXPECT_EQ(myTVectorD(2), myEigenVector(2));
+        EXPECT_EQ(myTVectorD(3), myEigenVector(3));
+        EXPECT_EQ(myTVectorD(4), myEigenVector(4));
+
+        const auto myRootVector(eigenVectorToRootVector<5>(myEigenVector));
+        EXPECT_EQ(myTVectorD(0), myRootVector(0));
+        EXPECT_EQ(myTVectorD(1), myRootVector(1));
+        EXPECT_EQ(myTVectorD(2), myRootVector(2));
+        EXPECT_EQ(myTVectorD(3), myRootVector(3));
+        EXPECT_EQ(myTVectorD(4), myRootVector(4));
+    }
+
+    TEST_F(RootEigenTransformations, SymmetricMatrixTransformation) {
+        TMatrixDSym myTMatrixDSym(5);
+        for (unsigned int row=0; row<5; ++row) {
+            for (unsigned int col=0; col<5; ++col) {
+                myTMatrixDSym(row, col) = row*col;  // Put some non-zero value here.
+            }
+        }
+
+        const auto myEigenMatrix(rootMatrixSymToEigenMatrix<5>(myTMatrixDSym));
+        EXPECT_EQ(myTMatrixDSym(0, 0), myEigenMatrix(0, 0));
+        EXPECT_EQ(myTMatrixDSym(0, 1), myEigenMatrix(0, 1));
+        EXPECT_EQ(myTMatrixDSym(0, 2), myEigenMatrix(0, 2));
+        EXPECT_EQ(myTMatrixDSym(0, 3), myEigenMatrix(0, 3));
+        EXPECT_EQ(myTMatrixDSym(0, 4), myEigenMatrix(0, 4));
+        EXPECT_EQ(myTMatrixDSym(1, 0), myEigenMatrix(1, 0));
+        EXPECT_EQ(myTMatrixDSym(1, 1), myEigenMatrix(1, 1));
+        EXPECT_EQ(myTMatrixDSym(1, 2), myEigenMatrix(1, 2));
+        EXPECT_EQ(myTMatrixDSym(1, 3), myEigenMatrix(1, 3));
+        EXPECT_EQ(myTMatrixDSym(1, 4), myEigenMatrix(1, 4));
+        EXPECT_EQ(myTMatrixDSym(2, 0), myEigenMatrix(2, 0));
+        EXPECT_EQ(myTMatrixDSym(2, 1), myEigenMatrix(2, 1));
+        EXPECT_EQ(myTMatrixDSym(2, 2), myEigenMatrix(2, 2));
+        EXPECT_EQ(myTMatrixDSym(2, 3), myEigenMatrix(2, 3));
+        EXPECT_EQ(myTMatrixDSym(2, 4), myEigenMatrix(2, 4));
+        EXPECT_EQ(myTMatrixDSym(3, 0), myEigenMatrix(3, 0));
+        EXPECT_EQ(myTMatrixDSym(3, 1), myEigenMatrix(3, 1));
+        EXPECT_EQ(myTMatrixDSym(3, 2), myEigenMatrix(3, 2));
+        EXPECT_EQ(myTMatrixDSym(3, 3), myEigenMatrix(3, 3));
+        EXPECT_EQ(myTMatrixDSym(3, 4), myEigenMatrix(3, 4));
+        EXPECT_EQ(myTMatrixDSym(4, 0), myEigenMatrix(4, 0));
+        EXPECT_EQ(myTMatrixDSym(4, 1), myEigenMatrix(4, 1));
+        EXPECT_EQ(myTMatrixDSym(4, 2), myEigenMatrix(4, 2));
+        EXPECT_EQ(myTMatrixDSym(4, 3), myEigenMatrix(4, 3));
+        EXPECT_EQ(myTMatrixDSym(4, 4), myEigenMatrix(4, 4));
+
+        const auto myRootMatrix(eigenMatrixToRootMatrixSym<5>(myEigenMatrix));
+        EXPECT_EQ(myTMatrixDSym(0, 0), myRootMatrix(0, 0));
+        EXPECT_EQ(myTMatrixDSym(0, 1), myRootMatrix(0, 1));
+        EXPECT_EQ(myTMatrixDSym(0, 2), myRootMatrix(0, 2));
+        EXPECT_EQ(myTMatrixDSym(0, 3), myRootMatrix(0, 3));
+        EXPECT_EQ(myTMatrixDSym(0, 4), myRootMatrix(0, 4));
+        EXPECT_EQ(myTMatrixDSym(1, 0), myRootMatrix(1, 0));
+        EXPECT_EQ(myTMatrixDSym(1, 1), myRootMatrix(1, 1));
+        EXPECT_EQ(myTMatrixDSym(1, 2), myRootMatrix(1, 2));
+        EXPECT_EQ(myTMatrixDSym(1, 3), myRootMatrix(1, 3));
+        EXPECT_EQ(myTMatrixDSym(1, 4), myRootMatrix(1, 4));
+        EXPECT_EQ(myTMatrixDSym(2, 0), myRootMatrix(2, 0));
+        EXPECT_EQ(myTMatrixDSym(2, 1), myRootMatrix(2, 1));
+        EXPECT_EQ(myTMatrixDSym(2, 2), myRootMatrix(2, 2));
+        EXPECT_EQ(myTMatrixDSym(2, 3), myRootMatrix(2, 3));
+        EXPECT_EQ(myTMatrixDSym(2, 4), myRootMatrix(2, 4));
+        EXPECT_EQ(myTMatrixDSym(3, 0), myRootMatrix(3, 0));
+        EXPECT_EQ(myTMatrixDSym(3, 1), myRootMatrix(3, 1));
+        EXPECT_EQ(myTMatrixDSym(3, 2), myRootMatrix(3, 2));
+        EXPECT_EQ(myTMatrixDSym(3, 3), myRootMatrix(3, 3));
+        EXPECT_EQ(myTMatrixDSym(3, 4), myRootMatrix(3, 4));
+        EXPECT_EQ(myTMatrixDSym(4, 0), myRootMatrix(4, 0));
+        EXPECT_EQ(myTMatrixDSym(4, 1), myRootMatrix(4, 1));
+        EXPECT_EQ(myTMatrixDSym(4, 2), myRootMatrix(4, 2));
+        EXPECT_EQ(myTMatrixDSym(4, 3), myRootMatrix(4, 3));
+        EXPECT_EQ(myTMatrixDSym(4, 4), myRootMatrix(4, 4));
+
+    }
+
+    TEST_F(RootEigenTransformations, MatrixTransformation) {
+        const unsigned int rows = 7;
+        const unsigned int cols = 5;
+        TMatrixD myTMatrix(rows, cols);
+        for (unsigned int row=0; row<rows; ++row) {
+            for (unsigned int col=0; col<cols; ++col) {
+                myTMatrix(row, col) = (row+1)*(col*col+1);  // Put some non-zero value here.
+            }
+        }
+
+        const auto myEigenMatrix(rootMatrixToEigenMatrix<7, 5>(myTMatrix));
+        EXPECT_EQ(myTMatrix(0, 0), myEigenMatrix(0, 0));
+        EXPECT_EQ(myTMatrix(0, 1), myEigenMatrix(0, 1));
+        EXPECT_EQ(myTMatrix(0, 2), myEigenMatrix(0, 2));
+        EXPECT_EQ(myTMatrix(0, 3), myEigenMatrix(0, 3));
+        EXPECT_EQ(myTMatrix(0, 4), myEigenMatrix(0, 4));
+        EXPECT_EQ(myTMatrix(1, 0), myEigenMatrix(1, 0));
+        EXPECT_EQ(myTMatrix(1, 1), myEigenMatrix(1, 1));
+        EXPECT_EQ(myTMatrix(1, 2), myEigenMatrix(1, 2));
+        EXPECT_EQ(myTMatrix(1, 3), myEigenMatrix(1, 3));
+        EXPECT_EQ(myTMatrix(1, 4), myEigenMatrix(1, 4));
+        EXPECT_EQ(myTMatrix(2, 0), myEigenMatrix(2, 0));
+        EXPECT_EQ(myTMatrix(2, 1), myEigenMatrix(2, 1));
+        EXPECT_EQ(myTMatrix(2, 2), myEigenMatrix(2, 2));
+        EXPECT_EQ(myTMatrix(2, 3), myEigenMatrix(2, 3));
+        EXPECT_EQ(myTMatrix(2, 4), myEigenMatrix(2, 4));
+        EXPECT_EQ(myTMatrix(3, 0), myEigenMatrix(3, 0));
+        EXPECT_EQ(myTMatrix(3, 1), myEigenMatrix(3, 1));
+        EXPECT_EQ(myTMatrix(3, 2), myEigenMatrix(3, 2));
+        EXPECT_EQ(myTMatrix(3, 3), myEigenMatrix(3, 3));
+        EXPECT_EQ(myTMatrix(3, 4), myEigenMatrix(3, 4));
+        EXPECT_EQ(myTMatrix(4, 0), myEigenMatrix(4, 0));
+        EXPECT_EQ(myTMatrix(4, 1), myEigenMatrix(4, 1));
+        EXPECT_EQ(myTMatrix(4, 2), myEigenMatrix(4, 2));
+        EXPECT_EQ(myTMatrix(4, 3), myEigenMatrix(4, 3));
+        EXPECT_EQ(myTMatrix(4, 4), myEigenMatrix(4, 4));
+        EXPECT_EQ(myTMatrix(5, 0), myEigenMatrix(5, 0));
+        EXPECT_EQ(myTMatrix(5, 1), myEigenMatrix(5, 1));
+        EXPECT_EQ(myTMatrix(5, 2), myEigenMatrix(5, 2));
+        EXPECT_EQ(myTMatrix(5, 3), myEigenMatrix(5, 3));
+        EXPECT_EQ(myTMatrix(5, 4), myEigenMatrix(5, 4));
+        EXPECT_EQ(myTMatrix(6, 0), myEigenMatrix(6, 0));
+        EXPECT_EQ(myTMatrix(6, 1), myEigenMatrix(6, 1));
+        EXPECT_EQ(myTMatrix(6, 2), myEigenMatrix(6, 2));
+        EXPECT_EQ(myTMatrix(6, 3), myEigenMatrix(6, 3));
+        EXPECT_EQ(myTMatrix(6, 4), myEigenMatrix(6, 4));
+
+        const auto myRootMatrix(eigenMatrixToRootMatrix<7, 5>(myEigenMatrix));
+        EXPECT_EQ(myTMatrix(0, 0), myRootMatrix(0, 0));
+        EXPECT_EQ(myTMatrix(0, 1), myRootMatrix(0, 1));
+        EXPECT_EQ(myTMatrix(0, 2), myRootMatrix(0, 2));
+        EXPECT_EQ(myTMatrix(0, 3), myRootMatrix(0, 3));
+        EXPECT_EQ(myTMatrix(0, 4), myRootMatrix(0, 4));
+        EXPECT_EQ(myTMatrix(1, 0), myRootMatrix(1, 0));
+        EXPECT_EQ(myTMatrix(1, 1), myRootMatrix(1, 1));
+        EXPECT_EQ(myTMatrix(1, 2), myRootMatrix(1, 2));
+        EXPECT_EQ(myTMatrix(1, 3), myRootMatrix(1, 3));
+        EXPECT_EQ(myTMatrix(1, 4), myRootMatrix(1, 4));
+        EXPECT_EQ(myTMatrix(2, 0), myRootMatrix(2, 0));
+        EXPECT_EQ(myTMatrix(2, 1), myRootMatrix(2, 1));
+        EXPECT_EQ(myTMatrix(2, 2), myRootMatrix(2, 2));
+        EXPECT_EQ(myTMatrix(2, 3), myRootMatrix(2, 3));
+        EXPECT_EQ(myTMatrix(2, 4), myRootMatrix(2, 4));
+        EXPECT_EQ(myTMatrix(3, 0), myRootMatrix(3, 0));
+        EXPECT_EQ(myTMatrix(3, 1), myRootMatrix(3, 1));
+        EXPECT_EQ(myTMatrix(3, 2), myRootMatrix(3, 2));
+        EXPECT_EQ(myTMatrix(3, 3), myRootMatrix(3, 3));
+        EXPECT_EQ(myTMatrix(3, 4), myRootMatrix(3, 4));
+        EXPECT_EQ(myTMatrix(4, 0), myRootMatrix(4, 0));
+        EXPECT_EQ(myTMatrix(4, 1), myRootMatrix(4, 1));
+        EXPECT_EQ(myTMatrix(4, 2), myRootMatrix(4, 2));
+        EXPECT_EQ(myTMatrix(4, 3), myRootMatrix(4, 3));
+        EXPECT_EQ(myTMatrix(4, 4), myRootMatrix(4, 4));
+        EXPECT_EQ(myTMatrix(5, 0), myRootMatrix(5, 0));
+        EXPECT_EQ(myTMatrix(5, 1), myRootMatrix(5, 1));
+        EXPECT_EQ(myTMatrix(5, 2), myRootMatrix(5, 2));
+        EXPECT_EQ(myTMatrix(5, 3), myRootMatrix(5, 3));
+        EXPECT_EQ(myTMatrix(5, 4), myRootMatrix(5, 4));
+        EXPECT_EQ(myTMatrix(6, 0), myRootMatrix(6, 0));
+        EXPECT_EQ(myTMatrix(6, 1), myRootMatrix(6, 1));
+        EXPECT_EQ(myTMatrix(6, 2), myRootMatrix(6, 2));
+        EXPECT_EQ(myTMatrix(6, 3), myRootMatrix(6, 3));
+        EXPECT_EQ(myTMatrix(6, 4), myRootMatrix(6, 4));
+
+    }
+
+}
\ No newline at end of file
diff --git a/gtest/TestUnits.cpp b/gtest/TestUnits.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c9b31ed235036d280470af1931ef38a674a7dddc
--- /dev/null
+++ b/gtest/TestUnits.cpp
@@ -0,0 +1,18 @@
+#include <gtest/gtest.h>
+
+#include <Units.h>
+
+namespace genfit {
+
+    class UnitTests : public ::testing::Test {
+    protected:
+    };
+
+    TEST_F (UnitTests, Energy) {
+        EXPECT_FLOAT_EQ(1, 1 * Unit::GeV);
+        EXPECT_FLOAT_EQ(0.001, 1 * Unit::MeV);
+        EXPECT_FLOAT_EQ(0.000001, 1 * Unit::keV);
+        EXPECT_FLOAT_EQ(0.000000001, 1 * Unit::eV);
+    }
+
+}
\ No newline at end of file
diff --git a/measurements/include/FullMeasurement.h b/measurements/include/FullMeasurement.h
index c87ee59b1b02c0e9ae899c275d8225aa8a13f622..267aeeef9035ad2e49357c19d21a16c93d03e275 100644
--- a/measurements/include/FullMeasurement.h
+++ b/measurements/include/FullMeasurement.h
@@ -43,24 +43,24 @@ class FullMeasurement : public AbsMeasurement {
 
  public:
   FullMeasurement(int nDim = 5);
-  FullMeasurement(const MeasuredStateOnPlane&, int detId = -1, int hitId = -1, TrackPoint* trackPoint = NULL);
+  FullMeasurement(const MeasuredStateOnPlane&, int detId = -1, int hitId = -1, TrackPoint* trackPoint = nullptr);
 
   virtual ~FullMeasurement() {;}
 
-  virtual AbsMeasurement* clone() const {return new FullMeasurement(*this);}
+  virtual AbsMeasurement* clone() const override {return new FullMeasurement(*this);}
 
-  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const;
+  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const override;
 
-  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const;
+  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const override;
 
-  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const;
+  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const override;
 
  protected:
   SharedPlanePtr plane_;   //! This is persistent, but '!' makes ROOT shut up.
 
  public:
 
-  ClassDef(FullMeasurement,1)
+  ClassDefOverride(FullMeasurement,1)
 
 };
 
diff --git a/measurements/include/HMatrixU.h b/measurements/include/HMatrixU.h
index c93a526927a3eb2586ec76014787dad56086ecc3..52e64960b361cf29b8595143010f63e49622e59f 100644
--- a/measurements/include/HMatrixU.h
+++ b/measurements/include/HMatrixU.h
@@ -40,22 +40,22 @@ class HMatrixU : public AbsHMatrix {
 
   HMatrixU() {;}
 
-  const TMatrixD& getMatrix() const;
+  const TMatrixD& getMatrix() const override;
 
-  TVectorD Hv(const TVectorD& v) const;
+  TVectorD Hv(const TVectorD& v) const override;
 
-  TMatrixD MHt(const TMatrixDSym& M) const;
-  TMatrixD MHt(const TMatrixD& M) const;
+  TMatrixD MHt(const TMatrixDSym& M) const override;
+  TMatrixD MHt(const TMatrixD& M) const override;
 
-  void HMHt(TMatrixDSym& M) const;
+  void HMHt(TMatrixDSym& M) const override;
 
-  virtual HMatrixU* clone() const {return new HMatrixU(*this);}
+  virtual HMatrixU* clone() const override {return new HMatrixU(*this);}
 
-  virtual bool isEqual(const AbsHMatrix& other) const {return (dynamic_cast<const HMatrixU*>(&other) != NULL);}
+  virtual bool isEqual(const AbsHMatrix& other) const override {return (dynamic_cast<const HMatrixU*>(&other) != nullptr);}
 
-  virtual void Print(const Option_t* = "") const;
+  virtual void Print(const Option_t* = "") const override;
 
-  ClassDef(HMatrixU,1)
+  ClassDefOverride(HMatrixU,1)
 
 };
 
diff --git a/measurements/include/HMatrixUV.h b/measurements/include/HMatrixUV.h
index e0c116f3a16b19d95687a4162bf322afffb7a9e9..46fc8b7c68ba4a1ec3361cbd0a1ad69fbb12224f 100644
--- a/measurements/include/HMatrixUV.h
+++ b/measurements/include/HMatrixUV.h
@@ -43,22 +43,22 @@ class HMatrixUV : public AbsHMatrix {
 
   HMatrixUV() {;}
 
-  const TMatrixD& getMatrix() const;
+  const TMatrixD& getMatrix() const override;
 
-  TVectorD Hv(const TVectorD& v) const;
+  TVectorD Hv(const TVectorD& v) const override;
 
-  TMatrixD MHt(const TMatrixDSym& M) const;
-  TMatrixD MHt(const TMatrixD& M) const;
+  TMatrixD MHt(const TMatrixDSym& M) const override;
+  TMatrixD MHt(const TMatrixD& M) const override;
 
-  void HMHt(TMatrixDSym& M) const;
+  void HMHt(TMatrixDSym& M) const override;
 
-  virtual HMatrixUV* clone() const {return new HMatrixUV(*this);}
+  virtual HMatrixUV* clone() const override {return new HMatrixUV(*this);}
 
-  virtual bool isEqual(const AbsHMatrix& other) const {return (dynamic_cast<const HMatrixUV*>(&other) != NULL);}
+  virtual bool isEqual(const AbsHMatrix& other) const override {return (dynamic_cast<const HMatrixUV*>(&other) != nullptr);}
 
-  virtual void Print(const Option_t* = "") const;
+  virtual void Print(const Option_t* = "") const override;
 
-  ClassDef(HMatrixUV,1)
+  ClassDefOverride(HMatrixUV,1)
 
 };
 
diff --git a/measurements/include/HMatrixUnit.h b/measurements/include/HMatrixUnit.h
index c7bc82f7a8e2465b7dd1cbd5448325af3abaf855..9aa7c95ac2bb896d1278249285c767bee537e31e 100644
--- a/measurements/include/HMatrixUnit.h
+++ b/measurements/include/HMatrixUnit.h
@@ -54,7 +54,7 @@ class HMatrixUnit : public AbsHMatrix {
 
   virtual HMatrixUnit* clone() const {return new HMatrixUnit(*this);}
 
-  virtual bool isEqual(const AbsHMatrix& other) const {return (dynamic_cast<const HMatrixUnit*>(&other) != NULL);}
+  virtual bool isEqual(const AbsHMatrix& other) const {return (dynamic_cast<const HMatrixUnit*>(&other) != nullptr);}
 
   virtual void Print(const Option_t* = "") const;
 
diff --git a/measurements/include/HMatrixV.h b/measurements/include/HMatrixV.h
index 991b86ee3cfe59665d85cbd88ff480c2e1ea1e2e..e4afd511d29d67073fd7c38de78d2959a421468f 100644
--- a/measurements/include/HMatrixV.h
+++ b/measurements/include/HMatrixV.h
@@ -40,22 +40,22 @@ class HMatrixV : public AbsHMatrix {
 
   HMatrixV() {;}
 
-  const TMatrixD& getMatrix() const;
+  const TMatrixD& getMatrix() const override;
 
-  TVectorD Hv(const TVectorD& v) const;
+  TVectorD Hv(const TVectorD& v) const override;
 
-  TMatrixD MHt(const TMatrixDSym& M) const;
-  TMatrixD MHt(const TMatrixD& M) const;
+  TMatrixD MHt(const TMatrixDSym& M) const override;
+  TMatrixD MHt(const TMatrixD& M) const override;
 
-  void HMHt(TMatrixDSym& M) const;
+  void HMHt(TMatrixDSym& M) const override;
 
-  virtual HMatrixV* clone() const {return new HMatrixV(*this);}
+  virtual HMatrixV* clone() const override {return new HMatrixV(*this);}
 
-  virtual bool isEqual(const AbsHMatrix& other) const {return (dynamic_cast<const HMatrixV*>(&other) != NULL);}
+  virtual bool isEqual(const AbsHMatrix& other) const override {return (dynamic_cast<const HMatrixV*>(&other) != nullptr);}
 
-  virtual void Print(const Option_t* = "") const;
+  virtual void Print(const Option_t* = "") const override;
 
-  ClassDef(HMatrixV,1)
+  ClassDefOverride(HMatrixV,1)
 
 };
 
diff --git a/measurements/include/PlanarMeasurement.h b/measurements/include/PlanarMeasurement.h
index fceccf0560b85b2d00aa32a23f68573ec8f2edfb..31041aedf93d7bcda509cecadbddd06457fb1dcb 100644
--- a/measurements/include/PlanarMeasurement.h
+++ b/measurements/include/PlanarMeasurement.h
@@ -49,15 +49,15 @@ class PlanarMeasurement : public AbsMeasurement {
 
   virtual ~PlanarMeasurement() {;}
 
-  virtual AbsMeasurement* clone() const {return new PlanarMeasurement(*this);}
+  virtual AbsMeasurement* clone() const override {return new PlanarMeasurement(*this);}
 
   int getPlaneId() const {return planeId_;}
 
-  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const;
+  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const override;
 
-  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const;
+  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const override;
 
-  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const;
+  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const override;
 
   virtual void setPlane(const SharedPlanePtr& physicalPlane, int planeId = -1) {physicalPlane_ = physicalPlane; planeId_ = planeId;}
 
@@ -76,7 +76,7 @@ class PlanarMeasurement : public AbsMeasurement {
 
  public:
 
-  ClassDef(PlanarMeasurement,1)
+  ClassDefOverride(PlanarMeasurement,1)
 
 };
 
diff --git a/measurements/include/SpacepointMeasurement.h b/measurements/include/SpacepointMeasurement.h
index fbf243ebe09a6087651bcbbf0e2311841028b3bd..ad002c0384aa7797e7ca8e6a46b9d428c0d013a7 100644
--- a/measurements/include/SpacepointMeasurement.h
+++ b/measurements/include/SpacepointMeasurement.h
@@ -52,7 +52,7 @@ class SpacepointMeasurement : public AbsMeasurement {
 
   virtual ~SpacepointMeasurement() {;}
 
-  virtual AbsMeasurement* clone() const {return new SpacepointMeasurement(*this);}
+  virtual AbsMeasurement* clone() const override {return new SpacepointMeasurement(*this);}
 
   /**
    * @brief Contruct the virtual detector plane
@@ -64,11 +64,11 @@ class SpacepointMeasurement : public AbsMeasurement {
    *  E.g. if the covariance is very oblate, the plane will be almost defined by the covariance shape.
    *  If the covariance is very prolate, the behaviour will be very similar to the ProlateSpacepointHit.
    */
-  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const;
+  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const override;
 
-  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const;
+  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const override;
 
-  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const;
+  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const override;
 
   /// false: project 3D cov onto DetPlane. true: cut 3D cov with DetPlane
   bool getWeightedPlaneConstruction() const     { return weightedPlaneContruction_; }
@@ -87,7 +87,7 @@ class SpacepointMeasurement : public AbsMeasurement {
   TMatrixDSym G_; //! inverse of 3x3 cov
   bool cutCov_; // false: project 3D cov onto DetPlane. true: cut 3D cov with DetPlane (default)
 
-  ClassDef(SpacepointMeasurement,3)
+  ClassDefOverride(SpacepointMeasurement,3)
 };
 
 } /* End of namespace genfit */
diff --git a/measurements/include/WireMeasurement.h b/measurements/include/WireMeasurement.h
index 5534c8ca83c7474f58981db8c3295500f37cfedd..7a379287dc7cfa5caf112c76fcd2689541b26ee9 100644
--- a/measurements/include/WireMeasurement.h
+++ b/measurements/include/WireMeasurement.h
@@ -57,9 +57,9 @@ class WireMeasurement : public AbsMeasurement {
 
   virtual ~WireMeasurement() {;}
 
-  virtual AbsMeasurement* clone() const {return new WireMeasurement(*this);}
+  virtual AbsMeasurement* clone() const override {return new WireMeasurement(*this);}
 
-  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const;
+  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const override;
 
   /**  Hits with a small drift distance get a higher weight, whereas hits with
     * big drift distances become weighted down.
@@ -71,9 +71,9 @@ class WireMeasurement : public AbsMeasurement {
     * trajectory, whereas the wire position for hits with large drift radii is further away
     * from the trajectory and will therefore bias the fit if not weighted down.
     */
-  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const;
+  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const override;
 
-  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const;
+  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const override;
 
   /** Set maximum drift distance. This is used to calculate the start weights of the two
    * measurementsOnPlane.
@@ -87,8 +87,8 @@ class WireMeasurement : public AbsMeasurement {
    */
   void setLeftRightResolution(int lr);
 
-  virtual bool isLeftRightMeasurement() const {return true;}
-  virtual int getLeftRightResolution() const {return leftRight_;}
+  virtual bool isLeftRightMeasurement() const override {return true;}
+  virtual int getLeftRightResolution() const override {return leftRight_;}
 
   double getMaxDistance(){return maxDistance_;}
 
@@ -99,7 +99,7 @@ class WireMeasurement : public AbsMeasurement {
 
  public:
 
-  ClassDef(WireMeasurement, 2)
+  ClassDefOverride(WireMeasurement, 2)
 
 };
 
diff --git a/measurements/include/WireMeasurementNew.h b/measurements/include/WireMeasurementNew.h
index 9f2cddcd249f927df3dc5efb455f9a69bb90bfa8..bad5b59470bf81b6444851da725ce970a3f92ae1 100644
--- a/measurements/include/WireMeasurementNew.h
+++ b/measurements/include/WireMeasurementNew.h
@@ -61,9 +61,9 @@ class WireMeasurementNew : public AbsMeasurement {
 
   virtual ~WireMeasurementNew() {;}
 
-  virtual WireMeasurementNew* clone() const {return new WireMeasurementNew(*this);}
+  virtual WireMeasurementNew* clone() const override {return new WireMeasurementNew(*this);}
 
-  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const;
+  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const override;
 
   /**  Hits with a small drift distance get a higher weight, whereas hits with
     * big drift distances become weighted down.
@@ -75,9 +75,9 @@ class WireMeasurementNew : public AbsMeasurement {
     * trajectory, whereas the wire position for hits with large drift radii is further away
     * from the trajectory and will therefore bias the fit if not weighted down.
     */
-  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const;
+  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const override;
 
-  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const;
+  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const override;
 
   /** Reset the wire end points.
    */
@@ -98,7 +98,7 @@ class WireMeasurementNew : public AbsMeasurement {
 
   virtual bool isLeftRigthMeasurement() const {return true;}
   double getMaxDistance(){return maxDistance_;}
-  int getLeftRightResolution() const {return leftRight_;}
+  int getLeftRightResolution() const override {return leftRight_;}
 
  protected:
 
@@ -109,7 +109,7 @@ class WireMeasurementNew : public AbsMeasurement {
 
  public:
 
-  ClassDef(WireMeasurementNew, 1)
+  ClassDefOverride(WireMeasurementNew, 1)
 
 };
 
diff --git a/measurements/include/WirePointMeasurement.h b/measurements/include/WirePointMeasurement.h
index fd7a7ca31c30d858417617c514d81f26bbc46cb9..0fe733e2fa9fe98fc40e8f7b2848c84d9f456fe0 100644
--- a/measurements/include/WirePointMeasurement.h
+++ b/measurements/include/WirePointMeasurement.h
@@ -56,18 +56,18 @@ class WirePointMeasurement : public WireMeasurement {
 
   virtual ~WirePointMeasurement() {;}
 
-  virtual AbsMeasurement* clone() const {return new WirePointMeasurement(*this);}
+  virtual AbsMeasurement* clone() const override {return new WirePointMeasurement(*this);}
 
-  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const;
+  virtual SharedPlanePtr constructPlane(const StateOnPlane& state) const override;
 
-  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const;
+  virtual std::vector<MeasurementOnPlane*> constructMeasurementsOnPlane(const StateOnPlane& state) const override;
 
-  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const;
+  virtual const AbsHMatrix* constructHMatrix(const AbsTrackRep*) const override;
 
 
  public:
 
-  ClassDef(WirePointMeasurement,1)
+  ClassDefOverride(WirePointMeasurement,1)
 
 };
 
diff --git a/measurements/include/WireTrackCandHit.h b/measurements/include/WireTrackCandHit.h
index c3c7396a76f6bd1a3c76ec3527799156f7a87bf8..0b0de6d3589c0a68e04053963c91761ce3cbaa6c 100644
--- a/measurements/include/WireTrackCandHit.h
+++ b/measurements/include/WireTrackCandHit.h
@@ -43,7 +43,7 @@ class WireTrackCandHit : public TrackCandHit {
 
   virtual ~WireTrackCandHit() {;}
 
-  virtual WireTrackCandHit* clone() const {return new WireTrackCandHit(*this);}
+  virtual WireTrackCandHit* clone() const override {return new WireTrackCandHit(*this);}
 
   // Accessors
   int getLeftRightResolution() const {return leftRight_;}
@@ -61,7 +61,7 @@ class WireTrackCandHit : public TrackCandHit {
     else leftRight_ = 1;
   }
 
-  virtual void Print(Option_t* option = "") const;
+  virtual void Print(Option_t* option = "") const override;
 
 
  protected:
@@ -79,7 +79,7 @@ class WireTrackCandHit : public TrackCandHit {
 
  public:
 
-  ClassDef(WireTrackCandHit, 2)
+  ClassDefOverride(WireTrackCandHit, 2)
 
 };
 
diff --git a/measurements/src/FullMeasurement.cc b/measurements/src/FullMeasurement.cc
index adb4c9cf157a6da9aceacce117fe811956fa3d11..163b00c11b5bb8f81d16f32735277dae303ed973 100644
--- a/measurements/src/FullMeasurement.cc
+++ b/measurements/src/FullMeasurement.cc
@@ -65,7 +65,7 @@ std::vector<MeasurementOnPlane*> FullMeasurement::constructMeasurementsOnPlane(c
 
 const AbsHMatrix* FullMeasurement::constructHMatrix(const AbsTrackRep* rep) const {
 
-  if (dynamic_cast<const RKTrackRep*>(rep) == NULL) {
+  if (dynamic_cast<const RKTrackRep*>(rep) == nullptr) {
     Exception exc("SpacepointMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
     throw exc;
   }
diff --git a/measurements/src/HMatrixPhi.cc b/measurements/src/HMatrixPhi.cc
index 033ce16ee76a7acce2814069ac0e57e97023d829..7e5a97282298a7a205ec12a7e325a06176481b25 100644
--- a/measurements/src/HMatrixPhi.cc
+++ b/measurements/src/HMatrixPhi.cc
@@ -101,7 +101,7 @@ void HMatrixPhi::HMHt(TMatrixDSym& M) const {
 
 
 bool HMatrixPhi::isEqual(const AbsHMatrix& other) const {
-  if (dynamic_cast<const HMatrixPhi*>(&other) == NULL)
+  if (dynamic_cast<const HMatrixPhi*>(&other) == nullptr)
     return false;
 
   return (phi_ == static_cast<const HMatrixPhi*>(&other)->phi_);
diff --git a/measurements/src/PlanarMeasurement.cc b/measurements/src/PlanarMeasurement.cc
index c34654b578fb4a6cd025f3e657c4a877cc417756..c33686ca30d31fb58f4347d726b08a29886d938f 100644
--- a/measurements/src/PlanarMeasurement.cc
+++ b/measurements/src/PlanarMeasurement.cc
@@ -66,7 +66,7 @@ std::vector<MeasurementOnPlane*> PlanarMeasurement::constructMeasurementsOnPlane
 
 const AbsHMatrix* PlanarMeasurement::constructHMatrix(const AbsTrackRep* rep) const {
 
-  if (dynamic_cast<const RKTrackRep*>(rep) == NULL) {
+  if (dynamic_cast<const RKTrackRep*>(rep) == nullptr) {
     Exception exc("SpacepointMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
     throw exc;
   }
diff --git a/measurements/src/SpacepointMeasurement.cc b/measurements/src/SpacepointMeasurement.cc
index b9f013ab3c16dbb7d4a1021041d6c03b15442714..45cd3c423c57633c1592e83ef21f303e90a9dd56 100644
--- a/measurements/src/SpacepointMeasurement.cc
+++ b/measurements/src/SpacepointMeasurement.cc
@@ -118,7 +118,7 @@ std::vector<MeasurementOnPlane*> SpacepointMeasurement::constructMeasurementsOnP
 
 
 const AbsHMatrix* SpacepointMeasurement::constructHMatrix(const AbsTrackRep* rep) const {
-  if (dynamic_cast<const RKTrackRep*>(rep) == NULL) {
+  if (dynamic_cast<const RKTrackRep*>(rep) == nullptr) {
     Exception exc("SpacepointMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
     throw exc;
   }
diff --git a/measurements/src/WireMeasurement.cc b/measurements/src/WireMeasurement.cc
index e09e7478937a3a18c0fdc0fa1e18ecac1401317b..3bf7aa3e908062f618d294b8b5613dc8804ec199 100644
--- a/measurements/src/WireMeasurement.cc
+++ b/measurements/src/WireMeasurement.cc
@@ -118,7 +118,7 @@ std::vector<MeasurementOnPlane*> WireMeasurement::constructMeasurementsOnPlane(c
 }
 
 const AbsHMatrix* WireMeasurement::constructHMatrix(const AbsTrackRep* rep) const {
-  if (dynamic_cast<const RKTrackRep*>(rep) == NULL) {
+  if (dynamic_cast<const RKTrackRep*>(rep) == nullptr) {
     Exception exc("WireMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
     throw exc;
   }
diff --git a/measurements/src/WireMeasurementNew.cc b/measurements/src/WireMeasurementNew.cc
index f919ac113e0de91ac14f8c4678333f6f3b299815..8c399d908099ee8faed14863859852757552f2fd 100644
--- a/measurements/src/WireMeasurementNew.cc
+++ b/measurements/src/WireMeasurementNew.cc
@@ -130,7 +130,7 @@ std::vector<MeasurementOnPlane*> WireMeasurementNew::constructMeasurementsOnPlan
 }
 
 const AbsHMatrix* WireMeasurementNew::constructHMatrix(const AbsTrackRep* rep) const {
-  if (dynamic_cast<const RKTrackRep*>(rep) == NULL) {
+  if (dynamic_cast<const RKTrackRep*>(rep) == nullptr) {
     Exception exc("WireMeasurementNew default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
     throw exc;
   }
diff --git a/measurements/src/WirePointMeasurement.cc b/measurements/src/WirePointMeasurement.cc
index 60b92ed2fc1f063d5b1cfb5873790953a0dd75c8..8b67c593cbca270d8bb2d1b9959dc2a7745f4c0e 100644
--- a/measurements/src/WirePointMeasurement.cc
+++ b/measurements/src/WirePointMeasurement.cc
@@ -116,7 +116,7 @@ std::vector<MeasurementOnPlane*> WirePointMeasurement::constructMeasurementsOnPl
 }
 
 const AbsHMatrix* WirePointMeasurement::constructHMatrix(const AbsTrackRep* rep) const {
-  if (dynamic_cast<const RKTrackRep*>(rep) == NULL) {
+  if (dynamic_cast<const RKTrackRep*>(rep) == nullptr) {
     Exception exc("WirePointMeasurement default implementation can only handle state vectors of type RKTrackRep!", __LINE__,__FILE__);
     throw exc;
   }
diff --git a/measurements/src/measurementsLinkDef.h b/measurements/src/measurementsLinkDef.h
index b7227e0613f5aba6879f108b6ed32115c6f187b1..5688d79f7a35e2aad8a8b278ec7d36c3660ee383 100644
--- a/measurements/src/measurementsLinkDef.h
+++ b/measurements/src/measurementsLinkDef.h
@@ -1,15 +1,11 @@
-#ifdef __CINT__
-
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
 
-#ifdef __CLING__
 #pragma link C++ nestedclass;
 #pragma link C++ nestedtypedef;
 
 #pragma link C++ namespace genfit;
-#endif
 
 #pragma link C++ class genfit::HMatrixU+;
 #pragma link C++ class genfit::HMatrixUnit+;
@@ -26,5 +22,3 @@
 #pragma link C++ class genfit::SpacepointMeasurement-;
 
 #pragma link C++ class genfit::WireTrackCandHit+;
-
-#endif
diff --git a/test/fitterTests/main.cc b/test/fitterTests/main.cc
index 04d8873e3f8ecd6dbe403b86c8a189473cb782bc..2d36081f911b20b614a25512cc031478a49c288e 100644
--- a/test/fitterTests/main.cc
+++ b/test/fitterTests/main.cc
@@ -232,7 +232,7 @@ int main() {
   //if (debug)
   //  fitter->setDebugLvl(10);
 
-  /*if (dynamic_cast<genfit::DAF*>(fitter) != NULL) {
+  /*if (dynamic_cast<genfit::DAF*>(fitter) != nullptr) {
     //static_cast<genfit::DAF*>(fitter)->setBetas(100, 50, 25, 12, 6, 3, 1, 0.5, 0.1);
     //static_cast<genfit::DAF*>(fitter)->setBetas(81, 8, 4, 0.5, 0.1);
     static_cast<genfit::DAF*>(fitter)->setAnnealingScheme(100, 0.1, 5);
@@ -313,8 +313,8 @@ int main() {
 
   CALLGRIND_START_INSTRUMENTATION;
 
-  genfit::Track* fitTrack(NULL);
-  genfit::Track* secondTrack(NULL);
+  genfit::Track* fitTrack(nullptr);
+  genfit::Track* secondTrack(nullptr);
 
   // main loop
   for (unsigned int iEvent=0; iEvent<nEvents; ++iEvent){
@@ -333,9 +333,9 @@ int main() {
 
       // clean up
       delete fitTrack;
-      fitTrack = NULL;
+      fitTrack = nullptr;
       delete secondTrack;
-      secondTrack = NULL;
+      secondTrack = nullptr;
 
 
       // true start values
@@ -444,7 +444,7 @@ int main() {
         delete secondRep;
       //if (debug) fitTrack->Print("C");
 
-      assert(fitTrack->checkConsistency());
+      fitTrack->checkConsistency();
       //fitTrack->addTrackRep(rep->clone()); // check if everything works fine with more than one rep
 
       // add measurements
@@ -456,7 +456,7 @@ int main() {
         else
           fitTrack->insertPoint(new genfit::TrackPoint(measurements[i], fitTrack));
 
-        assert(fitTrack->checkConsistency());
+        fitTrack->checkConsistency();
         //if (debug) fitTrack->Print("C");
       }
 
@@ -471,8 +471,8 @@ int main() {
         }
       }
 
-      assert(fitTrack->checkConsistency());
-      assert(secondTrack->checkConsistency());
+      fitTrack->checkConsistency();
+      secondTrack->checkConsistency();
 
       //if (debug) fitTrack->Print();
 
@@ -536,8 +536,8 @@ int main() {
         fitTrack->getFitStatus(rep)->Print();
       }
 
-      assert(fitTrack->checkConsistency());
-      assert(secondTrack->checkConsistency());
+      fitTrack->checkConsistency();
+      secondTrack->checkConsistency();
 
 #ifndef VALGRIND
       if (!onlyDisplayFailed && iEvent < 1000) {
@@ -585,7 +585,7 @@ int main() {
 
 
       genfit::TrackPoint* tp = fitTrack->getPointWithMeasurementAndFitterInfo(0, rep);
-      if (tp == NULL) {
+      if (tp == nullptr) {
         std::cout << "Track has no TrackPoint with fitterInfo! \n";
         continue;
       }
@@ -645,7 +645,7 @@ int main() {
 
 
       // check l/r resolution and outlier rejection
-      if (dynamic_cast<genfit::DAF*>(fitter) != NULL) {
+      if (dynamic_cast<genfit::DAF*>(fitter) != nullptr) {
         for (unsigned int i=0; i<fitTrack->getNumPointsWithMeasurement(); ++i){
 
           if (! fitTrack->getPointWithMeasurement(i)->hasFitterInfo(rep))
@@ -716,7 +716,7 @@ int main() {
 
         for (unsigned int i=0; i<1; ++i) {
           genfit::Track trClone(*fitTrack);
-          assert(trClone.checkConsistency());
+          trClone.checkConsistency();
 
           bool first(false), last(false);
 
@@ -739,10 +739,11 @@ int main() {
 
             trClone.prune(opt);
 
-            if (!trClone.checkConsistency()) {
+            try {
+              trClone.checkConsistency();
+            } catch (genfit::Exception& e) {
               trClone.getFitStatus()->getPruneFlags().Print();
             }
-            //trClone.getFitStatus()->getPruneFlags().Print();
 
             //std::cout<<"get stCloneFirst ";
             genfit::MeasuredStateOnPlane stCloneFirst = trClone.getFittedState();
diff --git a/test/measurementFactoryExample/main.cc b/test/measurementFactoryExample/main.cc
index 70bddd3c56a706713caa665764c573653feb1023..d01455c66d32e62eb47b425f5bb1ae22c9cfb1ee 100644
--- a/test/measurementFactoryExample/main.cc
+++ b/test/measurementFactoryExample/main.cc
@@ -158,8 +158,7 @@ int main() {
       continue;
     }
 
-    //check
-    assert(fitTrack.checkConsistency());
+    fitTrack.checkConsistency();
 
 
     if (iEvent < 1000) {
diff --git a/test/minimalFittingExample/main.cc b/test/minimalFittingExample/main.cc
index 065dee00654ff859b6c5e024af86567b11e93cb0..389b3712b079f4989011467bd31652c914af1281 100644
--- a/test/minimalFittingExample/main.cc
+++ b/test/minimalFittingExample/main.cc
@@ -132,13 +132,13 @@ int main() {
     }
 
     //check
-    assert(fitTrack.checkConsistency());
+    fitTrack.checkConsistency();
 
     // do the fit
     fitter->processTrack(&fitTrack);
 
     //check
-    assert(fitTrack.checkConsistency());
+    fitTrack.checkConsistency();
 
 
     if (iEvent < 1000) {
diff --git a/test/minimalFittingExample/main2.cc b/test/minimalFittingExample/main2.cc
index 5f493eb6ca3bc474663283f1427291bd355a8585..8c40f4f6de3e810b64c0f98cd06436e1bb62ffd8 100644
--- a/test/minimalFittingExample/main2.cc
+++ b/test/minimalFittingExample/main2.cc
@@ -71,26 +71,26 @@ int main() {
   TVectorD hitCoords(2);
   hitCoords[0] = 0;
   hitCoords[1] = 0;
-  genfit::PlanarMeasurement* measurement = new genfit::PlanarMeasurement(hitCoords, hitCov, detId, ++hitId, NULL);
+  genfit::PlanarMeasurement* measurement = new genfit::PlanarMeasurement(hitCoords, hitCov, detId, ++hitId, nullptr);
   measurement->setPlane(genfit::SharedPlanePtr(new genfit::DetPlane(TVector3(0,0,0), TVector3(1,0,0), TVector3(0,1,0))), ++planeId);
   fitTrack.insertPoint(new genfit::TrackPoint(measurement, &fitTrack));
 
   hitCoords[0] = -0.15;
   hitCoords[1] = 0;
-  measurement = new genfit::PlanarMeasurement(hitCoords, hitCov, detId, ++hitId, NULL);
+  measurement = new genfit::PlanarMeasurement(hitCoords, hitCov, detId, ++hitId, nullptr);
   measurement->setPlane(genfit::SharedPlanePtr(new genfit::DetPlane(TVector3(0,0,10), TVector3(1,0,0), TVector3(0,1,0))), ++planeId);
   fitTrack.insertPoint(new genfit::TrackPoint(measurement, &fitTrack));
 
   hitCoords[0] = -0.4;
   hitCoords[1] = 0;
-  measurement = new genfit::PlanarMeasurement(hitCoords, hitCov, detId, ++hitId, NULL);
+  measurement = new genfit::PlanarMeasurement(hitCoords, hitCov, detId, ++hitId, nullptr);
   measurement->setPlane(genfit::SharedPlanePtr(new genfit::DetPlane(TVector3(0,0,20), TVector3(1,0,0), TVector3(0,1,0))), ++planeId);
   fitTrack.insertPoint(new genfit::TrackPoint(measurement, &fitTrack));
 
 
 
   //check
-  assert(fitTrack.checkConsistency());
+  fitTrack.checkConsistency();
 
   // do the fit
   fitter->processTrack(&fitTrack);
@@ -99,7 +99,7 @@ int main() {
   fitTrack.getFittedState().Print();
 
   //check
-  assert(fitTrack.checkConsistency());
+  fitTrack.checkConsistency();
 
 
   display->addEvent(&fitTrack);
diff --git a/test/streamerTest/main.cc b/test/streamerTest/main.cc
index 81c505f8682912f2b4496f579946115834776d01..a4d06eacc0b64eb051b7c0118202a1f39b348319 100644
--- a/test/streamerTest/main.cc
+++ b/test/streamerTest/main.cc
@@ -34,14 +34,19 @@
 
 #define FILENAME "/tmp/streamerTest.root"
 
+constexpr bool verbose = false;
 
 bool emptyTrackTest()
 {
   TFile *f = TFile::Open(FILENAME, "RECREATE");
   f->cd();
   genfit::Track *t = new genfit::Track();
-  if (!t->checkConsistency())
+  try {
+    t->checkConsistency();
+  } catch (genfit::Exception) {
     return false;
+  }
+
   t->Write("direct");
   f->Close();
   delete t;
@@ -49,7 +54,14 @@ bool emptyTrackTest()
 
   f = TFile::Open(FILENAME, "READ");
   t = (genfit::Track*)f->Get("direct");
-  bool result = t->checkConsistency();
+
+  bool result = false;
+  try {
+    t->checkConsistency();
+    result = true;
+  } catch (genfit::Exception) {
+    result = false;
+  }
   delete t;
   delete f;
   return result;
@@ -176,7 +188,7 @@ int main() {
         genfit::TrackPoint* tp = new genfit::TrackPoint(measurements, fitTrack);
         // test scatterers
         genfit::ThinScatterer* sc = new genfit::ThinScatterer(genfit::SharedPlanePtr(new genfit::DetPlane(TVector3(1,1,1), TVector3(1,1,1))),
-                                                              genfit::MaterialProperties(1,2,3,4,5));
+                                                              genfit::Material(1,2,3,4,5));
         tp->setScatterer(sc);
 
         fitTrack->insertPoint(tp);
@@ -190,14 +202,12 @@ int main() {
       continue;
     }
 
-    //check
-    assert(fitTrack->checkConsistency());
+    fitTrack->checkConsistency();
 
     // do the fit
     fitter->processTrack(fitTrack);
 
-    //check
-    assert(fitTrack->checkConsistency());
+    fitTrack->checkConsistency();
 
 
     stateFinal.ResizeTo(fitTrack->getFittedState().getState());
@@ -254,9 +264,11 @@ int main() {
 
   for (Long_t nEntry = 0; nEntry < tResults->GetEntries(); ++nEntry) {
     tResults->GetEntry(nEntry);
-    //fitTrack->Print();
-    if (!fitTrack->checkConsistency()) {
-      std::cout << "stored track inconsistent" << std::endl;
+
+    try {
+      fitTrack->checkConsistency();
+    } catch (genfit::Exception& e) {
+      std::cout << e.getExcString() << std::endl;
       return 1;
     }
 
@@ -267,20 +279,23 @@ int main() {
         // track ok
       }
       else {
-        std::cout << "stored track not equal, small differences can occur if some info has been pruned." << std::endl;
-        pState->Print();
-        fitTrack->getFittedState().getState().Print();
-        pMatrix->Print();
-        fitTrack->getFittedState().getCov().Print();
-        plane->Print();
-        fitTrack->getFittedState().getPlane()->Print();
-
+        if (verbose) {
+          std::cout << "stored track not equal, small differences can occur if some info has been pruned." << std::endl;
+          pState->Print();
+          fitTrack->getFittedState().getState().Print();
+          pMatrix->Print();
+          fitTrack->getFittedState().getCov().Print();
+          plane->Print();
+          fitTrack->getFittedState().getPlane()->Print();
+          }
         ++fail;
         //return 1;
       }
     }
     catch (genfit::Exception& e) {
-      std::cerr << e.what();
+        if (verbose) {
+            std::cerr << e.what();
+        }
       return 1;
     }
   }
diff --git a/test/unitTests/main.cc b/test/unitTests/main.cc
index cad4ca54d5a9ea5df74607cf05f337515bb8f294..0296a7e861c574b8870b7672397152bf4885e4a2 100644
--- a/test/unitTests/main.cc
+++ b/test/unitTests/main.cc
@@ -68,6 +68,7 @@ enum e_testStatus {
   kException
 };
 
+constexpr bool verbose = false;
 
 void handler(int sig) {
   void *array[10];
@@ -135,7 +136,9 @@ e_testStatus compareMatrices(const TMatrixTBase<double>& A, const TMatrixTBase<d
       if ( fabs(absErr) > maxAbsErr ) {
         double relErr = A(i,j)/B(i,j) - 1;
         if ( fabs(relErr) > maxRelErr ) {
-          std::cout << "compareMatrices: A("<<i<<","<<j<<") = " << A(i,j) << "  B("<<i<<","<<j<<") = " << B(i,j) << "     absErr = " << absErr << "    relErr = " << relErr << "\n";
+          if (verbose)  {
+            std::cout << "compareMatrices: A("<<i<<","<<j<<") = " << A(i,j) << "  B("<<i<<","<<j<<") = " << B(i,j) << "     absErr = " << absErr << "    relErr = " << relErr << "\n";
+          }
           retVal = kFailed;
         }
       }
@@ -147,18 +150,24 @@ e_testStatus compareMatrices(const TMatrixTBase<double>& A, const TMatrixTBase<d
 e_testStatus isCovMatrix(TMatrixTBase<double>& cov) {
 
   if (!(cov.IsSymmetric())) {
-    std::cout << "isCovMatrix: not symmetric\n";
+    if (verbose) {
+      std::cout << "isCovMatrix: not symmetric\n";
+    }
     return kFailed;
   }
 
   for (int i=0; i<cov.GetNrows(); ++i) {
     for (int j=0; j<cov.GetNcols(); ++j) {
-       if (isnan(cov(i,j))) {
-         std::cout << "isCovMatrix: element isnan\n";
+       if (std::isnan(cov(i,j))) {
+         if (verbose) {
+           std::cout << "isCovMatrix: element isnan\n";
+         }
          return kFailed;
        }
        if (i==j && cov(i,j) < 0) {
-         std::cout << "isCovMatrix: negative diagonal element\n";
+         if (verbose) {
+           std::cout << "isCovMatrix: negative diagonal element\n";
+         }
          return kFailed;
        }
     }
@@ -210,7 +219,9 @@ e_testStatus checkSetGetPosMom(bool writeHisto = false) {
 
     // check if plane has changed
     if (state.getPlane() != plane) {
-      std::cout << "plane has changed unexpectedly! \n";
+        if (verbose) {
+          std::cout << "plane has changed unexpectedly! \n";
+        }
       delete rep;
       return kFailed;
     }
@@ -221,13 +232,13 @@ e_testStatus checkSetGetPosMom(bool writeHisto = false) {
   if ((pos - rep->getPos(state)).Mag() > epsilonLen ||
       (mom - rep->getMom(state)).Mag() > epsilonMom) {
 
-    state.Print();
-
-    std::cout << "pos difference = " << (pos - rep->getPos(state)).Mag() << "\n";
-    std::cout << "mom difference = " << (mom - rep->getMom(state)).Mag() << "\n";
-
-    std::cout << std::endl;
+    if (verbose) {
+      state.Print();
+      std::cout << "pos difference = " << (pos - rep->getPos(state)).Mag() << "\n";
+      std::cout << "mom difference = " << (mom - rep->getMom(state)).Mag() << "\n";
 
+      std::cout << std::endl;
+    }
     delete rep;
     return kFailed;
   }
@@ -328,11 +339,12 @@ e_testStatus compareForthBackExtrapolation(bool writeHisto = false) {
     //std::cout << "MomLoss = " << momLoss1 << "\n";
   }
   catch (genfit::Exception& e) {
-    std::cerr << "Exception in forth Extrapolation. PDG = " << pdg << "; mom: \n";
-    mom.Print();
-
-    std::cerr << e.what();
+    if (verbose) {
+      std::cerr << "Exception in forth Extrapolation. PDG = " << pdg << "; mom: \n";
+      mom.Print();
 
+      std::cerr << e.what();
+    }
     delete rep;
     return kException;
   }
@@ -361,11 +373,12 @@ e_testStatus compareForthBackExtrapolation(bool writeHisto = false) {
     //std::cout << "deviation = " << deviation << "\n";
   }
   catch (genfit::Exception& e) {
-    std::cerr << "Exception in back Extrapolation. PDG = " << pdg << "; mom:  \n";
-    mom.Print();
-    std::cerr << "mom2:  \n";
-    mom2.Print();
-
+    if (verbose) {
+      std::cerr << "Exception in back Extrapolation. PDG = " << pdg << "; mom:  \n";
+      mom.Print();
+      std::cerr << "mom2:  \n";
+      mom2.Print();
+    }
     std::cerr << e.what();
 
     delete rep;
@@ -377,15 +390,16 @@ e_testStatus compareForthBackExtrapolation(bool writeHisto = false) {
       (rep->getMom(origState) - rep->getMom(state)).Mag() > epsilonMom ||
       fabs(extrapLen + backExtrapLen) > epsilonLen) {
 
-    origState.Print();
-    state.Print();
-
-    std::cout << "pos difference = " << (rep->getPos(origState) - rep->getPos(state)).Mag() << "\n";
-    std::cout << "mom difference = " << (rep->getMom(origState) - rep->getMom(state)).Mag() << "\n";
-    std::cout << "len difference = " << extrapLen + backExtrapLen << "\n";
+    if (verbose) {
+        origState.Print();
+        state.Print();
 
-    std::cout << std::endl;
+        std::cout << "pos difference = " << (rep->getPos(origState) - rep->getPos(state)).Mag() << "\n";
+        std::cout << "mom difference = " << (rep->getMom(origState) - rep->getMom(state)).Mag() << "\n";
+        std::cout << "len difference = " << extrapLen + backExtrapLen << "\n";
 
+        std::cout << std::endl;
+    }
     delete rep;
     return kFailed;
   }
@@ -516,8 +530,10 @@ e_testStatus compareForthBackJacNoise(bool writeHisto = false) {
 
   // compare
   if (!((origState.getState() - state.getState()).Abs()  < deltaState) ) {
-    std::cout << "(origState.getState() - state.getState()) ";
-    (origState.getState() - state.getState()).Print();
+    if (verbose) {
+      std::cout << "(origState.getState() - state.getState()) ";
+      (origState.getState() - state.getState()).Print();
+    }
 
     retVal = kFailed;
   }
@@ -528,15 +544,16 @@ e_testStatus compareForthBackJacNoise(bool writeHisto = false) {
       !((jac_b * extrapolatedState.getState() + c_b  -  origState.getState()).Abs() < deltaState) ||
       !((jac_fi * extrapolatedState.getState() + c_fi  -  origState.getState()).Abs() < deltaState)   ) {
 
-    std::cout << "(jac_f * origState.getState() + c_f  -  extrapolatedState.getState()) ";
-    (jac_f * origState.getState() + c_f  -  extrapolatedState.getState()).Print();
-    std::cout << "(jac_bi * origState.getState() + c_bi  -  extrapolatedState.getState()) ";
-    (jac_bi * origState.getState() + c_bi  -  extrapolatedState.getState()).Print();
-    std::cout << "(jac_b * extrapolatedState.getState() + c_b  -  origState.getState()) ";
-    (jac_b * extrapolatedState.getState() + c_b  -  origState.getState()).Print();
-    std::cout << "(jac_fi * extrapolatedState.getState() + c_fi  -  origState.getState()) ";
-    (jac_fi * extrapolatedState.getState() + c_fi  -  origState.getState()).Print();
-
+    if (verbose) {
+      std::cout << "(jac_f * origState.getState() + c_f  -  extrapolatedState.getState()) ";
+      (jac_f * origState.getState() + c_f - extrapolatedState.getState()).Print();
+      std::cout << "(jac_bi * origState.getState() + c_bi  -  extrapolatedState.getState()) ";
+      (jac_bi * origState.getState() + c_bi - extrapolatedState.getState()).Print();
+      std::cout << "(jac_b * extrapolatedState.getState() + c_b  -  origState.getState()) ";
+      (jac_b * extrapolatedState.getState() + c_b - origState.getState()).Print();
+      std::cout << "(jac_fi * extrapolatedState.getState() + c_fi  -  origState.getState()) ";
+      (jac_fi * extrapolatedState.getState() + c_fi - origState.getState()).Print();
+    }
     retVal = kFailed;
   }
 
@@ -547,37 +564,49 @@ e_testStatus compareForthBackJacNoise(bool writeHisto = false) {
 
   // compare
   if (compareMatrices(jac_f, jac_bi, deltaJac) == kFailed) {
-    std::cout << "jac_f = "; jac_f.Print();
-    std::cout << "jac_bi = "; jac_bi.Print();
-    std::cout << std::endl;
-
+    if (verbose) {
+      std::cout << "jac_f = ";
+      jac_f.Print();
+      std::cout << "jac_bi = ";
+      jac_bi.Print();
+      std::cout << std::endl;
+    }
     retVal = kFailed;
   }
 
   // compare
   if (compareMatrices(jac_b, jac_fi, deltaJac) == kFailed) {
-    std::cout << "jac_b = "; jac_b.Print();
-    std::cout << "jac_fi = "; jac_fi.Print();
-    std::cout << std::endl;
-
+    if (verbose) {
+      std::cout << "jac_b = ";
+      jac_b.Print();
+      std::cout << "jac_fi = ";
+      jac_fi.Print();
+      std::cout << std::endl;
+    }
     retVal = kFailed;
   }
 
   // compare
   if (compareMatrices(noise_f, noise_bi, deltaNoise) == kFailed) {
-    std::cout << "noise_f = "; noise_f.Print();
-    std::cout << "noise_bi = "; noise_bi.Print();
-    std::cout << std::endl;
-
+    if (verbose) {
+      std::cout << "noise_f = ";
+      noise_f.Print();
+      std::cout << "noise_bi = ";
+      noise_bi.Print();
+      std::cout << std::endl;
+    }
     retVal = kFailed;
   }
 
   // compare
   if (compareMatrices(noise_b, noise_fi, deltaNoise) == kFailed) {
-    std::cout << "noise_b = "; noise_b.Print();
-    std::cout << "noise_fi = "; noise_fi.Print();
-    std::cout << std::endl;
-
+    if (verbose) {
+      std::cout << "noise_b = ";
+      noise_b.Print();
+      std::cout << "noise_fi = ";
+      noise_fi.Print();
+      std::cout << std::endl;
+    }
     retVal = kFailed;
   }
 
@@ -585,10 +614,13 @@ e_testStatus compareForthBackJacNoise(bool writeHisto = false) {
   if (!fx) {
     // compare
     if (compareMatrices(jac_f, jac_f_num, deltaJac) == kFailed) {
-      std::cout << "jac_f = "; jac_f.Print();
-      std::cout << "jac_f_num = "; jac_f_num.Print();
-      std::cout << std::endl;
-
+      if (verbose) {
+        std::cout << "jac_f = ";
+        jac_f.Print();
+        std::cout << "jac_f_num = ";
+        jac_f_num.Print();
+        std::cout << std::endl;
+      }
       retVal = kFailed;
     }
   }
@@ -642,14 +674,14 @@ e_testStatus checkStopAtBoundary(bool writeHisto = false) {
 
   // compare
   if (fabs(rep->getPos(state).Perp() - matRadius) > epsilonLen) {
+      if (verbose) {
+        origState.Print();
+        state.Print();
 
-      origState.Print();
-      state.Print();
-
-      std::cerr << "radius difference = " << rep->getPos(state).Perp() - matRadius << "\n";
-
-      std::cerr << std::endl;
+        std::cerr << "radius difference = " << rep->getPos(state).Perp() - matRadius << "\n";
 
+        std::cerr << std::endl;
+      }
       delete rep;
       return kFailed;
     }
@@ -700,10 +732,10 @@ e_testStatus checkErrorPropagation(bool writeHisto = false) {
 
   // check
   if (isCovMatrix(state.getCov()) == kFailed) {
-
-    origState.Print();
-    state.Print();
-
+    if (verbose) {
+      origState.Print();
+      state.Print();
+    }
     delete rep;
     return kFailed;
   }
@@ -758,13 +790,15 @@ e_testStatus checkExtrapolateToLine(bool writeHisto = false) {
       fabs(state.getPlane()->distance(linePoint+lineDirection)) > epsilonLen ||
       (rep->getMom(state).Unit() * state.getPlane()->getNormal()) > epsilonMom) {
 
-      origState.Print();
-      state.Print();
-
-      std::cout << "distance of linePoint to plane = " << state.getPlane()->distance(linePoint) << "\n";
-      std::cout << "distance of linePoint+lineDirection to plane = " << state.getPlane()->distance(linePoint+lineDirection) << "\n";
-      std::cout << "direction * plane normal = " << rep->getMom(state).Unit() * state.getPlane()->getNormal() << "\n";
+      if (verbose) {
+        origState.Print();
+        state.Print();
 
+        std::cout << "distance of linePoint to plane = " << state.getPlane()->distance(linePoint) << "\n";
+        std::cout << "distance of linePoint+lineDirection to plane = "
+                  << state.getPlane()->distance(linePoint + lineDirection) << "\n";
+        std::cout << "direction * plane normal = " << rep->getMom(state).Unit() * state.getPlane()->getNormal() << "\n";
+      }
       delete rep;
       return kFailed;
     }
@@ -816,13 +850,13 @@ e_testStatus checkExtrapolateToPoint(bool writeHisto = false) {
   // compare
   if (fabs(state.getPlane()->distance(point)) > epsilonLen ||
       fabs((rep->getMom(state).Unit() * state.getPlane()->getNormal())) - 1 > epsilonMom) {
+      if (verbose) {
+        origState.Print();
+        state.Print();
 
-      origState.Print();
-      state.Print();
-
-      std::cout << "distance of point to plane = " << state.getPlane()->distance(point) << "\n";
-      std::cout << "direction * plane normal = " << rep->getMom(state).Unit() * state.getPlane()->getNormal() << "\n";
-
+        std::cout << "distance of point to plane = " << state.getPlane()->distance(point) << "\n";
+        std::cout << "direction * plane normal = " << rep->getMom(state).Unit() * state.getPlane()->getNormal() << "\n";
+      }
       delete rep;
       return kFailed;
     }
@@ -884,13 +918,13 @@ e_testStatus checkExtrapolateToCylinder(bool writeHisto = false) {
   if (fabs(state.getPlane()->getNormal()*radiusVec.Unit())-1 > epsilonLen ||
       fabs(lineDirection*radiusVec) > epsilonLen ||
       fabs(radiusVec.Mag()-radius) > epsilonLen) {
+      if (verbose) {
+        origState.Print();
+        state.Print();
 
-      origState.Print();
-      state.Print();
-
-      std::cout << "lineDirection*radiusVec = " << lineDirection*radiusVec << "\n";
-      std::cout << "radiusVec.Mag()-radius = " << radiusVec.Mag()-radius << "\n";
-
+        std::cout << "lineDirection*radiusVec = " << lineDirection * radiusVec << "\n";
+        std::cout << "radiusVec.Mag()-radius = " << radiusVec.Mag() - radius << "\n";
+      }
       delete rep;
       return kFailed;
     }
@@ -946,13 +980,13 @@ e_testStatus checkExtrapolateToSphere(bool writeHisto = false) {
   // compare
   if (fabs(state.getPlane()->getNormal()*radiusVec.Unit())-1 > epsilonLen ||
       fabs(radiusVec.Mag()-radius) > epsilonLen) {
+      if (verbose) {
+        origState.Print();
+        state.Print();
 
-      origState.Print();
-      state.Print();
-
-      std::cout << "state.getPlane()->getNormal()*radiusVec = " << state.getPlane()->getNormal()*radiusVec << "\n";
-      std::cout << "radiusVec.Mag()-radius = " << radiusVec.Mag()-radius << "\n";
-
+        std::cout << "state.getPlane()->getNormal()*radiusVec = " << state.getPlane()->getNormal() * radiusVec << "\n";
+        std::cout << "radiusVec.Mag()-radius = " << radiusVec.Mag() - radius << "\n";
+      }
       delete rep;
       return kFailed;
     }
@@ -1007,15 +1041,18 @@ e_testStatus checkExtrapolateBy(bool writeHisto = false) {
   // compare
   if (fabs(extrapolatedLen-step) > epsilonLen ||
       (posOrig - posExt).Mag() > fabs(step)) {
-
-      origState.Print();
-      state.Print();
-
-      std::cout << "extrapolatedLen-step = " << extrapolatedLen-step << "\n";
-      std::cout << "started extrapolation from: "; posOrig.Print();
-      std::cout << "extrapolated to "; posExt.Print();
-      std::cout << "difference = " << (posOrig - posExt).Mag() << "; step = " << step << "; delta = " <<  (posOrig - posExt).Mag() - fabs(step) << "\n";
-
+      if (verbose) {
+        origState.Print();
+        state.Print();
+
+        std::cout << "extrapolatedLen-step = " << extrapolatedLen - step << "\n";
+        std::cout << "started extrapolation from: ";
+        posOrig.Print();
+        std::cout << "extrapolated to ";
+        posExt.Print();
+        std::cout << "difference = " << (posOrig - posExt).Mag() << "; step = " << step << "; delta = "
+                  << (posOrig - posExt).Mag() - fabs(step) << "\n";
+      }
       delete rep;
       return kFailed;
     }
diff --git a/test/vertexingTest/read.cc b/test/vertexingTest/read.cc
index 6a2174d380afa54c3301d7ed39b89f2678b1703d..748a773630ba542daba52675656dfce79ba75929 100644
--- a/test/vertexingTest/read.cc
+++ b/test/vertexingTest/read.cc
@@ -20,8 +20,8 @@ int main() {
 
   genfit::Track tr; // pull in genfit libraries
 
-  //genfit::Track* aTrackPtr(NULL);
-  genfit::GFRaveVertex* aVertexPtr(NULL);
+  //genfit::Track* aTrackPtr(nullptr);
+  genfit::GFRaveVertex* aVertexPtr(nullptr);
 
   TFile* trackFile = TFile::Open("tracks.root", "READ");
   if (!trackFile) {
diff --git a/trackReps/include/AbsMaterialInterface.h b/trackReps/include/AbsMaterialInterface.h
index dd74e0e4b1b353afcf239883de2984650c0f9f04..f99e5826ee14ed6787cfeea2e1951af4e08dc2f3 100644
--- a/trackReps/include/AbsMaterialInterface.h
+++ b/trackReps/include/AbsMaterialInterface.h
@@ -25,7 +25,7 @@
 #define genfit_AbsMaterialInterface_h
 
 #include "RKTrackRep.h"
-#include "MaterialProperties.h"
+#include "Material.h"
 
 #include <TObject.h>
 #include <TVector3.h>
@@ -48,15 +48,11 @@ class AbsMaterialInterface : public TObject {
   virtual bool initTrack(double posX, double posY, double posZ,
                          double dirX, double dirY, double dirZ) = 0;
 
-  /** @brief Get material parameters in current material
+  /***
+   * Get the material paramaters in the current material.
+   * @return
    */
-  virtual void getMaterialParameters(double& density,
-                                     double& Z,
-                                     double& A,
-                                     double& radiationLength,
-                                     double& mEE) = 0;
-
-  virtual void getMaterialParameters(MaterialProperties& parameters) = 0;
+  virtual Material getMaterialParameters() = 0;
 
   /** @brief Make a step until maxStep or the next boundary is reached.
    *
diff --git a/trackReps/include/MaterialEffects.h b/trackReps/include/MaterialEffects.h
index cdcd604e29c8660a2cb2a5fe07affcbceff38702..c4ab7e36577080d9ccde56f5367a0df6a43bb724 100644
--- a/trackReps/include/MaterialEffects.h
+++ b/trackReps/include/MaterialEffects.h
@@ -101,7 +101,7 @@ public:
                const double& mom, // momentum
                double& relMomLoss, // relative momloss for the step will be added
                const int& pdg,
-               MaterialProperties& currentMaterial,
+               Material& currentMaterial,
                StepLimits& limits,
                bool varField = true);
 
diff --git a/trackReps/include/RKTools.h b/trackReps/include/RKTools.h
index 681222cf97ed5479fe04dcf3d76c5c1e2d57e189..8437f166cb1a916b2019c6a833129610e003adfa 100644
--- a/trackReps/include/RKTools.h
+++ b/trackReps/include/RKTools.h
@@ -76,10 +76,6 @@ namespace RKTools {
   void J_MpTxcov7xJ_Mp(const M7x5& J_Mp, const M7x7& cov7, M5x5& out5);
   void J_MpTxcov6xJ_Mp(const M6x5& J_Mp, const M6x6& cov6, M5x5& out5);
 
-  void J_MMTxcov7xJ_MM(const M7x7& J_MM, M7x7& cov7);
-
-  void J_MMxJ_MM(M7x7& J_MM, const M7x7& J_MM_old);
-
   void J_pMTTxJ_MMTTxJ_MpTT(const M7x5& J_pMT, const M7x7& J_MMT, const M5x7& J_MpT, M5x5& J_pp);
 
   void Np_N_NpT(const M7x7& Np, M7x7& N);
diff --git a/trackReps/include/RKTrackRep.h b/trackReps/include/RKTrackRep.h
index 945171414815c283b1f5c3878a74314460e5ef81..a58158de9a7b7c64a1e50b57e3acf2e9ac503a27 100644
--- a/trackReps/include/RKTrackRep.h
+++ b/trackReps/include/RKTrackRep.h
@@ -28,6 +28,7 @@
 #include "StateOnPlane.h"
 #include "RKTools.h"
 #include "StepLimits.h"
+#include "Material.h"
 
 #include <algorithm>
 
@@ -56,7 +57,7 @@ struct ExtrapStep {
 
   ExtrapStep() {
     std::fill(jac7_.begin(), jac7_.end(), 0);
-    std::fill(noise7_.begin(), jac7_.end(), 0);
+    std::fill(noise7_.begin(), noise7_.end(), 0);
   }
 };
 
@@ -69,7 +70,10 @@ struct ExtrapStep {
  * u and v are positions on a DetPlane.
  */
 class RKTrackRep : public AbsTrackRep {
-
+    friend class RKTrackRepTests_momMag_Test;
+    friend class RKTrackRepTests_calcForwardJacobianAndNoise_Test;
+    friend class RKTrackRepTests_getState7_Test;
+    friend class RKTrackRepTests_getState5_Test;
 
  public:
 
@@ -78,12 +82,12 @@ class RKTrackRep : public AbsTrackRep {
 
   virtual ~RKTrackRep();
 
-  virtual AbsTrackRep* clone() const {return new RKTrackRep(*this);}
+  virtual AbsTrackRep* clone() const override {return new RKTrackRep(*this);}
 
   virtual double extrapolateToPlane(StateOnPlane& state,
       const SharedPlanePtr& plane,
       bool stopAtBoundary = false,
-      bool calcJacobianNoise = false) const;
+      bool calcJacobianNoise = false) const override;
 
   using AbsTrackRep::extrapolateToLine;
 
@@ -91,20 +95,20 @@ class RKTrackRep : public AbsTrackRep {
       const TVector3& linePoint,
       const TVector3& lineDirection,
       bool stopAtBoundary = false,
-      bool calcJacobianNoise = false) const;
+      bool calcJacobianNoise = false) const override;
 
   virtual double extrapolateToPoint(StateOnPlane& state,
       const TVector3& point,
       bool stopAtBoundary = false,
-      bool calcJacobianNoise = false) const {
-    return extrapToPoint(state, point, NULL, stopAtBoundary, calcJacobianNoise);
+      bool calcJacobianNoise = false) const override {
+    return extrapToPoint(state, point, nullptr, stopAtBoundary, calcJacobianNoise);
   }
 
   virtual double extrapolateToPoint(StateOnPlane& state,
       const TVector3& point,
       const TMatrixDSym& G, // weight matrix (metric)
       bool stopAtBoundary = false,
-      bool calcJacobianNoise = false) const {
+      bool calcJacobianNoise = false) const override {
     return extrapToPoint(state, point, &G, stopAtBoundary, calcJacobianNoise);
   }
 
@@ -113,7 +117,7 @@ class RKTrackRep : public AbsTrackRep {
       const TVector3& linePoint = TVector3(0.,0.,0.),
       const TVector3& lineDirection = TVector3(0.,0.,1.),
       bool stopAtBoundary = false,
-      bool calcJacobianNoise = false) const;
+      bool calcJacobianNoise = false) const override;
 
   
   virtual double extrapolateToCone(StateOnPlane& state,
@@ -121,61 +125,61 @@ class RKTrackRep : public AbsTrackRep {
       const TVector3& linePoint = TVector3(0.,0.,0.),
       const TVector3& lineDirection = TVector3(0.,0.,1.),
       bool stopAtBoundary = false,
-      bool calcJacobianNoise = false) const;
+      bool calcJacobianNoise = false) const override ;
 
   virtual double extrapolateToSphere(StateOnPlane& state,
       double radius,
       const TVector3& point = TVector3(0.,0.,0.),
       bool stopAtBoundary = false,
-      bool calcJacobianNoise = false) const;
+      bool calcJacobianNoise = false) const override;
 
   virtual double extrapolateBy(StateOnPlane& state,
       double step,
       bool stopAtBoundary = false,
-      bool calcJacobianNoise = false) const;
+      bool calcJacobianNoise = false) const override;
 
 
-  unsigned int getDim() const {return 5;}
+  unsigned int getDim() const override {return 5;}
 
-  virtual TVector3 getPos(const StateOnPlane& state) const;
+  virtual TVector3 getPos(const StateOnPlane& state) const override;
 
-  virtual TVector3 getMom(const StateOnPlane& state) const;
-  virtual void getPosMom(const StateOnPlane& state, TVector3& pos, TVector3& mom) const;
+  virtual TVector3 getMom(const StateOnPlane& state) const override;
+  virtual void getPosMom(const StateOnPlane& state, TVector3& pos, TVector3& mom) const override;
 
-  virtual double getMomMag(const StateOnPlane& state) const;
-  virtual double getMomVar(const MeasuredStateOnPlane& state) const;
+  virtual double getMomMag(const StateOnPlane& state) const override;
+  virtual double getMomVar(const MeasuredStateOnPlane& state) const override;
 
-  virtual TMatrixDSym get6DCov(const MeasuredStateOnPlane& state) const;
-  virtual void getPosMomCov(const MeasuredStateOnPlane& state, TVector3& pos, TVector3& mom, TMatrixDSym& cov) const;
-  virtual double getCharge(const StateOnPlane& state) const;
-  virtual double getQop(const StateOnPlane& state) const {return state.getState()(0);}
+  virtual TMatrixDSym get6DCov(const MeasuredStateOnPlane& state) const override;
+  virtual void getPosMomCov(const MeasuredStateOnPlane& state, TVector3& pos, TVector3& mom, TMatrixDSym& cov) const override;
+  virtual double getCharge(const StateOnPlane& state) const override;
+  virtual double getQop(const StateOnPlane& state) const override {return state.getState()(0);}
   double getSpu(const StateOnPlane& state) const;
-  double getTime(const StateOnPlane& state) const;
+  double getTime(const StateOnPlane& state) const override;
 
-  virtual void getForwardJacobianAndNoise(TMatrixD& jacobian, TMatrixDSym& noise, TVectorD& deltaState) const;
+  virtual void getForwardJacobianAndNoise(TMatrixD& jacobian, TMatrixDSym& noise, TVectorD& deltaState) const override;
 
-  virtual void getBackwardJacobianAndNoise(TMatrixD& jacobian, TMatrixDSym& noise, TVectorD& deltaState) const;
+  virtual void getBackwardJacobianAndNoise(TMatrixD& jacobian, TMatrixDSym& noise, TVectorD& deltaState) const override;
 
-  std::vector<genfit::MatStep> getSteps() const;
+  std::vector<genfit::MatStep> getSteps() const override;
 
-  virtual double getRadiationLenght() const;
+  virtual double getRadiationLenght() const override;
 
-  virtual void setPosMom(StateOnPlane& state, const TVector3& pos, const TVector3& mom) const;
-  virtual void setPosMom(StateOnPlane& state, const TVectorD& state6) const;
-  virtual void setPosMomErr(MeasuredStateOnPlane& state, const TVector3& pos, const TVector3& mom, const TVector3& posErr, const TVector3& momErr) const;
-  virtual void setPosMomCov(MeasuredStateOnPlane& state, const TVector3& pos, const TVector3& mom, const TMatrixDSym& cov6x6) const;
-  virtual void setPosMomCov(MeasuredStateOnPlane& state, const TVectorD& state6, const TMatrixDSym& cov6x6) const;
+  virtual void setPosMom(StateOnPlane& state, const TVector3& pos, const TVector3& mom) const override;
+  virtual void setPosMom(StateOnPlane& state, const TVectorD& state6) const override;
+  virtual void setPosMomErr(MeasuredStateOnPlane& state, const TVector3& pos, const TVector3& mom, const TVector3& posErr, const TVector3& momErr) const override;
+  virtual void setPosMomCov(MeasuredStateOnPlane& state, const TVector3& pos, const TVector3& mom, const TMatrixDSym& cov6x6) const override;
+  virtual void setPosMomCov(MeasuredStateOnPlane& state, const TVectorD& state6, const TMatrixDSym& cov6x6) const override;
 
-  virtual void setChargeSign(StateOnPlane& state, double charge) const;
-  virtual void setQop(StateOnPlane& state, double qop) const {state.getState()(0) = qop;}
+  virtual void setChargeSign(StateOnPlane& state, double charge) const override;
+  virtual void setQop(StateOnPlane& state, double qop) const override {state.getState()(0) = qop;}
 
   void setSpu(StateOnPlane& state, double spu) const;
-  void setTime(StateOnPlane& state, double time) const;
+  void setTime(StateOnPlane& state, double time) const override;
 
   //! The actual Runge Kutta propagation
   /** propagate state7 with step S. Fills SA (Start directions derivatives dA/S).
    *  This is a single Runge-Kutta step.
-   *  If jacobian is NULL, only the state is propagated,
+   *  If jacobian is nullptr, only the state is propagated,
    *  otherwise also the 7x7 jacobian is calculated.
    *  If varField is false, the magnetic field will only be evaluated at the starting position.
    *  The return value is an estimation on how good the extrapolation is, and it is usually fine if it is > 1.
@@ -188,8 +192,8 @@ class RKTrackRep : public AbsTrackRep {
                      bool varField = true,
                      bool calcOnlyLastRowOfJ = false) const;
 
-  virtual bool isSameType(const AbsTrackRep* other);
-  virtual bool isSame(const AbsTrackRep* other);
+  virtual bool isSameType(const AbsTrackRep* other) override;
+  virtual bool isSame(const AbsTrackRep* other) override;
 
  private:
 
@@ -197,25 +201,18 @@ class RKTrackRep : public AbsTrackRep {
 
   virtual double extrapToPoint(StateOnPlane& state,
       const TVector3& point,
-      const TMatrixDSym* G = NULL, // weight matrix (metric)
+      const TMatrixDSym* G = nullptr, // weight matrix (metric)
       bool stopAtBoundary = false,
       bool calcJacobianNoise = false) const;
 
   void getState7(const StateOnPlane& state, M1x7& state7) const;
   void getState5(StateOnPlane& state, const M1x7& state7) const; // state7 must already lie on plane of state!
 
-  void transformPM7(const MeasuredStateOnPlane& state,
-                    M7x7& out7x7) const;
-
   void calcJ_pM_5x7(M5x7& J_pM, const TVector3& U, const TVector3& V, const M1x3& pTilde, double spu) const;
 
   void transformPM6(const MeasuredStateOnPlane& state,
                     M6x6& out6x6) const;
 
-  void transformM7P(const M7x7& in7x7,
-                    const M1x7& state7,
-                    MeasuredStateOnPlane& state) const; // plane must already be set!
-
   void calcJ_Mp_7x5(M7x5& J_Mp, const TVector3& U, const TVector3& V, const TVector3& W, const M1x3& A) const;
 
   void calcForwardJacobianAndNoise(const M1x7& startState7, const DetPlane& startPlane,
@@ -228,7 +225,7 @@ class RKTrackRep : public AbsTrackRep {
   //! Propagates the particle through the magnetic field.
   /** If the propagation is successful and the plane is reached, the function returns true.
     * Propagated state and the jacobian of the extrapolation are written to state7 and jacobianT.
-    * The jacobian is only calculated if jacobianT != NULL.
+    * The jacobian is only calculated if jacobianT != nullptr.
     * In the main loop of the Runge Kutta algorithm, the estimateStep() is called
     * and may reduce the estimated stepsize so that a maximum momentum loss will not be exceeded,
     * and stop at material boundaries.
@@ -310,7 +307,7 @@ class RKTrackRep : public AbsTrackRep {
 
  public:
 
-  ClassDef(RKTrackRep, 1)
+  ClassDefOverride(RKTrackRep, 1)
 
 };
 
diff --git a/trackReps/include/TGeoMaterialInterface.h b/trackReps/include/TGeoMaterialInterface.h
index 36b9a6612e313a7c0b638df016e1764784e7f0cf..0be8a459642fac7b8b944c567ab825e34cbf2254 100644
--- a/trackReps/include/TGeoMaterialInterface.h
+++ b/trackReps/include/TGeoMaterialInterface.h
@@ -43,17 +43,9 @@ class TGeoMaterialInterface : public AbsMaterialInterface {
       direction.  Returns true if the volume changed.
    */
   bool initTrack(double posX, double posY, double posZ,
-                 double dirX, double dirY, double dirZ);
+                 double dirX, double dirY, double dirZ) override;
 
-  /** @brief Get material parameters in current material
-   */
-  void getMaterialParameters(double& density,
-                             double& Z,
-                             double& A,
-                             double& radiationLength,
-                             double& mEE);
-
-  void getMaterialParameters(MaterialProperties& parameters);
+  Material getMaterialParameters() override;
 
   /** @brief Make a step (following the curvature) until step length
    * sMax or the next boundary is reached.  After making a step to a
@@ -64,9 +56,9 @@ class TGeoMaterialInterface : public AbsMaterialInterface {
   double findNextBoundary(const RKTrackRep* rep,
                           const M1x7& state7,
                           double sMax,
-                          bool varField = true);
+                          bool varField = true) override;
 
-  // ClassDef(TGeoMaterialInterface, 1);
+  // ClassDefOverride(TGeoMaterialInterface, 1);
 
  private:
 };
diff --git a/trackReps/src/MaterialEffects.cc b/trackReps/src/MaterialEffects.cc
index 5a0f2d90d537dc97b21c7634997767b01c0f7bfd..24cd3fbc7ec496e671980b46910f1af2d41f5324 100644
--- a/trackReps/src/MaterialEffects.cc
+++ b/trackReps/src/MaterialEffects.cc
@@ -158,7 +158,7 @@ double MaterialEffects::effects(const std::vector<RKStep>& steps,
         debugOut << "and noise";
       debugOut << " for ";
       debugOut << "stepSize = " << it->matStep_.stepSize_ << "\t";
-      it->matStep_.materialProperties_.Print();
+      it->matStep_.material_.Print();
     }
 
     double stepSign(1.);
@@ -167,7 +167,14 @@ double MaterialEffects::effects(const std::vector<RKStep>& steps,
     realPath = fabs(realPath);
     stepSize_ = realPath;
 
-    it->matStep_.materialProperties_.getMaterialProperties(matDensity_, matZ_, matA_, radiationLength_, mEE_);
+
+    const Material& currentMaterial = it->matStep_.material_;
+    matDensity_ = currentMaterial.density;
+    matZ_ = currentMaterial.Z;
+    matA_ = currentMaterial.A;
+    radiationLength_ = currentMaterial.radiationLength;
+    mEE_ = currentMaterial.mEE;
+
 
     if (matZ_ > 1.E-3) { // don't calculate energy loss for vacuum
 
@@ -208,7 +215,7 @@ void MaterialEffects::stepper(const RKTrackRep* rep,
                               const double& mom, // momentum
                               double& relMomLoss, // relative momloss for the step will be added
                               const int& pdg,
-                              MaterialProperties& currentMaterial,
+                              Material& currentMaterial,
                               StepLimits& limits,
                               bool varField)
 {
@@ -261,9 +268,13 @@ void MaterialEffects::stepper(const RKTrackRep* rep,
   materialInterface_->initTrack(state7[0], state7[1], state7[2],
                                 limits.getStepSign() * state7[3], limits.getStepSign() * state7[4], limits.getStepSign() * state7[5]);
 
-  materialInterface_->getMaterialParameters(matDensity_, matZ_, matA_, radiationLength_, mEE_);
-  currentMaterial.setMaterialProperties(matDensity_, matZ_, matA_, radiationLength_, mEE_);
 
+  currentMaterial = materialInterface_->getMaterialParameters();
+  matDensity_ = currentMaterial.density;
+  matZ_ = currentMaterial.Z;
+  matA_ = currentMaterial.A;
+  radiationLength_ = currentMaterial.radiationLength;
+  mEE_ = currentMaterial.mEE;
 
   if (debugLvl_ > 0) {
     debugOut << "     currentMaterial "; currentMaterial.Print();
@@ -290,7 +301,6 @@ void MaterialEffects::stepper(const RKTrackRep* rep,
   sMax = limits.getLowestLimitSignedVal();
 
   stepSize_ = limits.getStepSign() * minStep;
-  MaterialProperties materialAfter;
   M1x3 SA;
   double boundaryStep(sMax);
 
@@ -320,7 +330,7 @@ void MaterialEffects::stepper(const RKTrackRep* rep,
       break;
 
     // propagate with found step to boundary
-    rep->RKPropagate(state7, NULL, SA, step, varField);
+    rep->RKPropagate(state7, nullptr, SA, step, varField);
 
     // make minStep to cross boundary
     state7[0] += limits.getStepSign() * minStep * state7[3];
@@ -330,7 +340,7 @@ void MaterialEffects::stepper(const RKTrackRep* rep,
     materialInterface_->initTrack(state7[0], state7[1], state7[2],
                                   limits.getStepSign() * state7[3], limits.getStepSign() * state7[4], limits.getStepSign() * state7[5]);
 
-    materialInterface_->getMaterialParameters(materialAfter);
+    Material materialAfter = materialInterface_->getMaterialParameters();
 
     if (debugLvl_ > 0) {
       debugOut << "     material after step: "; materialAfter.Print();
@@ -477,7 +487,7 @@ double MaterialEffects::dEdxBetheBloch(double betaSquare, double gamma, double g
 
 void MaterialEffects::noiseBetheBloch(M7x7& noise, double mom, double betaSquare, double gamma, double gammaSquare) const
 {
-  // Code ported from GEANT 3
+  // Code ported from GEANT 3 (erland.F)
 
   // ENERGY LOSS FLUCTUATIONS; calculate sigma^2(E);
   double sigma2E ( 0. );
@@ -609,7 +619,7 @@ void MaterialEffects::noiseCoulomb(M7x7& noise,
 double MaterialEffects::dEdxBrems(double mom) const
 {
 
-  // Code ported from GEANT 3
+  // Code ported from GEANT 3 (gbrele.F)
 
   if (abs(pdg_) != 11) return 0; // only for electrons and positrons
 
@@ -630,21 +640,24 @@ double MaterialEffects::dEdxBrems(double mom) const
   if (BCUT > 0.) {
     double T, kc;
 
-    if (BCUT >= mom) BCUT = mom; // confine BCUT to mom_
+    if (BCUT > mom) BCUT = mom; // confine BCUT to mom_
 
     // T=mom_,  confined to THIGH
     // kc=BCUT, confined to CHIGH ??
-    if (mom >= THIGH) {
+    if (mom > THIGH) {
       T = THIGH;
-      if (BCUT >= THIGH) kc = CHIGH;
-      else kc = BCUT;
+      if (BCUT >= THIGH)
+        kc = CHIGH;
+      else
+        kc = BCUT;
     } else {
       T = mom;
       kc = BCUT;
     }
 
     double E = T + me_; // total electron energy
-    if (BCUT > T) kc = T;
+    if (BCUT > T)
+      kc = T;
 
     double X = log(T / me_);
     double Y = log(kc / (E * vl));
@@ -657,21 +670,22 @@ double MaterialEffects::dEdxBrems(double mom) const
       XX = 1.;
       for (unsigned int J = 1; J <= 6; ++J) {
         K = 6 * I + J - 6;
-        S = S + C[K] * XX * YY;
-        XX = XX * X;
+        S += C[K] * XX * YY;
+        XX *= X;
       }
-      YY = YY * Y;
+      YY *= Y;
     }
 
     for (unsigned int I = 3; I <= 6; ++I) {
       XX = 1.;
       for (unsigned int J = 1; J <= 6; ++J) {
         K = 6 * I + J - 6;
-        if (Y <= 0.) S = S + C[K] * XX * YY;
-        else      S = S + C[K + 24] * XX * YY;
-        XX = XX * X;
+        if (Y > 0.)
+          K += 24;
+        S += C[K] * XX * YY;
+        XX *= X;
       }
-      YY = YY * Y;
+      YY *= Y;
     }
 
     double SS = 0.;
@@ -681,24 +695,25 @@ double MaterialEffects::dEdxBrems(double mom) const
       XX = 1.;
       for (unsigned int J = 1; J <= 5; ++J) {
         K = 5 * I + J + 55;
-        SS = SS + C[K] * XX * YY;
-        XX = XX * X;
+        SS += C[K] * XX * YY;
+        XX *= X;
       }
-      YY = YY * Y;
+      YY *= Y;
     }
 
     for (unsigned int I = 3; I <= 5; ++I) {
       XX = 1.;
       for (unsigned int J = 1; J <= 5; ++J) {
         K = 5 * I + J + 55;
-        if (Y <= 0.) SS = SS + C[K] * XX * YY;
-        else      SS = SS + C[K + 15] * XX * YY;
-        XX = XX * X;
+        if (Y > 0.)
+          K += 15;
+        SS += C[K] * XX * YY;
+        XX *= X;
       }
-      YY = YY * Y;
+      YY *= Y;
     }
 
-    S = S + matZ_ * SS;
+    S += matZ_ * SS;
 
     if (S > 0.) {
       double CORR = 1.;
@@ -710,12 +725,12 @@ double MaterialEffects::dEdxBrems(double mom) const
       // REALLY slow and we don't need ultimate numerical precision
       // for this approximation.
       double FAC = matZ_ * (matZ_ + xi) * E * E / (E + me_);
-      if (beta == 1.) {  // That is the #ifdef BETHE case
-  FAC *= kc * CORR / T;
-      } else {
-  FAC *= exp(beta * log(kc * CORR / T));
-      }
-      if (FAC <= 0.) return 0.;
+      if (beta == 1.)  // That is the #ifdef BETHE case
+        FAC *= kc * CORR / T;
+      else
+        FAC *= exp(beta * log(kc * CORR / T));
+      if (FAC <= 0.)
+        return 0.;
       dedxBrems = FAC * S;
 
 
@@ -725,21 +740,22 @@ double MaterialEffects::dEdxBrems(double mom) const
           RAT = BCUT / mom;
           S = (1. - 0.5 * RAT + 2.*RAT * RAT / 9.);
           RAT = BCUT / T;
-          S = S / (1. - 0.5 * RAT + 2.*RAT * RAT / 9.);
+          S /= 1. - 0.5 * RAT + 2.*RAT * RAT / 9.;
         } else {
           RAT = BCUT / mom;
           S = BCUT * (1. - 0.5 * RAT + 2.*RAT * RAT / 9.);
           RAT = kc / T;
-          S = S / (kc * (1. - 0.5 * RAT + 2.*RAT * RAT / 9.));
+          S /= kc * (1. - 0.5 * RAT + 2.*RAT * RAT / 9.);
         }
-        dedxBrems = dedxBrems * S; // GeV barn
+        dedxBrems *= S; // GeV barn
       }
 
-      dedxBrems = 0.60221367 * matDensity_ * dedxBrems / matA_; // energy loss dE/dx [GeV/cm]
+      dedxBrems *= 0.60221367 * matDensity_ / matA_; // energy loss dE/dx [GeV/cm]
     }
   }
 
-  if (dedxBrems < 0.) dedxBrems = 0;
+  if (dedxBrems < 0.)
+    dedxBrems = 0;
 
   double factor = 1.; // positron correction factor
 
@@ -758,13 +774,18 @@ double MaterialEffects::dEdxBrems(double mom) const
       }
     }
 
-    if (ETA < 0.0001) factor = 1.E-10;
-    else if (ETA > 0.9999) factor = 1.;
+    if (ETA < 0.0001)
+      factor = 1.E-10;
+    else if (ETA > 0.9999)
+      factor = 1.;
     else {
       double E0 = BCUT / mom;
-      if (E0 > 1.) E0 = 1.;
-      if (E0 < 1.E-8) factor = 1.;
-      else factor = ETA * (1. - pow(1. - E0, 1. / ETA)) / E0;
+      if (E0 > 1.)
+        E0 = 1.;
+      if (E0 < 1.E-8)
+        factor = 1.;
+      else
+        factor = ETA * (1. - pow(1. - E0, 1. / ETA)) / E0;
     }
   }
 
@@ -774,21 +795,19 @@ double MaterialEffects::dEdxBrems(double mom) const
 
 void MaterialEffects::noiseBrems(M7x7& noise, double momSquare, double betaSquare) const
 {
-
-  // Code ported from GEANT 3 and simplified
-  // this formula assumes p >> m and therefore p^2 + m^2 = p^2
-  // the factor  1.44 is not in the original Behte-Heitler model.
+  // Code ported from GEANT 3 (erland.F) and simplified
+  // E \approx p is assumed.
+  // the factor  1.44 is not in the original Bethe-Heitler model.
   // It seems to be some empirical correction copied over from some other project.
 
   if (abs(pdg_) != 11) return; // only for electrons and positrons
 
   double minusXOverLn2  = -1.442695 * fabs(stepSize_) / radiationLength_;
-  double sigma2 = 1.44*(pow(3., minusXOverLn2) - pow(4., minusXOverLn2)) / momSquare;
-  //XXX debugOut << "breams sigma: " << sigma2E << std::endl;
-  //assert(sigma2 >= 0.0);
-  sigma2 = (sigma2 > 0.0 ? sigma2 : 0.0);
-  noise[6 * 7 + 6] +=  charge_*charge_/betaSquare / (momSquare*momSquare) * sigma2;
-
+  double sigma2E = 1.44*(pow(3., minusXOverLn2) - pow(4., minusXOverLn2)) * momSquare;
+  sigma2E = std::max(sigma2E, 0.0); // must be positive
+  
+  // update noise matrix, using linear error propagation from E to q/p
+  noise[6 * 7 + 6] += charge_*charge_/betaSquare / pow(momSquare, 2) * sigma2E;
 }
 
 
@@ -806,8 +825,12 @@ void MaterialEffects::drawdEdx(int pdg) {
   stepSize_ = 1;
 
   materialInterface_->initTrack(0, 0, 0, 1, 1, 1);
-  materialInterface_->getMaterialParameters(matDensity_, matZ_, matA_, radiationLength_, mEE_);
-
+  auto currentMaterial = materialInterface_->getMaterialParameters();
+  matDensity_ = currentMaterial.density;
+  matZ_ = currentMaterial.Z;
+  matA_ = currentMaterial.A;
+  radiationLength_ = currentMaterial.radiationLength;
+  mEE_ = currentMaterial.mEE;
 
   double minMom = 0.00001;
   double maxMom = 10000;
diff --git a/trackReps/src/RKTools.cc b/trackReps/src/RKTools.cc
index c6de6e3b81417dc4d287f20b2956df81f2e7a8ed..84b9260a8aaff1576b39ae2d422850042f79674d 100644
--- a/trackReps/src/RKTools.cc
+++ b/trackReps/src/RKTools.cc
@@ -25,22 +25,10 @@
 
 #include <iostream>
 
-static const int flagSlowMatrix = 1 << 10; // Replace custom matrix multiplications with general equivalents
-static const int debugFlags = 0;// | flagSlowMatrix;
-
 namespace genfit {
 
 
 void RKTools::J_pMTxcov5xJ_pM(const M5x7& J_pM, const M5x5& cov5, M7x7& out7){
-  if (debugFlags & flagSlowMatrix) {
-    TMatrixD JpM(5, 7, (const double*)&J_pM);
-    TMatrixDSym J5(5, (const double*)&cov5);
-    J5.SimilarityT(JpM);
-    std::copy(J5.GetMatrixArray(), J5.GetMatrixArray() + 7*7, out7.begin());
-    return;
-  }
-
-
   // 5D -> 7D
 
   // J_pM
@@ -122,14 +110,6 @@ void RKTools::J_pMTxcov5xJ_pM(const M5x7& J_pM, const M5x5& cov5, M7x7& out7){
 
 
 void RKTools::J_pMTxcov5xJ_pM(const M5x6& J_pM, const M5x5& cov5, M6x6& out6){
-  if (debugFlags & flagSlowMatrix) {
-    TMatrixD JpM(5, 6, (const double*)&J_pM);
-    TMatrixDSym J5(5, (const double*)&cov5);
-    J5.SimilarityT(JpM);
-    std::copy(J5.GetMatrixArray(), J5.GetMatrixArray() + 6*6, out6.begin());
-    return;
-  }
-
   // 5D -> 6D
 
   // J_pM
@@ -208,15 +188,6 @@ void RKTools::J_pMTxcov5xJ_pM(const M5x6& J_pM, const M5x5& cov5, M6x6& out6){
 
 void RKTools::J_MpTxcov7xJ_Mp(const M7x5& J_Mp, const M7x7& cov7, M5x5& out5)
 {
-  if (debugFlags & flagSlowMatrix) {
-    TMatrixD JMp(7, 5, (const double*)&J_Mp);
-    TMatrixD J7(7, 7, (const double*)&cov7);
-    TMatrixD result(JMp, TMatrixD::kTransposeMult,
-                    TMatrixD(J7, TMatrixD::kMult, JMp));
-    std::copy(result.GetMatrixArray(), result.GetMatrixArray() + 5*5, out5.begin());
-    return;
-  }
-
   // 7D -> 5D
 
   // J_Mp
@@ -289,15 +260,6 @@ void RKTools::J_MpTxcov7xJ_Mp(const M7x5& J_Mp, const M7x7& cov7, M5x5& out5)
 
 void RKTools::J_MpTxcov6xJ_Mp(const M6x5& J_Mp, const M6x6& cov6, M5x5& out5)
 {
-  if (debugFlags & flagSlowMatrix) {
-    TMatrixD JMp(6, 5, (const double*)&J_Mp);
-    TMatrixDSym J7(6, (const double*)&cov6);
-    TMatrixD result(JMp, TMatrixD::kTransposeMult,
-                    TMatrixD(J7, TMatrixD::kMult, JMp));
-    std::copy(result.GetMatrixArray(), result.GetMatrixArray() + 5*5, out5.begin());
-    return;
-  }
-
   // 6D -> 5D
 
   // J_Mp
@@ -370,160 +332,6 @@ void RKTools::J_MpTxcov6xJ_Mp(const M6x5& J_Mp, const M6x6& cov6, M5x5& out5)
 
 }
 
-
-void RKTools::J_MMTxcov7xJ_MM(const M7x7& J_MM, M7x7& cov7){
-  if (debugFlags & flagSlowMatrix) {
-    TMatrixD JMM(7, 7, (const double*)&J_MM);
-    TMatrixDSym J7(7, (const double*)&cov7);
-    J7.SimilarityT(JMM);
-    std::copy(J7.GetMatrixArray(), J7.GetMatrixArray() + 7*7, cov7.begin());
-    return;
-  }
-
-  // it is assumed that the last column of J_MM is [0,0,0,0,0,0,1]
-
-  double JTC0  = J_MM[0] * cov7[0] + J_MM[7] * cov7[7] + J_MM[14] * cov7[14] + J_MM[21] * cov7[21] + J_MM[28] * cov7[28] + J_MM[35] * cov7[35] + J_MM[42] * cov7[42];
-  double JTC1  = J_MM[0] * cov7[7] + J_MM[7] * cov7[7+1] + J_MM[14] * cov7[14+1] + J_MM[21] * cov7[21+1] + J_MM[28] * cov7[28+1] + J_MM[35] * cov7[35+1] + J_MM[42] * cov7[42+1];
-  double JTC2  = J_MM[0] * cov7[14] + J_MM[7] * cov7[14+1] + J_MM[14] * cov7[14+2] + J_MM[21] * cov7[21+2] + J_MM[28] * cov7[28+2] + J_MM[35] * cov7[35+2] + J_MM[42] * cov7[42+2];
-  double JTC3  = J_MM[0] * cov7[21] + J_MM[7] * cov7[21+1] + J_MM[14] * cov7[21+2] + J_MM[21] * cov7[21+3] + J_MM[28] * cov7[28+3] + J_MM[35] * cov7[35+3] + J_MM[42] * cov7[42+3];
-  double JTC4  = J_MM[0] * cov7[28] + J_MM[7] * cov7[28+1] + J_MM[14] * cov7[28+2] + J_MM[21] * cov7[28+3] + J_MM[28] * cov7[28+4] + J_MM[35] * cov7[35+4] + J_MM[42] * cov7[42+4];
-  double JTC5  = J_MM[0] * cov7[35] + J_MM[7] * cov7[35+1] + J_MM[14] * cov7[35+2] + J_MM[21] * cov7[35+3] + J_MM[28] * cov7[35+4] + J_MM[35] * cov7[35+5] + J_MM[42] * cov7[42+5];
-  double JTC6  = J_MM[0] * cov7[42] + J_MM[7] * cov7[42+1] + J_MM[14] * cov7[42+2] + J_MM[21] * cov7[42+3] + J_MM[28] * cov7[42+4] + J_MM[35] * cov7[42+5] + J_MM[42] * cov7[42+6];
-
-  double JTC7  = J_MM[1] * cov7[0] + J_MM[7+1] * cov7[7] + J_MM[14+1] * cov7[14] + J_MM[21+1] * cov7[21] + J_MM[28+1] * cov7[28] + J_MM[35+1] * cov7[35] + J_MM[42+1] * cov7[42];
-  double JTC8  = J_MM[1] * cov7[7] + J_MM[7+1] * cov7[7+1] + J_MM[14+1] * cov7[14+1] + J_MM[21+1] * cov7[21+1] + J_MM[28+1] * cov7[28+1] + J_MM[35+1] * cov7[35+1] + J_MM[42+1] * cov7[42+1];
-  double JTC9  = J_MM[1] * cov7[14] + J_MM[7+1] * cov7[14+1] + J_MM[14+1] * cov7[14+2] + J_MM[21+1] * cov7[21+2] + J_MM[28+1] * cov7[28+2] + J_MM[35+1] * cov7[35+2] + J_MM[42+1] * cov7[42+2];
-  double JTC10 = J_MM[1] * cov7[21] + J_MM[7+1] * cov7[21+1] + J_MM[14+1] * cov7[21+2] + J_MM[21+1] * cov7[21+3] + J_MM[28+1] * cov7[28+3] + J_MM[35+1] * cov7[35+3] + J_MM[42+1] * cov7[42+3];
-  double JTC11 = J_MM[1] * cov7[28] + J_MM[7+1] * cov7[28+1] + J_MM[14+1] * cov7[28+2] + J_MM[21+1] * cov7[28+3] + J_MM[28+1] * cov7[28+4] + J_MM[35+1] * cov7[35+4] + J_MM[42+1] * cov7[42+4];
-  double JTC12 = J_MM[1] * cov7[35] + J_MM[7+1] * cov7[35+1] + J_MM[14+1] * cov7[35+2] + J_MM[21+1] * cov7[35+3] + J_MM[28+1] * cov7[35+4] + J_MM[35+1] * cov7[35+5] + J_MM[42+1] * cov7[42+5];
-  double JTC13 = J_MM[1] * cov7[42] + J_MM[7+1] * cov7[42+1] + J_MM[14+1] * cov7[42+2] + J_MM[21+1] * cov7[42+3] + J_MM[28+1] * cov7[42+4] + J_MM[35+1] * cov7[42+5] + J_MM[42+1] * cov7[42+6];
-
-  double JTC14 = J_MM[2] * cov7[0] + J_MM[7+2] * cov7[7] + J_MM[14+2] * cov7[14] + J_MM[21+2] * cov7[21] + J_MM[28+2] * cov7[28] + J_MM[35+2] * cov7[35] + J_MM[42+2] * cov7[42];
-  double JTC15 = J_MM[2] * cov7[7] + J_MM[7+2] * cov7[7+1] + J_MM[14+2] * cov7[14+1] + J_MM[21+2] * cov7[21+1] + J_MM[28+2] * cov7[28+1] + J_MM[35+2] * cov7[35+1] + J_MM[42+2] * cov7[42+1];
-  double JTC16 = J_MM[2] * cov7[14] + J_MM[7+2] * cov7[14+1] + J_MM[14+2] * cov7[14+2] + J_MM[21+2] * cov7[21+2] + J_MM[28+2] * cov7[28+2] + J_MM[35+2] * cov7[35+2] + J_MM[42+2] * cov7[42+2];
-  double JTC17 = J_MM[2] * cov7[21] + J_MM[7+2] * cov7[21+1] + J_MM[14+2] * cov7[21+2] + J_MM[21+2] * cov7[21+3] + J_MM[28+2] * cov7[28+3] + J_MM[35+2] * cov7[35+3] + J_MM[42+2] * cov7[42+3];
-  double JTC18 = J_MM[2] * cov7[28] + J_MM[7+2] * cov7[28+1] + J_MM[14+2] * cov7[28+2] + J_MM[21+2] * cov7[28+3] + J_MM[28+2] * cov7[28+4] + J_MM[35+2] * cov7[35+4] + J_MM[42+2] * cov7[42+4];
-  double JTC19 = J_MM[2] * cov7[35] + J_MM[7+2] * cov7[35+1] + J_MM[14+2] * cov7[35+2] + J_MM[21+2] * cov7[35+3] + J_MM[28+2] * cov7[35+4] + J_MM[35+2] * cov7[35+5] + J_MM[42+2] * cov7[42+5];
-  double JTC20 = J_MM[2] * cov7[42] + J_MM[7+2] * cov7[42+1] + J_MM[14+2] * cov7[42+2] + J_MM[21+2] * cov7[42+3] + J_MM[28+2] * cov7[42+4] + J_MM[35+2] * cov7[42+5] + J_MM[42+2] * cov7[42+6];
-
-  double JTC21 = J_MM[3] * cov7[0] + J_MM[7+3] * cov7[7] + J_MM[14+3] * cov7[14] + J_MM[21+3] * cov7[21] + J_MM[28+3] * cov7[28] + J_MM[35+3] * cov7[35] + J_MM[42+3] * cov7[42];
-  double JTC22 = J_MM[3] * cov7[7] + J_MM[7+3] * cov7[7+1] + J_MM[14+3] * cov7[14+1] + J_MM[21+3] * cov7[21+1] + J_MM[28+3] * cov7[28+1] + J_MM[35+3] * cov7[35+1] + J_MM[42+3] * cov7[42+1];
-  double JTC23 = J_MM[3] * cov7[14] + J_MM[7+3] * cov7[14+1] + J_MM[14+3] * cov7[14+2] + J_MM[21+3] * cov7[21+2] + J_MM[28+3] * cov7[28+2] + J_MM[35+3] * cov7[35+2] + J_MM[42+3] * cov7[42+2];
-  double JTC24 = J_MM[3] * cov7[21] + J_MM[7+3] * cov7[21+1] + J_MM[14+3] * cov7[21+2] + J_MM[21+3] * cov7[21+3] + J_MM[28+3] * cov7[28+3] + J_MM[35+3] * cov7[35+3] + J_MM[42+3] * cov7[42+3];
-  double JTC25 = J_MM[3] * cov7[28] + J_MM[7+3] * cov7[28+1] + J_MM[14+3] * cov7[28+2] + J_MM[21+3] * cov7[28+3] + J_MM[28+3] * cov7[28+4] + J_MM[35+3] * cov7[35+4] + J_MM[42+3] * cov7[42+4];
-  double JTC26 = J_MM[3] * cov7[35] + J_MM[7+3] * cov7[35+1] + J_MM[14+3] * cov7[35+2] + J_MM[21+3] * cov7[35+3] + J_MM[28+3] * cov7[35+4] + J_MM[35+3] * cov7[35+5] + J_MM[42+3] * cov7[42+5];
-  double JTC27 = J_MM[3] * cov7[42] + J_MM[7+3] * cov7[42+1] + J_MM[14+3] * cov7[42+2] + J_MM[21+3] * cov7[42+3] + J_MM[28+3] * cov7[42+4] + J_MM[35+3] * cov7[42+5] + J_MM[42+3] * cov7[42+6];
-
-  double JTC28 = J_MM[4] * cov7[0] + J_MM[7+4] * cov7[7] + J_MM[14+4] * cov7[14] + J_MM[21+4] * cov7[21] + J_MM[28+4] * cov7[28] + J_MM[35+4] * cov7[35] + J_MM[42+4] * cov7[42];
-  double JTC29 = J_MM[4] * cov7[7] + J_MM[7+4] * cov7[7+1] + J_MM[14+4] * cov7[14+1] + J_MM[21+4] * cov7[21+1] + J_MM[28+4] * cov7[28+1] + J_MM[35+4] * cov7[35+1] + J_MM[42+4] * cov7[42+1];
-  double JTC30 = J_MM[4] * cov7[14] + J_MM[7+4] * cov7[14+1] + J_MM[14+4] * cov7[14+2] + J_MM[21+4] * cov7[21+2] + J_MM[28+4] * cov7[28+2] + J_MM[35+4] * cov7[35+2] + J_MM[42+4] * cov7[42+2];
-  double JTC31 = J_MM[4] * cov7[21] + J_MM[7+4] * cov7[21+1] + J_MM[14+4] * cov7[21+2] + J_MM[21+4] * cov7[21+3] + J_MM[28+4] * cov7[28+3] + J_MM[35+4] * cov7[35+3] + J_MM[42+4] * cov7[42+3];
-  double JTC32 = J_MM[4] * cov7[28] + J_MM[7+4] * cov7[28+1] + J_MM[14+4] * cov7[28+2] + J_MM[21+4] * cov7[28+3] + J_MM[28+4] * cov7[28+4] + J_MM[35+4] * cov7[35+4] + J_MM[42+4] * cov7[42+4];
-  double JTC33 = J_MM[4] * cov7[35] + J_MM[7+4] * cov7[35+1] + J_MM[14+4] * cov7[35+2] + J_MM[21+4] * cov7[35+3] + J_MM[28+4] * cov7[35+4] + J_MM[35+4] * cov7[35+5] + J_MM[42+4] * cov7[42+5];
-  double JTC34 = J_MM[4] * cov7[42] + J_MM[7+4] * cov7[42+1] + J_MM[14+4] * cov7[42+2] + J_MM[21+4] * cov7[42+3] + J_MM[28+4] * cov7[42+4] + J_MM[35+4] * cov7[42+5] + J_MM[42+4] * cov7[42+6];
-
-  double out7_40 = (J_MM[5] * cov7[0] + J_MM[7+5] * cov7[7] + J_MM[14+5] * cov7[14] + J_MM[21+5] * cov7[21] + J_MM[28+5] * cov7[28] + J_MM[35+5] * cov7[35] + J_MM[42+5] * cov7[42]) * J_MM[5] + (J_MM[5] * cov7[7] + J_MM[7+5] * cov7[7+1] + J_MM[14+5] * cov7[14+1] + J_MM[21+5] * cov7[21+1] + J_MM[28+5] * cov7[28+1] + J_MM[35+5] * cov7[35+1] + J_MM[42+5] * cov7[42+1]) * J_MM[7+5] + (J_MM[5] * cov7[14] + J_MM[7+5] * cov7[14+1] + J_MM[14+5] * cov7[14+2] + J_MM[21+5] * cov7[21+2] + J_MM[28+5] * cov7[28+2] + J_MM[35+5] * cov7[35+2] + J_MM[42+5] * cov7[42+2]) * J_MM[14+5] + (J_MM[5] * cov7[21] + J_MM[7+5] * cov7[21+1] + J_MM[14+5] * cov7[21+2] + J_MM[21+5] * cov7[21+3] + J_MM[28+5] * cov7[28+3] + J_MM[35+5] * cov7[35+3] + J_MM[42+5] * cov7[42+3]) * J_MM[21+5] + (J_MM[5] * cov7[28] + J_MM[7+5] * cov7[28+1] + J_MM[14+5] * cov7[28+2] + J_MM[21+5] * cov7[28+3] + J_MM[28+5] * cov7[28+4] + J_MM[35+5] * cov7[35+4] + J_MM[42+5] * cov7[42+4]) * J_MM[28+5] + (J_MM[5] * cov7[35] + J_MM[7+5] * cov7[35+1] + J_MM[14+5] * cov7[35+2] + J_MM[21+5] * cov7[35+3] + J_MM[28+5] * cov7[35+4] + J_MM[35+5] * cov7[35+5] + J_MM[42+5] * cov7[42+5]) * J_MM[35+5] + (J_MM[5] * cov7[42] + J_MM[7+5] * cov7[42+1] + J_MM[14+5] * cov7[42+2] + J_MM[21+5] * cov7[42+3] + J_MM[28+5] * cov7[42+4] + J_MM[35+5] * cov7[42+5] + J_MM[42+5] * cov7[42+6]) * J_MM[42+5];
-
-  // last row
-  cov7[6]    = JTC6;
-  cov7[7+6]  = JTC13;
-  cov7[14+6] = JTC20;
-  cov7[21+6] = JTC27;
-  cov7[28+6] = JTC34;
-  cov7[35+6] = J_MM[5] * cov7[42] + J_MM[7+5] * cov7[42+1] + J_MM[14+5] * cov7[42+2] + J_MM[21+5] * cov7[42+3] + J_MM[28+5] * cov7[42+4] + J_MM[35+5] * cov7[42+5] + J_MM[42+5] * cov7[42+6];
-  //cov7[42+6] = cov7[42+6];
-
-  // loops are vectorizable by the compiler!
-  for (int i=0; i<6; ++i) cov7[i]    = JTC0  * J_MM[i] + JTC1  * J_MM[7+i] + JTC2  * J_MM[14+i] + JTC3  * J_MM[21+i] + JTC4  * J_MM[28+i] + JTC5  * J_MM[35+i] + JTC6  * J_MM[42+i];
-  for (int i=1; i<6; ++i) cov7[7+i]  = JTC7  * J_MM[i] + JTC8  * J_MM[7+i] + JTC9  * J_MM[14+i] + JTC10 * J_MM[21+i] + JTC11 * J_MM[28+i] + JTC12 * J_MM[35+i] + JTC13 * J_MM[42+i];
-  for (int i=2; i<6; ++i) cov7[14+i] = JTC14 * J_MM[i] + JTC15 * J_MM[7+i] + JTC16 * J_MM[14+i] + JTC17 * J_MM[21+i] + JTC18 * J_MM[28+i] + JTC19 * J_MM[35+i] + JTC20 * J_MM[42+i];
-  for (int i=3; i<6; ++i) cov7[21+i] = JTC21 * J_MM[i] + JTC22 * J_MM[7+i] + JTC23 * J_MM[14+i] + JTC24 * J_MM[21+i] + JTC25 * J_MM[28+i] + JTC26 * J_MM[35+i] + JTC27 * J_MM[42+i];
-  for (int i=4; i<6; ++i) cov7[28+i] = JTC28 * J_MM[i] + JTC29 * J_MM[7+i] + JTC30 * J_MM[14+i] + JTC31 * J_MM[21+i] + JTC32 * J_MM[28+i] + JTC33 * J_MM[35+i] + JTC34 * J_MM[42+i];
-  cov7[35+5] = out7_40;
-
-  // symmetric part
-  cov7[7]  = cov7[1];
-  cov7[14] = cov7[2];  cov7[14+1] = cov7[9];
-  cov7[21] = cov7[3];  cov7[21+1] = cov7[10];  cov7[21+2] = cov7[17];
-  cov7[28] = cov7[4];  cov7[28+1] = cov7[11];  cov7[28+2] = cov7[18];  cov7[28+3] = cov7[25];
-  cov7[35] = cov7[5];  cov7[35+1] = cov7[12];  cov7[35+2] = cov7[19];  cov7[35+3] = cov7[26];  cov7[35+4] = cov7[33];
-  cov7[42] = cov7[6];  cov7[42+1] = cov7[13];  cov7[42+2] = cov7[20];  cov7[42+3] = cov7[27];  cov7[42+4] = cov7[34];  cov7[42+5] = cov7[41];
-
-}
-
-
-void RKTools::J_MMxJ_MM(M7x7& J_MM, const M7x7& J_MM_old){
-
-  // J and J_old are
-  // 1 0 0 0 0 0 0
-  // 0 1 0 0 0 0 0
-  // 0 0 1 0 0 0 0
-  // x x x x x x 0
-  // x x x x x x 0
-  // x x x x x x 0
-  // x x x x x x x
-
-  M7x7 J_MM_temp = J_MM;
-
-  /*J_MM[0] = 1;
-  J_MM[1] = 0;
-  J_MM[2] = 0;
-  J_MM[3] = 0;
-  J_MM[4] = 0;
-  J_MM[5] = 0;
-  J_MM[6] = 0;
-
-  J_MM[1*7+0] = 0;
-  J_MM[1*7+1] = 1;
-  J_MM[1*7+2] = 0;
-  J_MM[1*7+3] = 0;
-  J_MM[1*7+4] = 0;
-  J_MM[1*7+5] = 0;
-  J_MM[1*7+6] = 0;
-
-  J_MM[2*7+0] = 0;
-  J_MM[2*7+1] = 0;
-  J_MM[2*7+2] = 1;
-  J_MM[2*7+3] = 0;
-  J_MM[2*7+4] = 0;
-  J_MM[2*7+5] = 0;
-  J_MM[2*7+6] = 0;*/
-
-  J_MM[21] = J_MM_old[21] + J_MM_old[21+3] * J_MM_temp[21] + J_MM_old[21+4] * J_MM_temp[28] + J_MM_old[21+5] * J_MM_temp[35];
-  J_MM[21+1] = J_MM_old[21+1] + J_MM_old[21+3] * J_MM_temp[21+1] + J_MM_old[21+4] * J_MM_temp[28+1] + J_MM_old[21+5] * J_MM_temp[35+1];
-  J_MM[21+2] = J_MM_old[21+2] + J_MM_old[21+3] * J_MM_temp[21+2] + J_MM_old[21+4] * J_MM_temp[28+2] + J_MM_old[21+5] * J_MM_temp[35+2];
-  J_MM[21+3] = J_MM_old[21+3] * J_MM_temp[21+3] + J_MM_old[21+4] * J_MM_temp[28+3] + J_MM_old[21+5] * J_MM_temp[35+3];
-  J_MM[21+4] = J_MM_old[21+3] * J_MM_temp[21+4] + J_MM_old[21+4] * J_MM_temp[28+4] + J_MM_old[21+5] * J_MM_temp[35+4];
-  J_MM[21+5] = J_MM_old[21+3] * J_MM_temp[21+5] + J_MM_old[21+4] * J_MM_temp[28+5] + J_MM_old[21+5] * J_MM_temp[35+5];
-  //J_MM[21+6] = 0;
-
-  J_MM[28] = J_MM_old[28] + J_MM_old[28+3] * J_MM_temp[21] + J_MM_old[28+4] * J_MM_temp[28] + J_MM_old[28+5] * J_MM_temp[35];
-  J_MM[28+1] = J_MM_old[28+1] + J_MM_old[28+3] * J_MM_temp[21+1] + J_MM_old[28+4] * J_MM_temp[28+1] + J_MM_old[28+5] * J_MM_temp[35+1];
-  J_MM[28+2] = J_MM_old[28+2] + J_MM_old[28+3] * J_MM_temp[21+2] + J_MM_old[28+4] * J_MM_temp[28+2] + J_MM_old[28+5] * J_MM_temp[35+2];
-  J_MM[28+3] = J_MM_old[28+3] * J_MM_temp[21+3] + J_MM_old[28+4] * J_MM_temp[28+3] + J_MM_old[28+5] * J_MM_temp[35+3];
-  J_MM[28+4] = J_MM_old[28+3] * J_MM_temp[21+4] + J_MM_old[28+4] * J_MM_temp[28+4] + J_MM_old[28+5] * J_MM_temp[35+4];
-  J_MM[28+5] = J_MM_old[28+3] * J_MM_temp[21+5] + J_MM_old[28+4] * J_MM_temp[28+5] + J_MM_old[28+5] * J_MM_temp[35+5];
-  //J_MM[28+6] = 0;
-
-  J_MM[35] = J_MM_old[35] + J_MM_old[35+3] * J_MM_temp[21] + J_MM_old[35+4] * J_MM_temp[28] + J_MM_old[35+5] * J_MM_temp[35] ;
-  J_MM[35+1] = J_MM_old[35+1] + J_MM_old[35+3] * J_MM_temp[21+1] + J_MM_old[35+4] * J_MM_temp[28+1] + J_MM_old[35+5] * J_MM_temp[35+1];
-  J_MM[35+2] = J_MM_old[35+2] + J_MM_old[35+3] * J_MM_temp[21+2] + J_MM_old[35+4] * J_MM_temp[28+2] + J_MM_old[35+5] * J_MM_temp[35+2];
-  J_MM[35+3] = J_MM_old[35+3] * J_MM_temp[21+3] + J_MM_old[35+4] * J_MM_temp[28+3] + J_MM_old[35+5] * J_MM_temp[35+3];
-  J_MM[35+4] = J_MM_old[35+3] * J_MM_temp[21+4] + J_MM_old[35+4] * J_MM_temp[28+4] + J_MM_old[35+5] * J_MM_temp[35+4];
-  J_MM[35+5] = J_MM_old[35+3] * J_MM_temp[21+5] + J_MM_old[35+4] * J_MM_temp[28+5] + J_MM_old[35+5] * J_MM_temp[35+5];
-  //J_MM[35+6] = 0;
-
-  J_MM[42] = J_MM_old[42] + J_MM_old[42+3] * J_MM_temp[21] + J_MM_old[42+4] * J_MM_temp[28] + J_MM_old[42+5] * J_MM_temp[35] + J_MM_old[42+6] * J_MM_temp[42];
-  J_MM[42+1] = J_MM_old[42+1] + J_MM_old[42+3] * J_MM_temp[21+1] + J_MM_old[42+4] * J_MM_temp[28+1] + J_MM_old[42+5] * J_MM_temp[35+1] + J_MM_old[42+6] * J_MM_temp[42+1];
-  J_MM[42+2] = J_MM_old[42+2] + J_MM_old[42+3] * J_MM_temp[21+2] + J_MM_old[42+4] * J_MM_temp[28+2] + J_MM_old[42+5] * J_MM_temp[35+2] + J_MM_old[42+6] * J_MM_temp[42+2];
-  J_MM[42+3] = J_MM_old[42+3] * J_MM_temp[21+3] + J_MM_old[42+4] * J_MM_temp[28+3] + J_MM_old[42+5] * J_MM_temp[35+3] + J_MM_old[42+6] * J_MM_temp[42+3];
-  J_MM[42+4] = J_MM_old[42+3] * J_MM_temp[21+4] + J_MM_old[42+4] * J_MM_temp[28+4] + J_MM_old[42+5] * J_MM_temp[35+4] + J_MM_old[42+6] * J_MM_temp[42+4];
-  J_MM[42+5] = J_MM_old[42+3] * J_MM_temp[21+5] + J_MM_old[42+4] * J_MM_temp[28+5] + J_MM_old[42+5] * J_MM_temp[35+5] + J_MM_old[42+6] * J_MM_temp[42+5];
-  J_MM[42+6] = J_MM_old[42+6] * J_MM_temp[42+6];
-
-}
-
-
 void RKTools::J_pMTTxJ_MMTTxJ_MpTT(const M7x5& J_pMT, const M7x7& J_MMT, const M5x7& J_MpT, M5x5& J_pp)
 {
     // calculates  J_pp = J_pM * J_MM * J_Mp
@@ -531,19 +339,6 @@ void RKTools::J_pMTTxJ_MMTTxJ_MpTT(const M7x5& J_pMT, const M7x7& J_MMT, const M
     // input J_pMT is transposed version of actual jacobian J_pM (Master to plane)
     // input J_MpT is transposed version of actual jacobian J_Mp (plane to Master)
 
-  if (debugFlags & flagSlowMatrix) {
-    TMatrixD JpMT(7, 5, (const double*)&J_pMT);
-    TMatrixD J7(7, 7, (const double*)&J_MMT);
-    TMatrixD JMpT(5, 7, (const double*)&J_MpT);
-    TMatrixD result(TMatrixD::kTransposed,
-                    TMatrixD(JMpT, TMatrixD::kMult,
-                             TMatrixD(J7, TMatrixD::kMult, JpMT)));
-
-    std::copy(result.GetMatrixArray(), result.GetMatrixArray() + 5*5, J_pp.begin());
-    return;
-  }
-
-
   // J_pMT
   // 0 0 0 x x
   // 0 0 0 x x
@@ -650,14 +445,6 @@ void RKTools::Np_N_NpT(const M7x7& Np, M7x7& N) {
   // calculate:
   // Np * N * Np^T
 
-  if (debugFlags & flagSlowMatrix) {
-    TMatrixDSym n(7,N.begin());
-    TMatrixD np(7,7,Np.begin());
-    n.Similarity(np);
-    std::copy(n.GetMatrixArray(), n.GetMatrixArray() + 7*7, N.begin());
-    return;
-  }
-
   double N00(N[0*7+0]), N11(N[1*7+1]), N22(N[2*7+2]), N33(N[3*7+3]), N44(N[4*7+4]), N55(N[5*7+5]);
 
   // replace lower left triangle using the original values from upper right triangle plus the cached diagonal values
diff --git a/trackReps/src/RKTrackRep.cc b/trackReps/src/RKTrackRep.cc
index 04d29d5578d0b89aa0fa536b4675cb7ffdf8f026..14c241f3c29511c4cbff6730c0a392045d6ef0a1 100644
--- a/trackReps/src/RKTrackRep.cc
+++ b/trackReps/src/RKTrackRep.cc
@@ -100,9 +100,9 @@ double RKTrackRep::extrapolateToPlane(StateOnPlane& state,
   M1x7 state7 = {{0, 0, 0, 0, 0, 0, 0}};
   getState7(state, state7);
 
-  TMatrixDSym* covPtr(NULL);
+  TMatrixDSym* covPtr(nullptr);
   bool fillExtrapSteps(false);
-  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != nullptr) {
     covPtr = &(static_cast<MeasuredStateOnPlane*>(&state)->getCov());
     fillExtrapSteps = true;
   }
@@ -142,7 +142,7 @@ double RKTrackRep::extrapolateToLine(StateOnPlane& state,
     debugOut << "RKTrackRep::extrapolateToLine()\n";
   }
 
-  checkCache(state, NULL);
+  checkCache(state, nullptr);
 
   static const unsigned int maxIt(1000);
 
@@ -151,7 +151,7 @@ double RKTrackRep::extrapolateToLine(StateOnPlane& state,
   getState7(state, state7);
 
   bool fillExtrapSteps(false);
-  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != nullptr) {
     fillExtrapSteps = true;
   }
   else if (calcJacobianNoise)
@@ -180,7 +180,7 @@ double RKTrackRep::extrapolateToLine(StateOnPlane& state,
     lastStep = step;
     lastDir = dir;
 
-    step = this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, NULL, true, stopAtBoundary, maxStep);
+    step = this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, nullptr, true, stopAtBoundary, maxStep);
     tracklength += step;
 
     dir.SetXYZ(state7[3], state7[4], state7[5]);
@@ -242,7 +242,7 @@ double RKTrackRep::extrapToPoint(StateOnPlane& state,
     debugOut << "RKTrackRep::extrapolateToPoint()\n";
   }
 
-  checkCache(state, NULL);
+  checkCache(state, nullptr);
 
   static const unsigned int maxIt(1000);
 
@@ -251,7 +251,7 @@ double RKTrackRep::extrapToPoint(StateOnPlane& state,
   getState7(state, state7);
 
   bool fillExtrapSteps(false);
-  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != nullptr) {
     fillExtrapSteps = true;
   }
   else if (calcJacobianNoise)
@@ -259,7 +259,7 @@ double RKTrackRep::extrapToPoint(StateOnPlane& state,
 
   double step(0.), lastStep(0.), maxStep(1.E99), angle(0), distToPoca(0), tracklength(0);
   TVector3 dir(state7[3], state7[4], state7[5]);
-  if (G != NULL) {
+  if (G != nullptr) {
     if(G->GetNrows() != 3) {
       Exception exc("RKTrackRep::extrapolateToLine ==> G is not 3x3",__LINE__,__FILE__);
       exc.setFatal();
@@ -289,11 +289,11 @@ double RKTrackRep::extrapToPoint(StateOnPlane& state,
     lastStep = step;
     lastDir = dir;
 
-    step = this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, NULL, true, stopAtBoundary, maxStep);
+    step = this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, nullptr, true, stopAtBoundary, maxStep);
     tracklength += step;
 
     dir.SetXYZ(state7[3], state7[4], state7[5]);
-    if (G != NULL) {
+    if (G != nullptr) {
       dir = TMatrix(*G) * dir;
     }
     poca.SetXYZ(state7[0], state7[1], state7[2]);
@@ -311,7 +311,7 @@ double RKTrackRep::extrapToPoint(StateOnPlane& state,
     // if lastStep and step have opposite sign, the real normal vector lies somewhere between the last two normal vectors (i.e. the directions)
     // -> try mean value of the two
     if (lastStep*step < 0){
-      if (G != NULL) { // after multiplication with G, dir has not length 1 anymore in general
+      if (G != nullptr) { // after multiplication with G, dir has not length 1 anymore in general
         dir.SetMag(1.);
         lastDir.SetMag(1.);
       }
@@ -359,7 +359,7 @@ double RKTrackRep::extrapolateToCylinder(StateOnPlane& state,
     debugOut << "RKTrackRep::extrapolateToCylinder()\n";
   }
 
-  checkCache(state, NULL);
+  checkCache(state, nullptr);
 
   static const unsigned int maxIt(1000);
 
@@ -368,7 +368,7 @@ double RKTrackRep::extrapolateToCylinder(StateOnPlane& state,
   getState7(state, state7);
 
   bool fillExtrapSteps(false);
-  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != nullptr) {
     fillExtrapSteps = true;
   }
   else if (calcJacobianNoise)
@@ -436,7 +436,7 @@ double RKTrackRep::extrapolateToCylinder(StateOnPlane& state,
     plane->setO(dest);
     plane->setUV((dest-linePoint).Cross(lineDirection), lineDirection);
 
-    tracklength += this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, NULL, true, stopAtBoundary, maxStep);
+    tracklength += this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, nullptr, true, stopAtBoundary, maxStep);
 
     // check break conditions
     if (stopAtBoundary && isAtBoundary) {
@@ -484,7 +484,7 @@ double RKTrackRep::extrapolateToCone(StateOnPlane& state,
     debugOut << "RKTrackRep::extrapolateToCone()\n";
   }
 
-  checkCache(state, NULL);
+  checkCache(state, nullptr);
 
   static const unsigned int maxIt(1000);
 
@@ -493,7 +493,7 @@ double RKTrackRep::extrapolateToCone(StateOnPlane& state,
   getState7(state, state7);
 
   bool fillExtrapSteps(false);
-  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != nullptr) {
     fillExtrapSteps = true;
   }
   else if (calcJacobianNoise)
@@ -570,7 +570,7 @@ double RKTrackRep::extrapolateToCone(StateOnPlane& state,
     plane->setO(dest);
     plane->setUV((dest-conePoint).Cross(coneDirection), dest-conePoint);
 
-    tracklength += this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, NULL, true, stopAtBoundary, maxStep);
+    tracklength += this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, nullptr, true, stopAtBoundary, maxStep);
 
     // check break conditions
     if (stopAtBoundary && isAtBoundary) {
@@ -617,7 +617,7 @@ double RKTrackRep::extrapolateToSphere(StateOnPlane& state,
     debugOut << "RKTrackRep::extrapolateToSphere()\n";
   }
 
-  checkCache(state, NULL);
+  checkCache(state, nullptr);
 
   static const unsigned int maxIt(1000);
 
@@ -626,7 +626,7 @@ double RKTrackRep::extrapolateToSphere(StateOnPlane& state,
   getState7(state, state7);
 
   bool fillExtrapSteps(false);
-  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != nullptr) {
     fillExtrapSteps = true;
   }
   else if (calcJacobianNoise)
@@ -682,7 +682,7 @@ double RKTrackRep::extrapolateToSphere(StateOnPlane& state,
 
     plane->setON(dest, dest-point);
 
-    tracklength += this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, NULL, true, stopAtBoundary, maxStep);
+    tracklength += this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, nullptr, true, stopAtBoundary, maxStep);
 
     // check break conditions
     if (stopAtBoundary && isAtBoundary) {
@@ -727,7 +727,7 @@ double RKTrackRep::extrapolateBy(StateOnPlane& state,
     debugOut << "RKTrackRep::extrapolateBy()\n";
   }
 
-  checkCache(state, NULL);
+  checkCache(state, nullptr);
 
   static const unsigned int maxIt(1000);
 
@@ -736,7 +736,7 @@ double RKTrackRep::extrapolateBy(StateOnPlane& state,
   getState7(state, state7);
 
   bool fillExtrapSteps(false);
-  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<MeasuredStateOnPlane*>(&state) != nullptr) {
     fillExtrapSteps = true;
   }
   else if (calcJacobianNoise)
@@ -769,7 +769,7 @@ double RKTrackRep::extrapolateBy(StateOnPlane& state,
 
     plane->setON(dest, dir);
 
-    tracklength += this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, NULL, true, stopAtBoundary, (step-tracklength));
+    tracklength += this->Extrap(startPlane, *plane, charge, mass, isAtBoundary, state7, flightTime, false, nullptr, true, stopAtBoundary, (step-tracklength));
 
     // check break conditions
     if (stopAtBoundary && isAtBoundary) {
@@ -858,7 +858,7 @@ TMatrixDSym RKTrackRep::get6DCov(const MeasuredStateOnPlane& state) const {
 
 double RKTrackRep::getCharge(const StateOnPlane& state) const {
 
-  if (dynamic_cast<const MeasurementOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<const MeasurementOnPlane*>(&state) != nullptr) {
     Exception exc("RKTrackRep::getCharge - cannot get charge from MeasurementOnPlane",__LINE__,__FILE__);
     exc.setFatal();
     throw exc;
@@ -884,7 +884,7 @@ double RKTrackRep::getMomMag(const StateOnPlane& state) const {
 
 double RKTrackRep::getMomVar(const MeasuredStateOnPlane& state) const {
 
-  if (dynamic_cast<const MeasurementOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<const MeasurementOnPlane*>(&state) != nullptr) {
     Exception exc("RKTrackRep::getMomVar - cannot get momVar from MeasurementOnPlane",__LINE__,__FILE__);
     exc.setFatal();
     throw exc;
@@ -904,7 +904,7 @@ double RKTrackRep::getMomVar(const MeasuredStateOnPlane& state) const {
 
 double RKTrackRep::getSpu(const StateOnPlane& state) const {
 
-  if (dynamic_cast<const MeasurementOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<const MeasurementOnPlane*>(&state) != nullptr) {
     Exception exc("RKTrackRep::getSpu - cannot get spu from MeasurementOnPlane",__LINE__,__FILE__);
     exc.setFatal();
     throw exc;
@@ -1070,7 +1070,7 @@ double RKTrackRep::getRadiationLenght() const {
   double radLen(0);
 
   for (unsigned int i = 0; i<RKSteps_.size(); ++i) {
-    radLen += RKSteps_.at(i).matStep_.stepSize_ / RKSteps_.at(i).matStep_.materialProperties_.getRadLen();
+    radLen += RKSteps_.at(i).matStep_.stepSize_ / RKSteps_.at(i).matStep_.material_.radiationLength;
   }
 
   return radLen;
@@ -1085,7 +1085,7 @@ void RKTrackRep::setPosMom(StateOnPlane& state, const TVector3& pos, const TVect
     throw exc;
   }
 
-  if (dynamic_cast<MeasurementOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<MeasurementOnPlane*>(&state) != nullptr) {
     Exception exc("RKTrackRep::setPosMom - cannot set pos/mom of a MeasurementOnPlane",__LINE__,__FILE__);
     exc.setFatal();
     throw exc;
@@ -1106,7 +1106,7 @@ void RKTrackRep::setPosMom(StateOnPlane& state, const TVector3& pos, const TVect
       setSpu(state, 1.);
   }
 
-  if (state.getPlane() != NULL && state.getPlane()->distance(pos) < MINSTEP) { // pos is on plane -> do not change plane!
+  if (state.getPlane() != nullptr && state.getPlane()->distance(pos) < MINSTEP) { // pos is on plane -> do not change plane!
 
     M1x7 state7;
 
@@ -1245,7 +1245,7 @@ void RKTrackRep::setPosMomCov(MeasuredStateOnPlane& state, const TVectorD& state
 
 void RKTrackRep::setChargeSign(StateOnPlane& state, double charge) const {
 
-  if (dynamic_cast<MeasurementOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<MeasurementOnPlane*>(&state) != nullptr) {
     Exception exc("RKTrackRep::setChargeSign - cannot set charge of a MeasurementOnPlane",__LINE__,__FILE__);
     exc.setFatal();
     throw exc;
@@ -1342,7 +1342,7 @@ double RKTrackRep::RKPropagate(M1x7& state7,
   //
   // Derivatives of track parameters
   //
-  if(jacobianT != NULL){
+  if(jacobianT != nullptr){
 
     // jacobianT
     // 1 0 0 0 0 0 0  x
@@ -1496,7 +1496,7 @@ void RKTrackRep::initArrays() const {
 
 void RKTrackRep::getState7(const StateOnPlane& state, M1x7& state7) const {
 
-  if (dynamic_cast<const MeasurementOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<const MeasurementOnPlane*>(&state) != nullptr) {
     Exception exc("RKTrackRep::getState7 - cannot get pos or mom from a MeasurementOnPlane",__LINE__,__FILE__);
     exc.setFatal();
     throw exc;
@@ -1563,35 +1563,6 @@ void RKTrackRep::getState5(StateOnPlane& state, const M1x7& state7) const {
 
 }
 
-
-
-void RKTrackRep::transformPM7(const MeasuredStateOnPlane& state,
-                              M7x7& out7x7) const {
-
-  // get vectors and aux variables
-  const TVector3& U(state.getPlane()->getU());
-  const TVector3& V(state.getPlane()->getV());
-  const TVector3& W(state.getPlane()->getNormal());
-
-  const TVectorD& state5(state.getState());
-  double spu(getSpu(state));
-
-  M1x3 pTilde;
-  pTilde[0] = spu * (W.X() + state5(1)*U.X() + state5(2)*V.X()); // a_x
-  pTilde[1] = spu * (W.Y() + state5(1)*U.Y() + state5(2)*V.Y()); // a_y
-  pTilde[2] = spu * (W.Z() + state5(1)*U.Z() + state5(2)*V.Z()); // a_z
-
-  M5x7 J_pM;
-  calcJ_pM_5x7(J_pM, U, V, pTilde, spu);
-
-  // since the Jacobian contains a lot of zeros, and the resulting cov has to be symmetric,
-  // the multiplication can be done much faster directly on array level
-  // out = J_pM^T * in5x5 * J_pM
-  const M5x5& in5x5_ = *((M5x5*) state.getCov().GetMatrixArray());
-  RKTools::J_pMTxcov5xJ_pM(J_pM, in5x5_, out7x7);
-}
-
-
 void RKTrackRep::calcJ_pM_5x7(M5x7& J_pM, const TVector3& U, const TVector3& V, const M1x3& pTilde, double spu) const {
   /*if (debugLvl_ > 1) {
     debugOut << "RKTrackRep::calcJ_pM_5x7 \n";
@@ -1698,30 +1669,6 @@ void RKTrackRep::transformPM6(const MeasuredStateOnPlane& state,
 
 }
 
-
-void RKTrackRep::transformM7P(const M7x7& in7x7,
-                              const M1x7& state7,
-                              MeasuredStateOnPlane& state) const { // plane must already be set!
-
-  // get vectors and aux variables
-  const TVector3& U(state.getPlane()->getU());
-  const TVector3& V(state.getPlane()->getV());
-  const TVector3& W(state.getPlane()->getNormal());
-
-  M1x3& A = *((M1x3*) &state7[3]);
-
-  M7x5 J_Mp;
-  calcJ_Mp_7x5(J_Mp, U, V, W, A);
-
-  // since the Jacobian contains a lot of zeros, and the resulting cov has to be symmetric,
-  // the multiplication can be done much faster directly on array level
-  // out5x5 = J_Mp^T * in * J_Mp
-  M5x5& out5x5_ = *((M5x5*) state.getCov().GetMatrixArray());
-  RKTools::J_MpTxcov7xJ_Mp(J_Mp, in7x7, out5x5_);
-
-}
-
-
 void RKTrackRep::calcJ_Mp_7x5(M7x5& J_Mp, const TVector3& U, const TVector3& V, const TVector3& W, const M1x3& A) const {
 
   /*if (debugLvl_ > 1) {
@@ -1732,7 +1679,7 @@ void RKTrackRep::calcJ_Mp_7x5(M7x5& J_Mp, const TVector3& U, const TVector3& V,
     debugOut << "  A = "; RKTools::printDim(A, 3,1);
   }*/
 
-  std::fill(J_Mp.begin(), J_Mp.end(), 7*5);
+  std::fill(J_Mp.begin(), J_Mp.end(), 0);
 
   const double AtU = A[0]*U.X() + A[1]*U.Y() + A[2]*U.Z();
   const double AtV = A[0]*V.X() + A[1]*V.Y() + A[2]*V.Z();
@@ -2050,7 +1997,7 @@ bool RKTrackRep::RKutta(const M1x4& SU,
     //
     // Project Jacobian of extrapolation onto destination plane
     //
-    if (jacobianT != NULL) {
+    if (jacobianT != nullptr) {
 
       // projected jacobianT
       // x x x x x x 0
@@ -2212,7 +2159,7 @@ double RKTrackRep::estimateStep(const M1x7& state7,
     M1x7 state7_temp = state7;
     M1x3 SA = {{0, 0, 0}};
 
-    double q ( RKPropagate(state7_temp, NULL, SA, fieldCurvLimit, true) );
+    double q ( RKPropagate(state7_temp, nullptr, SA, fieldCurvLimit, true) );
     if (debugLvl_ > 0) {
       debugOut << "  maxStepArg = " << fieldCurvLimit << "; q = " << q  << " \n";
     }
@@ -2317,12 +2264,12 @@ double RKTrackRep::estimateStep(const M1x7& state7,
                                             charge/state7[6], // |p|
                                             relMomLoss,
                                             pdgCode_,
-                                            lastStep->matStep_.materialProperties_,
+                                            lastStep->matStep_.material_,
                                             limits,
                                             true);
   } else { //assume material has not changed
     if  (RKSteps_.size()>1) {
-      lastStep->matStep_.materialProperties_ = (lastStep - 1)->matStep_.materialProperties_;
+      lastStep->matStep_.material_ = (lastStep - 1)->matStep_.material_;
     }
   }
 
@@ -2408,7 +2355,7 @@ double RKTrackRep::Extrap(const DetPlane& startPlane,
     for(int i = 0; i < 7*7; ++i) J_MMT_[i] = 0;
     for(int i=0; i<7; ++i) J_MMT_[8*i] = 1.;
 
-    M7x7* noise = NULL;
+    M7x7* noise = nullptr;
     isAtBoundary = false;
 
     // propagation
@@ -2435,7 +2382,7 @@ double RKTrackRep::Extrap(const DetPlane& startPlane,
       debugOut<<"RKSteps \n";
       for (std::vector<RKStep>::iterator it = RKSteps_.begin(); it != RKSteps_.end(); ++it){
         debugOut << "stepSize = " << it->matStep_.stepSize_ << "\t";
-        it->matStep_.materialProperties_.Print();
+        it->matStep_.material_.Print();
       }
       debugOut<<"\n";
     }
@@ -2463,7 +2410,7 @@ double RKTrackRep::Extrap(const DetPlane& startPlane,
       if (debugLvl_ > 0) {
         debugOut << "momLoss: " << momLoss << " GeV; relative: " << momLoss/fabs(charge/state7[6])
             << "; coveredDistance = " << coveredDistance << "\n";
-        if (debugLvl_ > 1 && noise != NULL) {
+        if (debugLvl_ > 1 && noise != nullptr) {
           debugOut << "7D noise: \n";
           RKTools::printDim(noise->begin(), 7, 7);
         }
@@ -2576,7 +2523,7 @@ double RKTrackRep::Extrap(const DetPlane& startPlane,
 
 
     // check if at boundary
-    if (stopAtBoundary) {
+    if (stopAtBoundary and isAtBoundary) {
       if (debugLvl_ > 0) {
         debugOut << "stopAtBoundary -> break; \n ";
       }
@@ -2611,13 +2558,13 @@ double RKTrackRep::Extrap(const DetPlane& startPlane,
     // propagate cov and add noise
     calcForwardJacobianAndNoise(startState7, startPlane, state7, destPlane);
 
-    if (cov != NULL) {
+    if (cov != nullptr) {
       cov->Similarity(fJacobian_);
       *cov += fNoise_;
     }
 
     if (debugLvl_ > 0) {
-      if (cov != NULL) {
+      if (cov != nullptr) {
         debugOut << "final covariance matrix after Extrap: "; cov->Print();
       }
     }
@@ -2635,7 +2582,7 @@ void RKTrackRep::checkCache(const StateOnPlane& state, const SharedPlanePtr* pla
     throw exc;
   }
 
-  if (dynamic_cast<const MeasurementOnPlane*>(&state) != NULL) {
+  if (dynamic_cast<const MeasurementOnPlane*>(&state) != nullptr) {
     Exception exc("RKTrackRep::checkCache - cannot extrapolate MeasurementOnPlane",__LINE__,__FILE__);
     exc.setFatal();
     throw exc;
@@ -2664,7 +2611,7 @@ void RKTrackRep::checkCache(const StateOnPlane& state, const SharedPlanePtr* pla
         continue;
       }
       if (RKSteps_.at(i).matStep_.stepSize_ * firstStep < 0) {
-        if (RKSteps_.at(i-1).matStep_.materialProperties_ == RKSteps_.at(i).matStep_.materialProperties_) {
+        if (RKSteps_.at(i-1).matStep_.material_ == RKSteps_.at(i).matStep_.material_) {
           RKSteps_.at(i-1).matStep_.stepSize_ += RKSteps_.at(i).matStep_.stepSize_;
         }
         RKSteps_.erase(RKSteps_.begin()+i, RKSteps_.end());
@@ -2680,7 +2627,7 @@ void RKTrackRep::checkCache(const StateOnPlane& state, const SharedPlanePtr* pla
     if (debugLvl_ > 0) {
       debugOut << "RKTrackRep::checkCache: can NOT use cached material and step values.\n";
 
-      if (plane != NULL) {
+      if (plane != nullptr) {
         if (state.getPlane() != lastStartState_.getPlane()) {
           debugOut << "state.getPlane() != lastStartState_.getPlane()\n";
         }
@@ -2688,7 +2635,7 @@ void RKTrackRep::checkCache(const StateOnPlane& state, const SharedPlanePtr* pla
           if (! (state.getState() == lastStartState_.getState())) {
             debugOut << "state.getState() != lastStartState_.getState()\n";
           }
-          else if (lastEndState_.getPlane().get() != NULL) {
+          else if (lastEndState_.getPlane().get() != nullptr) {
             debugOut << "distance " << (*plane)->distance(getPos(lastEndState_)) << "\n";
           }
         }
@@ -2710,7 +2657,7 @@ double RKTrackRep::momMag(const M1x7& state7) const {
 
 
 bool RKTrackRep::isSameType(const AbsTrackRep* other) {
-  if (dynamic_cast<const RKTrackRep*>(other) == NULL)
+  if (dynamic_cast<const RKTrackRep*>(other) == nullptr)
     return false;
 
   return true;
diff --git a/trackReps/src/TGeoMaterialInterface.cc b/trackReps/src/TGeoMaterialInterface.cc
index 58054e46289359f495d2b15d01772e670c84abe9..beed307c22fd460ef513c08b502538e74eda4e74 100644
--- a/trackReps/src/TGeoMaterialInterface.cc
+++ b/trackReps/src/TGeoMaterialInterface.cc
@@ -58,34 +58,10 @@ TGeoMaterialInterface::initTrack(double posX, double posY, double posZ,
 }
 
 
-void
-TGeoMaterialInterface::getMaterialParameters(double& density,
-                                               double& Z,
-                                               double& A,
-                                               double& radiationLength,
-                                               double& mEE){
+Material TGeoMaterialInterface::getMaterialParameters() {
 
   TGeoMaterial* mat = gGeoManager->GetCurrentVolume()->GetMedium()->GetMaterial();
-
-  density         = mat->GetDensity();
-  Z               = mat->GetZ();
-  A               = mat->GetA();
-  radiationLength = mat->GetRadLen();
-  mEE             = MeanExcEnergy_get(mat);
-
-}
-
-
-void
-TGeoMaterialInterface::getMaterialParameters(MaterialProperties& parameters) {
-
-  TGeoMaterial* mat = gGeoManager->GetCurrentVolume()->GetMedium()->GetMaterial();
-
-  parameters.setMaterialProperties(mat->GetDensity(),
-      mat->GetZ(),
-      mat->GetA(),
-      mat->GetRadLen(),
-      MeanExcEnergy_get(mat));
+  return Material(mat->GetDensity(), mat->GetZ(), mat->GetA(), mat->GetRadLen(), MeanExcEnergy_get(mat));
 
 }
 
@@ -156,7 +132,7 @@ TGeoMaterialInterface::findNextBoundary(const RKTrackRep* rep,
     // Always propagate complete way from original start to avoid
     // inconsistent extrapolations.
     state7 = stateOrig;
-    rep->RKPropagate(state7, NULL, SA, stepSign*(s + step), varField);
+    rep->RKPropagate(state7, nullptr, SA, stepSign*(s + step), varField);
 
     // Straight line distance² between extrapolation finish and
     // the end of the previously determined safe segment.
diff --git a/trackReps/src/trackRepsLinkDef.h b/trackReps/src/trackRepsLinkDef.h
index 290af131a2bfce1f2197e54115fccf11ce71cf8d..7c94d6e08893274cc38db2bd019ef0c3580df5f3 100644
--- a/trackReps/src/trackRepsLinkDef.h
+++ b/trackReps/src/trackRepsLinkDef.h
@@ -1,16 +1,10 @@
-#ifdef __CINT__
-
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
 
-#ifdef __CLING__
 #pragma link C++ nestedclass;
 #pragma link C++ nestedtypedef;
 
 #pragma link C++ namespace genfit;
-#endif
 
 #pragma link C++ class genfit::RKTrackRep-;
-
-#endif
diff --git a/utilities/include/RKMatrixEigenTransformations.h b/utilities/include/RKMatrixEigenTransformations.h
new file mode 100644
index 0000000000000000000000000000000000000000..cc5058545fd85a0938ac3e395700deecf0fbd06c
--- /dev/null
+++ b/utilities/include/RKMatrixEigenTransformations.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include "EigenMatrixTypedefs.h"
+#include "RKTools.h"
+
+namespace genfit {
+
+    template <unsigned int rows, unsigned int cols>
+    Eigen::Matrix<double, rows, cols> RKMatrixToEigenMatrix(const RKMatrix<rows, cols>& rkMatrix) {
+        Eigen::Matrix<double, rows, cols> eigenMatrix;
+
+        for (unsigned int row=0; row < rows; ++row) {
+            for (unsigned int col=0; col < cols; ++col) {
+                eigenMatrix(row, col) = rkMatrix[cols*row + col];
+            }
+        }
+
+        return eigenMatrix;
+    }
+
+
+    template <unsigned int rows, unsigned int cols>
+    RKMatrix<rows, cols> eigenMatrixToRKMatrix(const Eigen::Matrix<double, rows, cols>& eigenMatrix) {
+        RKMatrix<rows, cols> rkMatrix;
+
+        for (unsigned int row=0; row < rows; ++row) {
+            for (unsigned int col=0; col < cols; ++col) {
+                rkMatrix(row, col) = eigenMatrix(row, col);
+            }
+        }
+
+        return rkMatrix;
+    }
+
+}
\ No newline at end of file
diff --git a/utilities/include/RootEigenTransformations.h b/utilities/include/RootEigenTransformations.h
new file mode 100644
index 0000000000000000000000000000000000000000..fe053c90c2c8e0e7409c700f2f03f01805849ad5
--- /dev/null
+++ b/utilities/include/RootEigenTransformations.h
@@ -0,0 +1,94 @@
+#pragma once
+
+#include <Eigen/Dense>
+
+#include <cassert>
+
+namespace genfit {
+
+    template <unsigned int dim>
+    Eigen::Matrix<double, dim, 1> rootVectorToEigenVector(const TVectorD& rootVector) {
+        const unsigned int rootVectorRows = rootVector.GetNrows();
+        assert(rootVectorRows == dim);
+
+        double eigenArray[dim];
+        const auto* rootArray = rootVector.GetMatrixArray();
+
+        std::copy(rootArray,
+                  rootArray + rootVectorRows,
+                  std::begin(eigenArray));
+
+        return Eigen::Map<Eigen::Matrix<double, dim, 1>>(eigenArray);
+    }
+
+    template <unsigned int dim>
+    TVectorD eigenVectorToRootVector(const Eigen::Matrix<double, dim, 1>& eigenVector) {
+        const unsigned int eigenVectorRows = eigenVector.rows();
+
+        const double* eigenArray = eigenVector.data();
+
+        TVectorD rootVector(eigenVectorRows);
+        std::copy(eigenArray,
+                  eigenArray + eigenVectorRows,
+                  rootVector.GetMatrixArray());
+
+        return rootVector;
+    }
+
+    template <unsigned int dim>
+    Eigen::Matrix<double, dim, dim> rootMatrixSymToEigenMatrix(const TMatrixDSym& rootMatrix) {
+        assert(rootMatrix.GetNrows() == dim);
+        assert(rootMatrix.GetNcols() == dim);
+        Eigen::Matrix<double, dim, dim> eigenMatrix;
+
+        for (unsigned int row=0; row<dim; ++row) {
+            for (unsigned int col=0; col<dim; ++col) {
+                eigenMatrix(row, col) = rootMatrix(row, col);
+            }
+        }
+
+        return eigenMatrix;
+    }
+
+    template <unsigned int dim>
+    TMatrixDSym eigenMatrixToRootMatrixSym(const Eigen::Matrix<double, dim, dim>& eigenMatrix) {
+        TMatrixDSym rootMatrix(dim);
+
+        for (unsigned int row=0; row<dim; ++row) {
+            for (unsigned int col=0; col<dim; ++col) {
+                rootMatrix(row, col) = eigenMatrix(row, col);
+            }
+        }
+
+        return rootMatrix;
+    }
+
+    template <unsigned int rows, unsigned int cols>
+    Eigen::Matrix<double, rows, cols> rootMatrixToEigenMatrix(const TMatrixD& rootMatrix) {
+        assert(rootMatrix.GetNrows() == rows);
+        assert(rootMatrix.GetNcols() == cols);
+        Eigen::Matrix<double, rows, cols> eigenMatrix;
+
+        for (unsigned int row=0; row<rows; ++row) {
+            for (unsigned int col=0; col<cols; ++col) {
+                eigenMatrix(row, col) = rootMatrix(row, col);
+            }
+        }
+
+        return eigenMatrix;
+    }
+
+    template <unsigned int rows, unsigned int cols>
+    TMatrixD eigenMatrixToRootMatrix(const Eigen::Matrix<double, rows, cols>& eigenMatrix) {
+        TMatrixD rootMatrix(rows, cols);
+
+        for (unsigned int row=0; row<rows; ++row) {
+            for (unsigned int col=0; col<cols; ++col) {
+                rootMatrix(row, col) = eigenMatrix(row, col);
+            }
+        }
+
+        return rootMatrix;
+    }
+
+}
diff --git a/utilities/src/MeasurementCreator.cc b/utilities/src/MeasurementCreator.cc
index e91135c2ad105af133df8b7473d9433a750f819c..3f2771c993e563313900509da0ad3076e5959723 100644
--- a/utilities/src/MeasurementCreator.cc
+++ b/utilities/src/MeasurementCreator.cc
@@ -36,7 +36,7 @@
 namespace genfit {
 
 MeasurementCreator::MeasurementCreator() :
-    trackModel_(NULL),
+    trackModel_(nullptr),
     resolution_(0.01),
     resolutionWire_(0.1),
     outlierProb_(0),
diff --git a/utilities/src/utilitiesLinkDef.h b/utilities/src/utilitiesLinkDef.h
index 1273ebd2395c6a006495e4d859f26ab3fff2fdd6..0ebd0a37d49df50bb9868cab3c2afa5117a9b435 100644
--- a/utilities/src/utilitiesLinkDef.h
+++ b/utilities/src/utilitiesLinkDef.h
@@ -16,25 +16,16 @@
    You should have received a copy of the GNU Lesser General Public License
    along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
 */
-
-#ifdef __CINT__
-
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
 
-#ifdef __CLING__
 #pragma link C++ nestedclass;
 #pragma link C++ nestedtypedef;
 
 #pragma link C++ namespace genfit;
-#endif
 
 #pragma link C++ class genfit::HelixTrackModel+;
 #pragma link C++ class genfit::MeasurementCreator+;
 #pragma link C++ class genfit::mySpacepointDetectorHit+;
 #pragma link C++ class genfit::mySpacepointMeasurement+;
-
-
-#endif
-