From 184657f8855cd12a1805a2e253df752fe540324c Mon Sep 17 00:00:00 2001
From: Chad Lantz <clantz2@illinois.edu>
Date: Tue, 6 Apr 2021 18:09:53 -0500
Subject: [PATCH] Added check to only record photons with negative y momentum
 in intermediate SDs

---
 src/PMTSD.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/PMTSD.cc b/src/PMTSD.cc
index ead1631..099337a 100644
--- a/src/PMTSD.cc
+++ b/src/PMTSD.cc
@@ -116,9 +116,11 @@ G4bool PMTSD::ProcessHits(G4Step* aStep,G4TouchableHistory*){
 
   // Fill ouput vectors
   if(INTERMEDIATE){
-    m_PtrVec[0]->push_back( hitPos.x() );  //Where the photon landed on the PMT in x
-    m_PtrVec[1]->push_back( hitPos.y() );  //Where the photon landed on the PMT in y
-    m_PtrVec[2]->push_back( hitPos.z() );  //Where the photon landed on the PMT in z
+    if(momentum.y() < 0.0){
+      m_PtrVec[0]->push_back( hitPos.x() );  //Where the photon landed on the SD in x
+      m_PtrVec[1]->push_back( hitPos.y() );  //Where the photon landed on the SD in y
+      m_PtrVec[2]->push_back( hitPos.z() );  //Where the photon landed on the SD in z
+    }
   }else{
     m_PtrVec[0]->push_back( origin.x() );  //Origin of the photon in x
     m_PtrVec[1]->push_back( origin.y() );  //Origin of the photon in y
-- 
GitLab