From 1c13fa16f6a79dfc28aab662166a4cfc6b3e1f20 Mon Sep 17 00:00:00 2001
From: Valentina <v.akishina@gsi.de>
Date: Tue, 23 Aug 2022 06:44:13 +0200
Subject: [PATCH] KF: add setter for target position

---
 external/InstallKFParticle.cmake | 2 +-
 reco/KF/CbmKF.cxx                | 6 ++++++
 reco/KF/CbmKF.h                  | 6 ++++++
 reco/KF/CbmKFParticleFinder.cxx  | 3 +++
 reco/KF/CbmKFParticleFinder.h    | 3 +++
 5 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/external/InstallKFParticle.cmake b/external/InstallKFParticle.cmake
index 9077654497..c1441c8cec 100644
--- a/external/InstallKFParticle.cmake
+++ b/external/InstallKFParticle.cmake
@@ -6,7 +6,7 @@ set(KFPARTICLE_DESTDIR "${CMAKE_BINARY_DIR}/external/KFPARTICLE-prefix")
 # GIT_TAG is a hash for KFParticle tag cbm/v1.1-1 
 download_project_if_needed(PROJECT         kfparticle_source
                            GIT_REPOSITORY  ${KFPARTICLE_SRC_URL}
-                           GIT_TAG         "1eddb796b01d91ac7faf020e3b616556c28da4d0"
+                           GIT_TAG         "1e1c5dee0e2bd98a3df677beb88e497fbef92504"
                            SOURCE_DIR      ${CMAKE_CURRENT_SOURCE_DIR}/KFParticle
                            TEST_FILE       CMakeLists.txt
                           )
diff --git a/reco/KF/CbmKF.cxx b/reco/KF/CbmKF.cxx
index 14b5a66e57..2d09348095 100644
--- a/reco/KF/CbmKF.cxx
+++ b/reco/KF/CbmKF.cxx
@@ -278,6 +278,10 @@ void CbmKF::GetTargetInfo()
   target.y = global[1];
   target.z = global[2];
 
+  fTargetXYZ[0] = target.x;
+  fTargetXYZ[1] = target.y;
+  fTargetXYZ[2] = target.z;
+
   if (fVerbose) {
     cout << "KALMAN FILTER : === READ TARGET MATERIAL ===" << endl;
     cout << " found targed \"" << targetPath << "\" at ( " << target.x << " " << target.y << " " << target.z << " ) "
@@ -310,6 +314,8 @@ void CbmKF::GetTargetInfo()
   LOG(info) << "Target info: " << target.KFInfo();
 }
 
+std::array<double, 3> CbmKF::GetTargetPosition() { return fTargetXYZ; }
+
 void CbmKF::FindTargetNode(TString& targetPath, TGeoNode*& targetNode)
 {
   if (!targetNode) {  // init at the top of the tree
diff --git a/reco/KF/CbmKF.h b/reco/KF/CbmKF.h
index c28d7b9981..2169aeae0a 100644
--- a/reco/KF/CbmKF.h
+++ b/reco/KF/CbmKF.h
@@ -91,6 +91,8 @@ public:
 
   int GetNMvdStations() const { return CbmKF::Instance()->vMvdMaterial.size(); }
 
+  std::array<double, 3> GetTargetPosition();
+
 private:
   static CbmKF* fInstance;
 
@@ -108,8 +110,12 @@ private:
   CbmKFMaterial* ReadPassive(FairGeoNode* node);
   void GetTargetInfo();
 
+
   void FindTargetNode(TString& targetPath, TGeoNode*& targetNode);
 
+  std::array<double, 3> fTargetXYZ;
+
+
 private:
   CbmKF(const CbmKF&);
   void operator=(const CbmKF&);
diff --git a/reco/KF/CbmKFParticleFinder.cxx b/reco/KF/CbmKFParticleFinder.cxx
index 88d7ab4951..83718f4f26 100644
--- a/reco/KF/CbmKFParticleFinder.cxx
+++ b/reco/KF/CbmKFParticleFinder.cxx
@@ -579,6 +579,9 @@ void CbmKFParticleFinder::SetSuperEventAnalysis()
   fTopoReconstructor->SetMixedEventAnalysis();
 }
 
+
+void CbmKFParticleFinder::SetTarget(const std::array<float, 3>& target) { fTopoReconstructor->SetTarget(target); }
+
 KFParticleFinder* CbmKFParticleFinder::GetKFParticleFinder() { return fTopoReconstructor->GetKFParticleFinder(); }
 void CbmKFParticleFinder::SetMaxDistanceBetweenParticlesCut(float cut)
 {
diff --git a/reco/KF/CbmKFParticleFinder.h b/reco/KF/CbmKFParticleFinder.h
index 0781b846ef..7cb22c0fe5 100644
--- a/reco/KF/CbmKFParticleFinder.h
+++ b/reco/KF/CbmKFParticleFinder.h
@@ -50,12 +50,15 @@ public:
 
   void SetPIDInformation(CbmKFParticleFinderPID* pid) { fPID = pid; }
 
+
   // set cuts
   void SetPrimaryProbCut(float prob);
 
   // Set SE analysis
   void SetSuperEventAnalysis();
 
+  void SetTarget(const std::array<float, 3>& target);
+
   //KF Particle Finder cuts
   void SetMaxDistanceBetweenParticlesCut(float cut);
   void SetLCut(float cut);
-- 
GitLab