From 1e0d4de9f312173fe683b95cb0ca29c62cbdd908 Mon Sep 17 00:00:00 2001
From: clantz <clantz2@illinois.edu>
Date: Mon, 23 Mar 2020 02:09:20 -0500
Subject: [PATCH] Adjusted GetEvent to read higher precision inputs to set
 momentum vector within 10*-9 of a unit vector

---
 src/ASCIIPrimaryGenerator.cc | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/ASCIIPrimaryGenerator.cc b/src/ASCIIPrimaryGenerator.cc
index 96f77dc..b78769a 100644
--- a/src/ASCIIPrimaryGenerator.cc
+++ b/src/ASCIIPrimaryGenerator.cc
@@ -140,9 +140,9 @@ void ASCIIPrimaryGenerator::GetNextEvent(){
       G4cout << "Error reading input vertex at position " << fInputFile.tellg() << G4endl;
       return;
     }
-    x = std::atof( str.substr(2,12).c_str()  );
-    y = std::atof( str.substr(13,23).c_str() );
-    z = std::atof( str.substr(24,34).c_str() );
+    x = std::atof( str.substr(2,19).c_str()  );
+    y = std::atof( str.substr(20,37).c_str() );
+    z = std::atof( str.substr(38,55).c_str() );
     fPositionVec->push_back( G4ThreeVector(x*mm,y*mm,z*mm) );
 
     //
@@ -152,11 +152,11 @@ void ASCIIPrimaryGenerator::GetNextEvent(){
       G4cout << "Error reading input momentum at position " << fInputFile.tellg() << G4endl;
       return;
     }
-    px = std::atof( str.substr(2,12).c_str()  );
-    py = std::atof( str.substr(13,23).c_str() );
-    pz = std::atof( str.substr(24,34).c_str() );
+    px = std::atof( str.substr(2,19).c_str()  );
+    py = std::atof( str.substr(20,37).c_str() );
+    pz = std::atof( str.substr(38,55).c_str() );
     fMomentumVec->push_back( G4ThreeVector(px,py,pz) );
-    energy = std::atof( str.substr(35,45).c_str() );
+    energy = std::atof( str.substr(56,73).c_str() );
     fEnergyVec->push_back( energy );
 
     //
-- 
GitLab