From b8e7c5469908b6c4c2d67dbffac1f15e0f7a7e39 Mon Sep 17 00:00:00 2001
From: Valentina <v.akishina@gsi.de>
Date: Sun, 11 Sep 2022 20:49:19 +0200
Subject: [PATCH] CbmKFParticleFinder: set target position for all events in
 timeslice

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

diff --git a/external/InstallKFParticle.cmake b/external/InstallKFParticle.cmake
index 30110cdd24..fc39403c4b 100644
--- a/external/InstallKFParticle.cmake
+++ b/external/InstallKFParticle.cmake
@@ -2,7 +2,7 @@ set(KFPARTICLE_LIBNAME "${CMAKE_SHARED_LIBRARY_PREFIX}KFParticle${CMAKE_SHARED_L
 
 set(KFPARTICLE_SRC_URL "https://github.com/cbmsw/KFParticle.git")
 set(KFPARTICLE_DESTDIR "${CMAKE_BINARY_DIR}/external/KFPARTICLE-prefix")
-set(KFPARTICLE_TAG     "1e1c5dee0e2bd98a3df677beb88e497fbef92504")
+set(KFPARTICLE_TAG     "9b11e3e9da4e0896af80701210d19f7ca69c39d4")
 
 # GIT_TAG is a hash for KFParticle tag cbm/v1.1-1 
 if (CMAKE_SYSTEM_NAME MATCHES Darwin AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm64)
diff --git a/reco/KF/CbmKF.cxx b/reco/KF/CbmKF.cxx
index 2d09348095..2660b1c58c 100644
--- a/reco/KF/CbmKF.cxx
+++ b/reco/KF/CbmKF.cxx
@@ -314,7 +314,7 @@ void CbmKF::GetTargetInfo()
   LOG(info) << "Target info: " << target.KFInfo();
 }
 
-std::array<double, 3> CbmKF::GetTargetPosition() { return fTargetXYZ; }
+const std::array<float, 3> CbmKF::GetTargetPosition() { return fTargetXYZ; }
 
 void CbmKF::FindTargetNode(TString& targetPath, TGeoNode*& targetNode)
 {
diff --git a/reco/KF/CbmKF.h b/reco/KF/CbmKF.h
index 2169aeae0a..b1bde574f7 100644
--- a/reco/KF/CbmKF.h
+++ b/reco/KF/CbmKF.h
@@ -91,7 +91,7 @@ public:
 
   int GetNMvdStations() const { return CbmKF::Instance()->vMvdMaterial.size(); }
 
-  std::array<double, 3> GetTargetPosition();
+  const std::array<float, 3> GetTargetPosition();
 
 private:
   static CbmKF* fInstance;
@@ -113,7 +113,7 @@ private:
 
   void FindTargetNode(TString& targetPath, TGeoNode*& targetNode);
 
-  std::array<double, 3> fTargetXYZ;
+  std::array<float, 3> fTargetXYZ;
 
 
 private:
diff --git a/reco/KF/CbmKFParticleFinder.cxx b/reco/KF/CbmKFParticleFinder.cxx
index 23e8aef0b9..41d872337f 100644
--- a/reco/KF/CbmKFParticleFinder.cxx
+++ b/reco/KF/CbmKFParticleFinder.cxx
@@ -127,7 +127,6 @@ InitStatus CbmKFParticleFinder::Init()
   }
 
   fCbmPrimVertex = (CbmVertex*) ioman->GetObject("PrimaryVertex.");
-
   return kSUCCESS;
 }
 
@@ -144,6 +143,7 @@ void CbmKFParticleFinder::Exec(Option_t* /*opt*/)
   for (int iEvent = 0; iEvent < nEvents; iEvent++) {
     CbmEvent* event = 0;
     if (fTimeSliceMode) event = (CbmEvent*) fEvents->At(iEvent);
+    eventTopoReconstructor[iEvent].SetTarget(fTopoReconstructor->GetTargetPosition());
     eventTopoReconstructor[iEvent].SetChi2PrimaryCut(InversedChi2Prob(0.0001, 2));
     eventTopoReconstructor[iEvent].CopyCuts(fTopoReconstructor);
     eventTopoReconstructor[iEvent].GetKFParticleFinder()->SetReconstructionList(
@@ -581,7 +581,6 @@ void CbmKFParticleFinder::SetSuperEventAnalysis()
 
 
 void CbmKFParticleFinder::SetTarget(const std::array<float, 3>& target) { fTopoReconstructor->SetTarget(target); }
-
 KFParticleFinder* CbmKFParticleFinder::GetKFParticleFinder() { return fTopoReconstructor->GetKFParticleFinder(); }
 void CbmKFParticleFinder::SetMaxDistanceBetweenParticlesCut(float cut)
 {
-- 
GitLab