From 696f04d5c7ffc8411f60a15b0806a2f56386fb5f Mon Sep 17 00:00:00 2001
From: Benoit <maussb>
Date: Thu, 3 Oct 2024 15:24:41 +0200
Subject: [PATCH] debugging GEFreader

---
 Inputs/EventGenerator/GEFneutron0.source       |  4 +---
 .../EventGenerator/EventGeneratorGEFReader.cc  | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/Inputs/EventGenerator/GEFneutron0.source b/Inputs/EventGenerator/GEFneutron0.source
index 23ff73272..67ae4ea0a 100755
--- a/Inputs/EventGenerator/GEFneutron0.source
+++ b/Inputs/EventGenerator/GEFneutron0.source
@@ -5,9 +5,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 GEFReader
  GEFversion= 2023.33
- EnergyLow= 0.01
- EnergyHigh= 20
- InputDataFile= /home/benoit/Physics/nptool/nptoolv3/Inputs/InputData/test_ng.txt 
+ InputDataFile= /home/benoit/Physics/nptool/nptoolv3/Inputs/InputData/test.lmd 
  x0= 0 
  y0= 0 
  z0= 0 mm 
diff --git a/NPSimulation/EventGenerator/EventGeneratorGEFReader.cc b/NPSimulation/EventGenerator/EventGeneratorGEFReader.cc
index 0c1798687..63b2b6920 100644
--- a/NPSimulation/EventGenerator/EventGeneratorGEFReader.cc
+++ b/NPSimulation/EventGenerator/EventGeneratorGEFReader.cc
@@ -83,14 +83,19 @@ void EventGeneratorGEFReader::ReadConfiguration(NPL::InputParser parser){
       m_Parameters.push_back(SourceParameters());
       const vector<SourceParameters>::reverse_iterator it = m_Parameters.rbegin();
 
-/*      if(blocks[i]->HasToken("GEFversion"))
+      if(blocks[i]->HasToken("GEFversion"))
 	{
-	  it->m_GEFversion=blocks[i]->GetDouble("GEFversion");
-	  if(version>=2023.32 && version<=2023.33) version_shift=0;
-	}*/
+	  it->m_GEFversion=blocks[i]->GetDouble("GEFversion","");
+	  if(it->m_GEFversion>=2023.32 && it->m_GEFversion<=2023.33) version_shift=0;
+	  else if (it->m_GEFversion>=2023.11 && it->m_GEFversion<=2023.12) version_shift=1;
+	  else {
+	    cout << "!!!!!!!!!!!!!!!!! ERROR: GEF version not verified !!!!!!!!!!!!!!!!!!" << endl;
+	    cout << "Check the column positions of your GEF file and" << endl;
+	    cout << "add the version to the shift needed in EventGeneratorGEFReader.cc" << endl;
+	  }
+	}
       if(blocks[i]->HasToken("InputDataFile")){
 	vector<string> file = blocks[i]->GetVectorString("InputDataFile");
-	cout << "Input file to read: " << file[0] << endl;
 	fInputDataFile.open(file.at(0).c_str());
 	HasInputDataFile = true;
 
@@ -105,7 +110,6 @@ void EventGeneratorGEFReader::ReadConfiguration(NPL::InputParser parser){
 	    
 	    iss >> data;
 	    comment=to_string(data);
-	    cout << "comment=" << comment << " data=" << data << endl;
 	    if(comment!="*" && data>0)
 	      {// Storing the first line to be read by GenerateEvent
 		LastLine.push_back(data);
@@ -195,7 +199,7 @@ void EventGeneratorGEFReader::GenerateEvent(G4Event*){
 
 	    while(iss >> data) LastLine.push_back(data);
 
-	    if(DataLine.size()>=26 && DataLine.at(1)==92)
+	    if(DataLine.size()>=26 && DataLine.at(1)>50)
 	      {
 		// Fragment emission
 		for(int frag=0;frag<2;frag++)
-- 
GitLab