From e8cc5a88164436289c8fb94390676f4510fb687b Mon Sep 17 00:00:00 2001
From: Frank Gaede <frank.gaede@desy.de>
Date: Mon, 11 Jan 2016 14:52:02 +0000
Subject: [PATCH]  - fix hit momentum in Geant4TrackerAction

---
 DDG4/plugins/Geant4SDActions.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/DDG4/plugins/Geant4SDActions.cpp b/DDG4/plugins/Geant4SDActions.cpp
index cdbfa1be3..2bee9fce9 100644
--- a/DDG4/plugins/Geant4SDActions.cpp
+++ b/DDG4/plugins/Geant4SDActions.cpp
@@ -45,16 +45,17 @@ namespace DD4hep {
       Position position  = mean_direction(prePos,postPos);
       double   hit_len   = direction.R();
 
-      if (hit_len > 0) {
-        double new_len = mean_length(h.preMom(),h.postMom())/hit_len;
-        direction *= new_len/hit_len;
-      }
+      // if (hit_len > 0) {
+      //   double new_len = mean_length(h.preMom(),h.postMom())/hit_len;
+      //   direction *= new_len/hit_len;
+      // }
+
       Hit* hit = new Hit(h.trkID(), h.trkPdgID(), h.deposit(), h.track->GetGlobalTime());
       HitContribution contrib = Hit::extractContribution(step);
       hit->cellID        = cellID(step);
       hit->energyDeposit = contrib.deposit;
       hit->position      = position;
-      hit->momentum      = direction;
+      hit->momentum      = 0.5*( h. preMom() + h.postMom() ) ;
       hit->length        = hit_len;
       collection(m_collectionID)->add(hit);
       mark(h.track);
-- 
GitLab