From 2b4749d21a9fa971c0a67b6451730d28ebd18e8d Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Mon, 24 Mar 2025 11:40:50 +0100
Subject: [PATCH 01/12] Add missing installation of header only files in core

---
 core/base/CMakeLists.txt           |  3 ++-
 core/detectors/rich/CMakeLists.txt | 15 ++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/core/base/CMakeLists.txt b/core/base/CMakeLists.txt
index ca11909b3d..e405ab289a 100644
--- a/core/base/CMakeLists.txt
+++ b/core/base/CMakeLists.txt
@@ -55,7 +55,8 @@ set(PRIVATE_DEPENDENCIES
 
 generate_cbm_library()
 
-Install(FILES CbmDigitize.h CbmTrackingDetectorInterfaceBase.h report/CbmReportElement.h utils/CbmEnumArray.h
+Install(FILES CbmDigitize.h CbmReadoutBuffer.h CbmTrackingDetectorInterfaceBase.h report/CbmReportElement.h
+              utils/CbmEnumArray.h
         DESTINATION include
        )
 
diff --git a/core/detectors/rich/CMakeLists.txt b/core/detectors/rich/CMakeLists.txt
index 16526cea17..200512a82a 100644
--- a/core/detectors/rich/CMakeLists.txt
+++ b/core/detectors/rich/CMakeLists.txt
@@ -28,19 +28,19 @@ ENDIF (SSE_FOUND)
 
 set(LIBRARY_NAME CbmRichBase)
 set(LINKDEF ${LIBRARY_NAME}LinkDef.h)
-set(PUBLIC_DEPENDENCIES 
+set(PUBLIC_DEPENDENCIES
   CbmData
   FairRoot::Base
   FairRoot::ParBase
-  ROOT::Core 
+  ROOT::Core
   CbmBase
-  ROOT::MathCore 
+  ROOT::MathCore
   )
 
-set(PRIVATE_DEPENDENCIES 
-  FairLogger::FairLogger 
-  ROOT::EG 
-  ROOT::Geom 
+set(PRIVATE_DEPENDENCIES
+  FairLogger::FairLogger
+  ROOT::EG
+  ROOT::Geom
   ROOT::Hist
   ROOT::RIO
   ROOT::MLP
@@ -51,6 +51,7 @@ generate_cbm_library()
 
 # Install file which has no corresponding source file
 install(FILES
+        CbmRichPmtType.h
         CbmRichRecGeoPar.h
         DESTINATION include
        )
-- 
GitLab


From 5de33890ea0c84fae4a9ac65e29cab41aabc0026 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Mon, 24 Mar 2025 11:42:14 +0100
Subject: [PATCH 02/12] Add missing installation of header only files in reco

---
 reco/calibration/CMakeLists.txt | 7 +++++++
 reco/littrack/CMakeLists.txt    | 8 ++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/reco/calibration/CMakeLists.txt b/reco/calibration/CMakeLists.txt
index 29fb9cf1a1..5607dfbf77 100644
--- a/reco/calibration/CMakeLists.txt
+++ b/reco/calibration/CMakeLists.txt
@@ -23,3 +23,10 @@ set(INTERFACE_DEPENDENCIES
   )
 
 generate_cbm_library()
+
+# Install file which has no corresponding source file
+install(FILES
+        CbmOffsetDigiTime.h
+        DESTINATION include
+       )
+
diff --git a/reco/littrack/CMakeLists.txt b/reco/littrack/CMakeLists.txt
index 440f22b87b..30081168bf 100644
--- a/reco/littrack/CMakeLists.txt
+++ b/reco/littrack/CMakeLists.txt
@@ -52,8 +52,8 @@ set(SRCS
    cbm/base/CbmLitFieldFitter.cxx
    cbm/base/CbmLitToolFactory.cxx
    cbm/base/CbmLitTrackingGeometryConstructor.cxx
-   cbm/reco/CbmLitFindGlobalTracks.cxx 
-   cbm/reco/CbmLitFindGlobalTracksIdeal.cxx 
+   cbm/reco/CbmLitFindGlobalTracks.cxx
+   cbm/reco/CbmLitFindGlobalTracksIdeal.cxx
    cbm/reco/CbmLitFindGlobalTracksParallel.cxx
    cbm/utils/CbmLitConverterParallel.cxx
 )
@@ -185,6 +185,10 @@ install(FILES cbm/base/CbmLitDetectorSetup.h
         DESTINATION include/littrack/cbm/base
        )
 
+install(FILES cbm/qa/mc/CbmLitMCPoint.h
+        DESTINATION include
+       )
+
 install(FILES std/data/CbmLitFitNode.h
               std/data/CbmLitTrackParam.h
               std/data/CbmLitHit.h
-- 
GitLab


From c91b64c407e44de7969159ac92ed84bc3045dce6 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Mon, 24 Mar 2025 11:42:47 +0100
Subject: [PATCH 03/12] Add missing installation of header only files in
 analysis

---
 analysis/PWGCHA/jpsi/CMakeLists.txt            | 12 ++++++++++--
 analysis/PWGDIL/dielectron/lmvm/CMakeLists.txt | 14 ++++++++++----
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/analysis/PWGCHA/jpsi/CMakeLists.txt b/analysis/PWGCHA/jpsi/CMakeLists.txt
index 639dfa4961..9a8b33def4 100644
--- a/analysis/PWGCHA/jpsi/CMakeLists.txt
+++ b/analysis/PWGCHA/jpsi/CMakeLists.txt
@@ -16,11 +16,11 @@ set(SRCS
 IF (SSE_FOUND)
   Message(STATUS "Analysis will be compiled with SSE support")
   ADD_DEFINITIONS(-DHAVE_SSE)
-  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS 
+  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
   "-msse -O3")
 ELSE (SSE_FOUND)
   MESSAGE(STATUS "Analysis will be compiled without SSE support")
-  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS 
+  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
   "-O3")
 ENDIF (SSE_FOUND)
 
@@ -55,3 +55,11 @@ set(INTERFACE_DEPENDENCIES
   )
 
 generate_cbm_library()
+
+
+# Install file which has no corresponding source file
+install(FILES
+        CbmAnaJpsiCuts.h
+        CbmAnaJpsiUtils.h
+        DESTINATION include
+       )
diff --git a/analysis/PWGDIL/dielectron/lmvm/CMakeLists.txt b/analysis/PWGDIL/dielectron/lmvm/CMakeLists.txt
index cd3e2e0974..5f6ee0709d 100644
--- a/analysis/PWGDIL/dielectron/lmvm/CMakeLists.txt
+++ b/analysis/PWGDIL/dielectron/lmvm/CMakeLists.txt
@@ -14,11 +14,11 @@ set(SRCS
 IF (SSE_FOUND)
   Message(STATUS "LMVM analysis will be compiled with SSE support")
   ADD_DEFINITIONS(-DHAVE_SSE)
-  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS 
+  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
   "-msse -O3")
 ELSE (SSE_FOUND)
   MESSAGE(STATUS "LMVM analysis will be compiled without SSE support")
-  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS 
+  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
   "-O3")
 ENDIF (SSE_FOUND)
 
@@ -55,5 +55,11 @@ set(PRIVATE_DEPENDENCIES
 generate_cbm_library()
 
 
-
-
+# Install file which has no corresponding source file
+install(FILES
+        LmvmCand.h
+        LmvmCuts.h
+        LmvmDef.h
+        LmvmKinePar.h
+        DESTINATION include
+       )
-- 
GitLab


From 956a0fbbc646a54b774ace26bfb788d5abe9cbd7 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Mon, 24 Mar 2025 11:43:55 +0100
Subject: [PATCH 04/12] Add installation of RICH fitter header same as others,
 strange as NO_DICT_SRCS

---
 reco/detectors/rich/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/reco/detectors/rich/CMakeLists.txt b/reco/detectors/rich/CMakeLists.txt
index b38217bac8..15ccdb5aef 100644
--- a/reco/detectors/rich/CMakeLists.txt
+++ b/reco/detectors/rich/CMakeLists.txt
@@ -139,7 +139,8 @@ generate_cbm_library()
 
 install(FILES
         fitter/CbmRichRingFitterCOP.h fitter/CbmRichRingFitterBase.h
-        fitter/CbmRichRingFitterEllipseBase.h selection/CbmRichRingSelectImpl.h
+        fitter/CbmRichRingFitterEllipseBase.h fitter/CbmRichRingFitterEllipseTau.h
+        selection/CbmRichRingSelectImpl.h
         finder/CbmRichRingFinderHoughImpl.h finder/CbmRichRingFinderData.h
         DESTINATION include
        )
-- 
GitLab


From 2352b62427865b46333ac0fcfe7550d539b37ad6 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Mon, 24 Mar 2025 16:46:35 +0100
Subject: [PATCH 05/12] Additional missing header install in sim

---
 sim/detectors/rich/CMakeLists.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sim/detectors/rich/CMakeLists.txt b/sim/detectors/rich/CMakeLists.txt
index 4f767f72e1..3c2672bff0 100644
--- a/sim/detectors/rich/CMakeLists.txt
+++ b/sim/detectors/rich/CMakeLists.txt
@@ -43,3 +43,10 @@ set(PRIVATE_DEPENDENCIES
   )
 
 generate_cbm_library()
+
+# Install file which has no corresponding source file
+install(FILES
+        geo/RichGeoMaterials.h
+        DESTINATION include
+       )
+
-- 
GitLab


From 84589d51e67df9570e1d3591ca16d0fca7532729 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Mon, 24 Mar 2025 16:46:44 +0100
Subject: [PATCH 06/12] Additional missing header install in reco

---
 reco/calibration/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/reco/calibration/CMakeLists.txt b/reco/calibration/CMakeLists.txt
index 5607dfbf77..46af0e3e26 100644
--- a/reco/calibration/CMakeLists.txt
+++ b/reco/calibration/CMakeLists.txt
@@ -27,6 +27,7 @@ generate_cbm_library()
 # Install file which has no corresponding source file
 install(FILES
         CbmOffsetDigiTime.h
+        CbmOffsetDigiTime.tmpl
         DESTINATION include
        )
 
-- 
GitLab


From 3697eea5c486c98b5687eca9eb2786ef8d5bcf97 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Mon, 24 Mar 2025 16:47:03 +0100
Subject: [PATCH 07/12] Additional missing header install in analysis

---
 analysis/PWGCHA/jpsi/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/analysis/PWGCHA/jpsi/CMakeLists.txt b/analysis/PWGCHA/jpsi/CMakeLists.txt
index 9a8b33def4..d6ad8c48e7 100644
--- a/analysis/PWGCHA/jpsi/CMakeLists.txt
+++ b/analysis/PWGCHA/jpsi/CMakeLists.txt
@@ -60,6 +60,7 @@ generate_cbm_library()
 # Install file which has no corresponding source file
 install(FILES
         CbmAnaJpsiCuts.h
+        CbmAnaJpsiKinematicParams.h
         CbmAnaJpsiUtils.h
         DESTINATION include
        )
-- 
GitLab


From d5d2d9f4543673dfff21b5e2d6f2c9dc43e3dab7 Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Tue, 25 Mar 2025 15:13:17 +0100
Subject: [PATCH 08/12] Don't install conflicting header files

This fixes the problems that header files with the same name are installed in
the same directory overwritting each other. The solution is not to generate a
dictionary for the library and don't install the header files at all since
without dictionary they are not needed at runtime at all.

Related to #3582
---
 analysis/common/analysis_tree_converter/steer/CMakeLists.txt | 4 ++--
 analysis/common/analysis_tree_converter/steer/Run.cxx        | 2 +-
 analysis/common/analysis_tree_converter/steer/Run.h          | 3 +--
 reco/offline/steer/CMakeLists.txt                            | 4 ++--
 reco/offline/steer/Run.cxx                                   | 2 +-
 reco/offline/steer/Run.h                                     | 2 +-
 sim/response/steer/CMakeLists.txt                            | 4 ++--
 sim/response/steer/Run.cxx                                   | 2 +-
 sim/response/steer/Run.h                                     | 2 +-
 9 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/analysis/common/analysis_tree_converter/steer/CMakeLists.txt b/analysis/common/analysis_tree_converter/steer/CMakeLists.txt
index 185eafc14d..51ec7976c8 100644
--- a/analysis/common/analysis_tree_converter/steer/CMakeLists.txt
+++ b/analysis/common/analysis_tree_converter/steer/CMakeLists.txt
@@ -1,7 +1,7 @@
 # CMakeList file for library libCbmAtcOfflineSteer
 # F. Linz,     27 October 2023
 
-set(SRCS
+set(NO_DICT_SRCS
   Config.cxx
   Run.cxx
   TaskFactory.cxx
@@ -10,7 +10,7 @@ set(SRCS
 set(INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
 
 set(LIBRARY_NAME CbmAtConverterSteer)
-set(LINKDEF RootLinkDef.h)
+#set(LINKDEF RootLinkDef.h)
 set(PUBLIC_DEPENDENCIES
   CbmData
   FairRoot::Base
diff --git a/analysis/common/analysis_tree_converter/steer/Run.cxx b/analysis/common/analysis_tree_converter/steer/Run.cxx
index fc5e22e447..ad5e5beb94 100644
--- a/analysis/common/analysis_tree_converter/steer/Run.cxx
+++ b/analysis/common/analysis_tree_converter/steer/Run.cxx
@@ -231,4 +231,4 @@ namespace cbm::atconverter
 
 }  // namespace cbm::atconverter
 
-ClassImp(cbm::atconverter::Run)
+//ClassImp(cbm::atconverter::Run)
diff --git a/analysis/common/analysis_tree_converter/steer/Run.h b/analysis/common/analysis_tree_converter/steer/Run.h
index 1239afe8d1..5ae31bea05 100644
--- a/analysis/common/analysis_tree_converter/steer/Run.h
+++ b/analysis/common/analysis_tree_converter/steer/Run.h
@@ -159,8 +159,7 @@ namespace cbm::atconverter
     Config fConfig                      = {};
     std::set<ECbmModuleId> fDataPresent = {};
 
-
-    ClassDef(cbm::atconverter::Run, 1);
+    // ClassDef(cbm::atconverter::Run, 1);
   };
 
 }  // namespace cbm::atconverter
diff --git a/reco/offline/steer/CMakeLists.txt b/reco/offline/steer/CMakeLists.txt
index 8ada18e7a3..84c3675892 100644
--- a/reco/offline/steer/CMakeLists.txt
+++ b/reco/offline/steer/CMakeLists.txt
@@ -2,7 +2,7 @@
 # V. Friese,     13 May 2023
 
 
-set(SRCS
+set(NO_DICT_SRCS
   Config.cxx
   Run.cxx
   TaskFactory.cxx
@@ -16,7 +16,7 @@ endif()
 
 
 set(LIBRARY_NAME CbmRecoOfflineSteer)
-set(LINKDEF RootLinkDef.h)
+#set(LINKDEF RootLinkDef.h)
 set(PUBLIC_DEPENDENCIES
   AlgoOffline
   CbmData
diff --git a/reco/offline/steer/Run.cxx b/reco/offline/steer/Run.cxx
index af0ac760ee..209e7d8e13 100644
--- a/reco/offline/steer/Run.cxx
+++ b/reco/offline/steer/Run.cxx
@@ -240,4 +240,4 @@ namespace cbm::reco::offline
 
 }  // namespace cbm::reco::offline
 
-ClassImp(cbm::reco::offline::Run)
+//ClassImp(cbm::reco::offline::Run)
diff --git a/reco/offline/steer/Run.h b/reco/offline/steer/Run.h
index 9a47c06022..697e0eb385 100644
--- a/reco/offline/steer/Run.h
+++ b/reco/offline/steer/Run.h
@@ -152,7 +152,7 @@ namespace cbm::reco::offline
     std::set<ECbmModuleId> fDataPresent = {};
 
 
-    ClassDef(cbm::reco::offline::Run, 1);
+    // ClassDef(cbm::reco::offline::Run, 1);
   };
 
 }  // namespace cbm::reco::offline
diff --git a/sim/response/steer/CMakeLists.txt b/sim/response/steer/CMakeLists.txt
index 250a007375..df73c871ce 100644
--- a/sim/response/steer/CMakeLists.txt
+++ b/sim/response/steer/CMakeLists.txt
@@ -1,7 +1,7 @@
 # CMakeList file for library libCbmSimDigitizationSteer
 # F. Linz,     09 January 2024
 
-set(SRCS
+set(NO_DICT_SRCS
   Config.cxx
   Run.cxx
   )
@@ -9,7 +9,7 @@ set(SRCS
 set(INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
 
 set(LIBRARY_NAME CbmSimDigitizationSteer)
-set(LINKDEF RootLinkDef.h)
+#set(LINKDEF RootLinkDef.h)
 set(PUBLIC_DEPENDENCIES
   CbmData
   FairRoot::Base
diff --git a/sim/response/steer/Run.cxx b/sim/response/steer/Run.cxx
index 1e76e6be65..a44db7c19b 100644
--- a/sim/response/steer/Run.cxx
+++ b/sim/response/steer/Run.cxx
@@ -176,4 +176,4 @@ namespace cbm::sim::digitization
 
 }  // namespace cbm::sim::digitization
 
-ClassImp(cbm::sim::digitization::Run)
+//ClassImp(cbm::sim::digitization::Run)
diff --git a/sim/response/steer/Run.h b/sim/response/steer/Run.h
index 08ff0a60ec..053a3c5cfa 100644
--- a/sim/response/steer/Run.h
+++ b/sim/response/steer/Run.h
@@ -122,7 +122,7 @@ namespace cbm::sim::digitization
     Config fConfig = {};
 
 
-    ClassDef(cbm::sim::digitization::Run, 1);
+    // ClassDef(cbm::sim::digitization::Run, 1);
   };
 
 }  // namespace cbm::sim::digitization
-- 
GitLab


From 10fc76505935edacbbdfc975c26661ba895ae0da Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Thu, 27 Mar 2025 14:44:50 +0100
Subject: [PATCH 09/12] Fix missing header in CbmRecoTask from algo at install

---
 algo/CMakeLists.txt         | 1 +
 algo/kfp/KfpV0FinderChain.h | 4 ++--
 algo/qa/QaData.h            | 2 +-
 algo/qa/QaManager.h         | 4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt
index 677b09d719..5cc62745d1 100644
--- a/algo/CMakeLists.txt
+++ b/algo/CMakeLists.txt
@@ -386,6 +386,7 @@ install(
     trigger/V0TriggerConfig.h
     unpack/CommonUnpacker.h
     unpack/UnpackMSBase.h
+    global/ParFiles.h
     global/Reco.h
     global/RecoResults.h
     global/RecoResultsInputArchive.h
diff --git a/algo/kfp/KfpV0FinderChain.h b/algo/kfp/KfpV0FinderChain.h
index 95f10ebbab..42580e7456 100644
--- a/algo/kfp/KfpV0FinderChain.h
+++ b/algo/kfp/KfpV0FinderChain.h
@@ -11,8 +11,8 @@
 
 #include "CbmEventTriggers.h"
 #include "PODVector.h"
-#include "base/SubChain.h"
-#include "global/RecoResults.h"
+#include "RecoResults.h"
+#include "SubChain.h"
 #include "kfp/KfpV0Finder.h"
 #include "kfp/KfpV0FinderMonitor.h"
 #include "kfp/KfpV0FinderQa.h"
diff --git a/algo/qa/QaData.h b/algo/qa/QaData.h
index 8c66c445a9..d8ed271792 100644
--- a/algo/qa/QaData.h
+++ b/algo/qa/QaData.h
@@ -10,7 +10,7 @@
 #pragma once
 
 #include "AlgoFairloggerCompat.h"
-#include "base/HistogramSender.h"
+#include "HistogramSender.h"
 #include "qa/CanvasConfig.h"
 #include "qa/HistogramContainer.h"
 #include "qa/TaskProperties.h"
diff --git a/algo/qa/QaManager.h b/algo/qa/QaManager.h
index ab7e397c5f..93d587eb39 100644
--- a/algo/qa/QaManager.h
+++ b/algo/qa/QaManager.h
@@ -9,8 +9,8 @@
 
 #pragma once
 
-#include "base/HistogramSender.h"
-#include "base/SubChain.h"
+#include "HistogramSender.h"
+#include "SubChain.h"
 #include "qa/QaData.h"
 
 namespace cbm::algo::qa
-- 
GitLab


From 564e65c2a5617e2b898427f7b0e2e5ab2d28749c Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Thu, 27 Mar 2025 14:49:39 +0100
Subject: [PATCH 10/12] Fix missing header from algo for CbmQaCanvas

---
 algo/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt
index 5cc62745d1..612c11a1a5 100644
--- a/algo/CMakeLists.txt
+++ b/algo/CMakeLists.txt
@@ -392,6 +392,7 @@ install(
     global/RecoResultsInputArchive.h
     global/RecoResultsOutputArchive.h
     global/StorableRecoResults.h
+    qa/Accumulators.h
     qa/Histogram.h
     ca/TrackingChain.h
     ca/TrackingChainConfig.h
-- 
GitLab


From 80773550c2de9ad1d480ac748aff9e1d1f74f8d7 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Fri, 28 Mar 2025 15:00:56 +0100
Subject: [PATCH 11/12] Fix install + usage of KFParticle headers, both KFP lib
 and CBM libs load fully

- Patch the KFParticle CMake (KFP side) so that the headers are temporarily installed in a subfolder in the build fodler
- Fix the KFParticle external CMake file (CBM side):
  - apply KFParticle install patch to all 3 patch cases (in combination with original patch for MACOS ARM and Clang Tiny)
  - headers are installed in a subfolder
  - missing headers added to install (probably most of them installed now)
  - some headers installed under two subfolders to match dictionaries of both CBM libs and KFP lib
  - add all (new + previously used) install subfolders to interface of the installed KFP library
- Analysis: Partial path for KF includes to be compatible with all 3 usage variants
- Reco: Partial path for KF includes to be compatible with all 3 usage variants
---
 .../conversion/CbmAnaConversion.cxx           |  7 +-
 .../conversion/CbmAnaConversionKF.h           |  6 +-
 .../dielectron/papaframework/CMakeLists.txt   |  5 +-
 .../papaframework/PairAnalysisPairKF.cxx      |  4 +-
 .../papaframework/PairAnalysisPairKF.h        | 10 +--
 .../CbmKresConversionCorrectedPhotons.cxx     |  4 +-
 .../CbmKresConversionCorrectedPhotons.h       |  7 +-
 .../dielectron/pi0eta/CbmKresConversionKF.cxx |  7 +-
 .../dielectron/pi0eta/CbmKresConversionKF.h   |  5 +-
 .../pi0eta/CbmKresConversionManual.cxx        |  4 +-
 .../pi0eta/CbmKresConversionManualmbias1.cxx  |  5 +-
 .../pi0eta/CbmKresConversionManualmbias2.cxx  |  5 +-
 .../pi0eta/CbmKresConversionManualmbias3.cxx  |  5 +-
 .../pi0eta/CbmKresConversionManualmbias4.cxx  |  5 +-
 .../pi0eta/CbmKresConversionPhotons.cxx       |  4 +-
 .../pi0eta/CbmKresConversionPhotons.h         |  7 +-
 .../PWGDIL/dielectron/pi0eta/CbmKresEta.cxx   |  5 +-
 .../at_kfpf_interface/ATKFParticleFinder.cxx  |  2 +-
 external/InstallKFParticle.cmake              | 73 +++++++++++++++----
 external/KFParticle_header_install.patch      | 42 +++++++++++
 reco/KF/CbmKFParticleFinder.cxx               |  4 +-
 reco/KF/CbmKFParticleFinderQa.cxx             |  8 +-
 reco/KF/CbmKFParticleInterface.cxx            |  6 +-
 reco/KF/CbmKFV0FinderTask.h                   |  2 +-
 24 files changed, 148 insertions(+), 84 deletions(-)
 create mode 100644 external/KFParticle_header_install.patch

diff --git a/analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx b/analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx
index 6670b69154..e7b6fcdd39 100644
--- a/analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx
+++ b/analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx
@@ -26,12 +26,11 @@
 #include "CbmStsTrack.h"
 #include "CbmTrackMatchNew.h"
 #include "CbmUtils.h"
-
 #include "FairMCPoint.h"
 #include "FairTrackParam.h"
-#include <Logger.h>
+#include "KFParticle/KFParticleTopoReconstructor.h"
 
-#include "KFParticleTopoReconstructor.h"
+#include <Logger.h>
 
 
 // includes of standard c++ classes or ROOT classes
@@ -2040,7 +2039,7 @@ void CbmAnaConversion::AnalysePi0_Reco()
 					cout << "CbmAnaConversion: AnalysePi0_Reco: " << alt5->first << "/" << zwischen->first << "/" << alt3->first << "/" << alt4->first << endl;
 					cout << "CbmAnaConversion: AnalysePi0_Reco: " << alt5->second << "/" << zwischen->second << "/" << alt3->second << "/" << alt4->second << endl;
 					AnalysePi0_Reco_calc(alt5->second, zwischen->second, alt3->second, alt4->second);
-				
+
 				}
 				*/
         check2 = 1;
diff --git a/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionKF.h b/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionKF.h
index f59884650e..b0d08925ac 100644
--- a/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionKF.h
+++ b/analysis/PWGDIL/dielectron/conversion/CbmAnaConversionKF.h
@@ -25,9 +25,9 @@
 #include "CbmKFParticleFinderQa.h"
 #include "CbmMCTrack.h"
 #include "CbmVertex.h"
-#include "KFPartMatch.h"
-#include "KFParticle.h"
-#include "KFTopoPerformance.h"
+#include "KFParticle/KFPartMatch.h"
+#include "KFParticle/KFParticle.h"
+#include "KFParticle/KFTopoPerformance.h"
 
 #include <vector>
 
diff --git a/analysis/PWGDIL/dielectron/papaframework/CMakeLists.txt b/analysis/PWGDIL/dielectron/papaframework/CMakeLists.txt
index a072fe0253..2339745733 100644
--- a/analysis/PWGDIL/dielectron/papaframework/CMakeLists.txt
+++ b/analysis/PWGDIL/dielectron/papaframework/CMakeLists.txt
@@ -47,11 +47,11 @@ set(SRCS
 IF (SSE_FOUND)
   Message(STATUS "Papa will be compiled with SSE support")
   ADD_DEFINITIONS(-DHAVE_SSE)
-  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS 
+  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
   "-msse -O3")
 ELSE (SSE_FOUND)
   MESSAGE(STATUS "Papa will be compiled without SSE support")
-  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS 
+  SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
   "-O3")
 ENDIF (SSE_FOUND)
 
@@ -98,6 +98,7 @@ set(PUBLIC_DEPENDENCIES
 set(PRIVATE_DEPENDENCIES
   CbmMvdBase
   CbmSimBase
+  KFParticle
   KFParticleInterface
   Littrack
   LittrackQA
diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.cxx b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.cxx
index 63733318a8..0579a77557 100644
--- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.cxx
+++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.cxx
@@ -17,7 +17,7 @@
 
 #include <TDatabasePDG.h>
 
-#include "KFParticle.h"
+//#include "KFParticle.h"
 #include "PairAnalysisMC.h"
 #include "PairAnalysisTrack.h"
 
@@ -216,7 +216,7 @@ Double_t PairAnalysisPairKF::PsiPair(Double_t /*MagField*/) const
 
   m1[0] = fD1.GetPx();
   m1[1] = fD1.GetPy();
-  m1[2] = fD1.GetPz();  
+  m1[2] = fD1.GetPz();
 
   m2[0] = fD2.GetPx();
   m2[1] = fD2.GetPy();
diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.h b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.h
index 219d3136d6..91072770e4 100644
--- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.h
+++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisPairKF.h
@@ -14,15 +14,15 @@
 //#                                                           #
 //#############################################################
 
-#include <TLorentzVector.h>
-#include <TMath.h>
-
-#include <KFParticle.h>
-
 #include "PairAnalysisPair.h"
 #include "PairAnalysisTrack.h"
 #include "PairAnalysisTrackRotator.h"
 
+#include <TLorentzVector.h>
+#include <TMath.h>
+
+#include <KFParticle/KFParticle.h>
+
 class CbmVertex;
 class CbmMCTrack;
 
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionCorrectedPhotons.cxx b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionCorrectedPhotons.cxx
index d30f8ca8ae..a6bcdd7e26 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionCorrectedPhotons.cxx
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionCorrectedPhotons.cxx
@@ -33,13 +33,11 @@
 #include "CbmStsHit.h"
 #include "CbmStsTrack.h"
 #include "CbmTrackMatchNew.h"
-
 #include "FairRootManager.h"
+#include "KFParticle/KFParticle.h"
 
 #include <iostream>
 
-#include "KFParticle.h"
-
 using namespace std;
 
 CbmKresConversionCorrectedPhotons::CbmKresConversionCorrectedPhotons()
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionCorrectedPhotons.h b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionCorrectedPhotons.h
index 6cae2e492f..24f51c1b55 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionCorrectedPhotons.h
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionCorrectedPhotons.h
@@ -14,12 +14,11 @@
 #include "CbmRichRingFitterEllipseTau.h"
 #include "CbmStsTrack.h"
 #include "CbmVertex.h"
-
+#include "KFParticle/KFParticle.h"
+#include "LmvmKinePar.h"
 #include "TH2D.h"
-#include <TClonesArray.h>
 
-#include "KFParticle.h"
-#include "LmvmKinePar.h"
+#include <TClonesArray.h>
 
 class CbmRichRingFitterEllipseTau;
 
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionKF.cxx b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionKF.cxx
index b0d796531b..7ba42fc028 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionKF.cxx
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionKF.cxx
@@ -33,15 +33,14 @@
 #include "CbmRichRingLight.h"
 #include "CbmStsTrack.h"
 #include "CbmTrackMatchNew.h"
+#include "KFParticle/KFParticle.h"
+#include "KFParticle/KFParticleTopoReconstructor.h"
+#include "LmvmKinePar.h"
 
 #include <FairRootManager.h>
 
 #include <TDirectory.h>
 
-#include "KFParticle.h"
-#include "KFParticleTopoReconstructor.h"
-#include "LmvmKinePar.h"
-
 using namespace std;
 
 CbmKresConversionKF::CbmKresConversionKF()
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionKF.h b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionKF.h
index 41a2bceb9d..ca33f9d350 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionKF.h
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionKF.h
@@ -10,14 +10,13 @@
 #include "CbmKresConversionBG.h"
 #include "CbmMCTrack.h"
 #include "CbmRichRing.h"
+#include "KFParticle/KFParticle.h"
+#include "KFParticle/KFTopoPerformance.h"
 
 #include <TClonesArray.h>
 #include <TH1.h>
 #include <TH2D.h>
 
-#include "KFParticle.h"
-#include "KFTopoPerformance.h"
-
 class CbmRichRingFitterEllipseTau;
 
 using namespace std;
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManual.cxx b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManual.cxx
index e2c5714394..c91f2512c9 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManual.cxx
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManual.cxx
@@ -34,13 +34,11 @@
 #include "CbmStsHit.h"
 #include "CbmStsTrack.h"
 #include "CbmTrackMatchNew.h"
-
 #include "FairRootManager.h"
+#include "KFParticle/KFParticle.h"
 
 #include <iostream>
 
-#include "KFParticle.h"
-
 using namespace std;
 
 CbmKresConversionManual::CbmKresConversionManual()
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias1.cxx b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias1.cxx
index f3905c6a8f..13c33c1e42 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias1.cxx
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias1.cxx
@@ -35,15 +35,12 @@
 #include "CbmStsHit.h"
 #include "CbmStsTrack.h"
 #include "CbmTrackMatchNew.h"
-
 #include "FairRootManager.h"
-
+#include "KFParticle/KFParticle.h"
 #include "TDirectory.h"
 
 #include <iostream>
 
-#include "KFParticle.h"
-
 
 using namespace std;
 
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias2.cxx b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias2.cxx
index 87bc8a8e47..5003264087 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias2.cxx
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias2.cxx
@@ -35,15 +35,12 @@
 #include "CbmStsHit.h"
 #include "CbmStsTrack.h"
 #include "CbmTrackMatchNew.h"
-
 #include "FairRootManager.h"
-
+#include "KFParticle/KFParticle.h"
 #include "TDirectory.h"
 
 #include <iostream>
 
-#include "KFParticle.h"
-
 
 using namespace std;
 
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias3.cxx b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias3.cxx
index e563a5ea2c..09cbc874f2 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias3.cxx
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias3.cxx
@@ -35,15 +35,12 @@
 #include "CbmStsHit.h"
 #include "CbmStsTrack.h"
 #include "CbmTrackMatchNew.h"
-
 #include "FairRootManager.h"
-
+#include "KFParticle/KFParticle.h"
 #include "TDirectory.h"
 
 #include <iostream>
 
-#include "KFParticle.h"
-
 
 using namespace std;
 
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias4.cxx b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias4.cxx
index 784ec3a309..3e88f32a8a 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias4.cxx
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionManualmbias4.cxx
@@ -35,15 +35,12 @@
 #include "CbmStsHit.h"
 #include "CbmStsTrack.h"
 #include "CbmTrackMatchNew.h"
-
 #include "FairRootManager.h"
-
+#include "KFParticle/KFParticle.h"
 #include "TDirectory.h"
 
 #include <iostream>
 
-#include "KFParticle.h"
-
 
 using namespace std;
 
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionPhotons.cxx b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionPhotons.cxx
index 383142610a..6fa275f7e0 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionPhotons.cxx
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionPhotons.cxx
@@ -32,13 +32,11 @@
 #include "CbmStsHit.h"
 #include "CbmStsTrack.h"
 #include "CbmTrackMatchNew.h"
-
 #include "FairRootManager.h"
+#include "KFParticle/KFParticle.h"
 
 #include <iostream>
 
-#include "KFParticle.h"
-
 using namespace std;
 
 CbmKresConversionPhotons::CbmKresConversionPhotons()
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionPhotons.h b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionPhotons.h
index 8b3180e5f6..0659003f1c 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionPhotons.h
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresConversionPhotons.h
@@ -13,12 +13,11 @@
 #include "CbmRichRingFitterEllipseTau.h"
 #include "CbmStsTrack.h"
 #include "CbmVertex.h"
-
+#include "KFParticle/KFParticle.h"
+#include "LmvmKinePar.h"
 #include "TH2D.h"
-#include <TClonesArray.h>
 
-#include "KFParticle.h"
-#include "LmvmKinePar.h"
+#include <TClonesArray.h>
 
 class CbmRichRingFitterEllipseTau;
 
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresEta.cxx b/analysis/PWGDIL/dielectron/pi0eta/CbmKresEta.cxx
index c0093c38b7..19d6ef5cc0 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresEta.cxx
+++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresEta.cxx
@@ -33,15 +33,12 @@
 #include "CbmStsHit.h"
 #include "CbmStsTrack.h"
 #include "CbmTrackMatchNew.h"
-
 #include "FairRootManager.h"
-
+#include "KFParticle/KFParticle.h"
 #include "TDirectory.h"
 
 #include <iostream>
 
-#include "KFParticle.h"
-
 
 using namespace std;
 
diff --git a/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx b/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx
index 94b4db1a0e..b9bde2c271 100644
--- a/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx
+++ b/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx
@@ -5,7 +5,7 @@
 #include "ATKFParticleFinder.h"
 
 #include "AnalysisTree/Matching.hpp"
-#include "KFParticleTopoReconstructor.h"
+#include "KFParticle/KFParticleTopoReconstructor.h"
 
 void ATKFParticleFinder::InitInput(const std::string& file_name, const std::string& tree_name)
 {
diff --git a/external/InstallKFParticle.cmake b/external/InstallKFParticle.cmake
index 0e9724197a..60b0bc3390 100644
--- a/external/InstallKFParticle.cmake
+++ b/external/InstallKFParticle.cmake
@@ -4,6 +4,9 @@ set(KFPARTICLE_SRC_URL "https://github.com/cbmsw/KFParticle.git")
 set(KFPARTICLE_DESTDIR "${CMAKE_BINARY_DIR}/external/KFPARTICLE-prefix")
 set(KFPARTICLE_TAG     "9b11e3e9da4e0896af80701210d19f7ca69c39d4")
 
+set(KF_MACOS_ARM_PATCH  "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle_applem1.patch")
+set(KF_CLANG_TINY_PATCH "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle_clang_tidy.patch")
+set(KF_INCLUDE_PATCH    "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle_header_install.patch")
 # GIT_TAG is a hash for KFParticle tag cbm/v1.1-1
 if (CMAKE_SYSTEM_NAME MATCHES Darwin AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm64)
   download_project_if_needed(PROJECT         kfparticle_source
@@ -11,7 +14,7 @@ if (CMAKE_SYSTEM_NAME MATCHES Darwin AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm64
                              GIT_TAG         ${KFPARTICLE_TAG}
                              SOURCE_DIR      ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle
                              TEST_FILE       CMakeLists.txt
-                             PATCH_COMMAND   "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle_applem1.patch"
+                             PATCH_COMMAND   "${KF_MACOS_ARM_PATCH} && ${KF_INCLUDE_PATCH}"
                             )
 else()
   if(BUILD_FOR_TIDY)
@@ -20,7 +23,7 @@ else()
                                GIT_TAG         ${KFPARTICLE_TAG}
                                SOURCE_DIR      ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle
                                TEST_FILE       CMakeLists.txt
-                               PATCH_COMMAND   "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle_clang_tidy.patch"
+                               PATCH_COMMAND   "${KF_CLANG_TINY_PATCH} && ${KF_INCLUDE_PATCH}"
                               )
   else()
     download_project_if_needed(PROJECT         kfparticle_source
@@ -28,6 +31,7 @@ else()
                                GIT_TAG         ${KFPARTICLE_TAG}
                                SOURCE_DIR      ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle
                                TEST_FILE       CMakeLists.txt
+                               PATCH_COMMAND   "${KF_INCLUDE_PATCH}"
                               )
   endif()
 endif()
@@ -37,8 +41,8 @@ If(ProjectUpdated)
   Message("KFParticle source directory was changed so build directory was deleted")
 EndIf()
 
-if(NOT EXISTS ${CMAKE_BINARY_DIR}/include)
-  file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include)
+if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/KFParticle)
+  file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include/KFParticle)
 endif()
 
 ExternalProject_Add(KFPARTICLE
@@ -69,7 +73,16 @@ ExternalProject_Add(KFPARTICLE
 add_library(KFParticle SHARED IMPORTED GLOBAL)
 set_target_properties(KFParticle PROPERTIES
   IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}KFParticle${CMAKE_SHARED_LIBRARY_SUFFIX}
-  INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include)
+)
+target_include_directories( KFParticle
+  INTERFACE
+    ${CMAKE_BINARY_DIR}/include
+    ${CMAKE_BINARY_DIR}/include/KFParticle
+    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/KFParticle>
+    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/KFParticlePerformance>
+    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/KFParticleTest>
+)
 target_link_libraries(KFParticle INTERFACE Vc::Vc)
 
 
@@ -81,19 +94,53 @@ Install(FILES ${CMAKE_BINARY_DIR}/lib/${KFPARTICLE_LIBNAME}
         DESTINATION lib
        )
 
-Install(FILES ${CMAKE_BINARY_DIR}/include/KFParticleBase.h
-              ${CMAKE_BINARY_DIR}/include/KFParticle.h
-              ${CMAKE_BINARY_DIR}/include/KFVertex.h
+Install(FILES ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticleBase.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticle.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFVertex.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticleTopoReconstructor.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFTopoPerformance.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFPTrackVector.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFMCTrack.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticleSIMD.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticlePerformanceBase.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFPVEfficiencies.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFMCVertex.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFPartMatch.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticlePVReconstructor.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticleFinder.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticleBaseSIMD.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticleDef.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFPSimdAllocator.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFPTrack.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFPEmcCluster.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticleField.h
+              # Next are copies of those in other folders, needed to load CBM libraries
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFMCParticle.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFPartEfficiencies.h
         DESTINATION include/KFParticle
        )
-Install(FILES ${CMAKE_BINARY_DIR}/include/KFMCParticle.h
-              ${CMAKE_BINARY_DIR}/include/KFPartEfficiencies.h
+# Next are copies of those in other folders, needed exactly at this path to load the KFParticle library
+# => Not completely sure why but it seems that while no path is provided in the KF own includes, the G__KFParticle.cxx
+#    file is generated with these "internal paths", for example at line 37-43
+# ===========================================================
+#    [...]
+#    // Header files passed as explicit arguments
+#    #include "KFParticle/KFParticleBase.h"
+#    #include "KFParticle/KFParticle.h"
+#    #include "KFParticle/KFVertex.h"
+#    #include "KFParticlePerformance/KFPartEfficiencies.h"
+#    #include "KFParticlePerformance/KFMCParticle.h"
+#    #include "KFParticleTest/KFParticleTest.h"
+#    [...]
+# ===========================================================
+Install(FILES ${CMAKE_BINARY_DIR}/include/KFParticle/KFMCParticle.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFPartEfficiencies.h
         DESTINATION include/KFParticlePerformance
        )
-Install(FILES ${CMAKE_BINARY_DIR}/include/KFParticleTest.h
+Install(FILES ${CMAKE_BINARY_DIR}/include/KFParticle/KFParticleTest.h
         DESTINATION include/KFParticleTest
        )
-Install(FILES ${CMAKE_BINARY_DIR}/include/KFPVertex.h
-              ${CMAKE_BINARY_DIR}/include/KFMCCounter.h
+Install(FILES ${CMAKE_BINARY_DIR}/include/KFParticle/KFPVertex.h
+              ${CMAKE_BINARY_DIR}/include/KFParticle/KFMCCounter.h
         DESTINATION include
        )
diff --git a/external/KFParticle_header_install.patch b/external/KFParticle_header_install.patch
new file mode 100644
index 0000000000..5c8ec406e8
--- /dev/null
+++ b/external/KFParticle_header_install.patch
@@ -0,0 +1,42 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index dffa254..ec48865 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -35,6 +35,7 @@ EndIf()
+ Set(INCLUDE_DIRECTORIES
+   ${PROJECT_SOURCE_DIR}/KFParticle
+   ${PROJECT_SOURCE_DIR}/KFParticlePerformance
++  ${PROJECT_SOURCE_DIR}/KFParticleTest
+ )
+ 
+ include(${ROOT_USE_FILE})
+@@ -45,7 +46,7 @@ set(CMAKE_INCLUDE_DIRECTORIES_BEFORE OFF)
+ set(LINK_DIRECTORIES
+   ${ROOT_LIBRARY_DIR}
+ )
+- 
++
+ link_directories( ${LINK_DIRECTORIES})
+ 
+ set (SOURCES
+@@ -137,7 +138,7 @@ Set(NODICT_HEADERS
+   KFParticlePerformance/KFPartMatch.h
+ )
+ 
+-install(FILES ${HEADERS} ${NODICT_HEADERS} DESTINATION include)
++install(FILES ${HEADERS} ${NODICT_HEADERS} DESTINATION include/KFParticle)
+ install(FILES ${CMAKE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}KFParticle_rdict.pcm DESTINATION lib OPTIONAL)
+ install(FILES ${CMAKE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}KFParticle.rootmap DESTINATION lib)
+ install(TARGETS KFParticle DESTINATION lib)
+diff --git a/KFLinkDef.h b/KFLinkDef.h
+index d51285b..35afa80 100644
+--- a/KFLinkDef.h
++++ b/KFLinkDef.h
+@@ -10,7 +10,6 @@
+ #pragma link C++ class KFVertex + ;
+ #pragma link C++ class KFPartEfficiencies + ;
+ #pragma link C++ class KFMCParticle + ;
+-#pragma link C++ class KFParticle + ;
+ #pragma link C++ class KFParticleTest + ;
+ 
+ #endif
diff --git a/reco/KF/CbmKFParticleFinder.cxx b/reco/KF/CbmKFParticleFinder.cxx
index 7ffc2dd17b..6e8f840385 100644
--- a/reco/KF/CbmKFParticleFinder.cxx
+++ b/reco/KF/CbmKFParticleFinder.cxx
@@ -21,8 +21,8 @@
 #include "FairRunAna.h"
 
 //KF Particle headers
-#include "KFPTrackVector.h"
-#include "KFParticleTopoReconstructor.h"
+#include "KFParticle/KFPTrackVector.h"
+#include "KFParticle/KFParticleTopoReconstructor.h"
 
 #include <Logger.h>
 
diff --git a/reco/KF/CbmKFParticleFinderQa.cxx b/reco/KF/CbmKFParticleFinderQa.cxx
index 0755843f8a..d3d50e64ca 100644
--- a/reco/KF/CbmKFParticleFinderQa.cxx
+++ b/reco/KF/CbmKFParticleFinderQa.cxx
@@ -15,12 +15,12 @@
 #include "CbmTrack.h"
 #include "CbmTrackMatchNew.h"
 #include "FairRunAna.h"
+#include "KFParticleMatch.h"
 
 //KF Particle headers
-#include "KFMCTrack.h"
-#include "KFParticleMatch.h"
-#include "KFParticleTopoReconstructor.h"
-#include "KFTopoPerformance.h"
+#include "KFParticle/KFMCTrack.h"
+#include "KFParticle/KFParticleTopoReconstructor.h"
+#include "KFParticle/KFTopoPerformance.h"
 
 //ROOT headers
 #include "TCanvas.h"
diff --git a/reco/KF/CbmKFParticleInterface.cxx b/reco/KF/CbmKFParticleInterface.cxx
index 51de3abbec..d2a583106f 100644
--- a/reco/KF/CbmKFParticleInterface.cxx
+++ b/reco/KF/CbmKFParticleInterface.cxx
@@ -13,9 +13,9 @@
 #include "CbmStsTrack.h"
 
 //KF Particle headers
-#include "KFPTrackVector.h"
-#include "KFParticle.h"
-#include "KFParticleSIMD.h"
+#include "KFParticle/KFPTrackVector.h"
+#include "KFParticle/KFParticle.h"
+#include "KFParticle/KFParticleSIMD.h"
 
 //ROOT headers
 #include "TClonesArray.h"  //to get arrays from the FairRootManager
diff --git a/reco/KF/CbmKFV0FinderTask.h b/reco/KF/CbmKFV0FinderTask.h
index 274eb4e4df..4a7a3fa694 100644
--- a/reco/KF/CbmKFV0FinderTask.h
+++ b/reco/KF/CbmKFV0FinderTask.h
@@ -17,7 +17,7 @@
 #include "CbmKFVertex.h"
 #include "CbmVertex.h"
 #include "FairTask.h"
-#include "KFParticleTopoReconstructor.h"
+#include "KFParticle/KFParticleTopoReconstructor.h"
 
 #include <memory>
 
-- 
GitLab


From 748ae550f47229e5bf84fa7bb95b7baa892c9a81 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Fri, 28 Mar 2025 15:02:22 +0100
Subject: [PATCH 12/12] Core: add 2 RICH headers to dict, used by analysis
 (hidden by KFP crash bef.)

---
 core/detectors/rich/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/detectors/rich/CMakeLists.txt b/core/detectors/rich/CMakeLists.txt
index 200512a82a..73a586a68f 100644
--- a/core/detectors/rich/CMakeLists.txt
+++ b/core/detectors/rich/CMakeLists.txt
@@ -8,14 +8,14 @@ set(SRCS
   CbmRichEventDisplay.cxx
   CbmRichContFact.cxx
   CbmMcbm2018RichPar.cxx
+  CbmRichElectronIdAnn.cxx    # Used/exposed in analysis/PWGDIL/dielectron/conversion/CbmAnaConversionReco.h
+  utils/CbmRichUtil.cxx       # Used/exposed in analysis/PWGDIL/dielectron/papaframework/PairAnalysisVarManager.h
   )
 
 set(NO_DICT_SRCS
-  CbmRichElectronIdAnn.cxx
   CbmRichGeoManager.cxx
   CbmRichDigiMapManager.cxx
   CbmRichMCbmDigiMapManager.cxx
-  utils/CbmRichUtil.cxx
   )
 
 
-- 
GitLab