diff --git a/NPSimulation/src/AnnularS1.cc b/NPSimulation/src/AnnularS1.cc index f91826528519cb26167869002accafc4633bcfcb..9b39717d9147a9ead892a2219f1561f626f6a453 100644 --- a/NPSimulation/src/AnnularS1.cc +++ b/NPSimulation/src/AnnularS1.cc @@ -9,7 +9,7 @@ * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * * * * Creation Date : 21/07/09 * - * Last update : 11/10/09 * + * Last update : 16/10/09 * *---------------------------------------------------------------------------* * Decription: Define the S1 detector from Micron * * * @@ -251,39 +251,63 @@ void AnnularS1::ReadConfiguration(string Path) string LineBuffer, DataBuffer; G4double Z = 0; - bool check_Z = false; + bool check_Z = false , check_VIS=false,ReadingStatus = false ; while (!ConfigFile.eof()) { getline(ConfigFile, LineBuffer); - if (LineBuffer.compare(0, 9, "AnnularS1") == 0) { - G4cout << "///" << G4endl ; - G4cout << "Annular element found: " << G4endl ; - ConfigFile >> DataBuffer; - //Position method - if (DataBuffer.compare(0, 2, "Z=") == 0) { - check_Z = true; - ConfigFile >> DataBuffer ; - Z = atof(DataBuffer.c_str()) ; - Z = Z * mm; - cout << "Z: " << Z / mm << endl; - } - - ConfigFile >> DataBuffer; - if (DataBuffer.compare(0, 4, "VIS=") == 0) { - ConfigFile >> DataBuffer; - if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; - } - //Add The previously define telescope - //With position method - if (check_Z) { - AddModule(Z); - } - else { - G4cout << "Wrong Token, AnnularS1 Annular Element not added" << G4endl; - } - } + if (LineBuffer.compare(0, 9, "AnnularS1") == 0) { + G4cout << "///" << G4endl ; + G4cout << "Annular element found: " << G4endl ; + ReadingStatus = true ; + } + + else ReadingStatus = false ; + + while(ReadingStatus) + { + ConfigFile >> DataBuffer; + + //Search for comment Symbol % + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + //Position method + else if (DataBuffer.compare(0, 2, "Z=") == 0) { + check_Z = true; + ConfigFile >> DataBuffer ; + Z = atof(DataBuffer.c_str()) ; + Z = Z * mm; + cout << "Z: " << Z / mm << endl; + } + + else if (DataBuffer.compare(0, 4, "VIS=") == 0) { + check_VIS = true ; + ConfigFile >> DataBuffer; + if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; + } + + + /////////////////////////////////////////////////// + // If no Detector Token and no comment, toggle out + else + {ReadingStatus = false; G4cout << "Wrong Token Sequence: Getting out " << DataBuffer << G4endl ;} + + + //Add The previously define telescope + //With position method + if (check_Z&&check_VIS) { + AddModule(Z); + check_Z = false ; + check_VIS=false ; + ReadingStatus = false ; + cout << "///"<< endl ; + } + + } + + + } } diff --git a/NPSimulation/src/EventGeneratorBeam.cc b/NPSimulation/src/EventGeneratorBeam.cc index 664ccf1d592f38eeb07ecfcb7233131ea65a443b..1b83395f5ac8a65e8570556d5f10db5a81e664ac 100644 --- a/NPSimulation/src/EventGeneratorBeam.cc +++ b/NPSimulation/src/EventGeneratorBeam.cc @@ -19,6 +19,10 @@ * * * * *****************************************************************************/ + +// C++ +#include <limits> + // G4 header #include "G4ParticleTable.hh" @@ -91,7 +95,7 @@ void EventGeneratorBeam::ReadConfiguration(string Path) ReactionFile >> DataBuffer; //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) {/*Do Nothing*/;} + if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} else if (DataBuffer.compare(0, 10, "ParticleZ=") == 0) { check_Z = true ; diff --git a/NPSimulation/src/EventGeneratorIsotropic.cc b/NPSimulation/src/EventGeneratorIsotropic.cc index c60482c0471de284466993cd5090327195323136..b2814747a18ab3633cd2e20d5b7071001c05f624 100644 --- a/NPSimulation/src/EventGeneratorIsotropic.cc +++ b/NPSimulation/src/EventGeneratorIsotropic.cc @@ -19,6 +19,9 @@ * * * * *****************************************************************************/ +// C++ +#include<limits> + // G4 headers #include "G4ParticleTable.hh" @@ -99,7 +102,7 @@ void EventGeneratorIsotropic::ReadConfiguration(string Path) ReactionFile >> DataBuffer; //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) {/*Do Nothing*/;} + if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} else if (DataBuffer.compare(0, 10, "EnergyLow=") == 0) { check_EnergyLow = true ; diff --git a/NPSimulation/src/EventGeneratorTransfert.cc b/NPSimulation/src/EventGeneratorTransfert.cc index 87bba8e1144d8b126c41c8e9071a2feb4d795a18..d0b3b32b6098f17e72b93da3461e5abc02937c5d 100644 --- a/NPSimulation/src/EventGeneratorTransfert.cc +++ b/NPSimulation/src/EventGeneratorTransfert.cc @@ -24,6 +24,7 @@ // C++ headers #include <iostream> #include <fstream> +#include <limits> // G4 header defining G4 types #include "globals.hh" @@ -174,7 +175,7 @@ while(ReadingStatus){ ReactionFile >> DataBuffer; //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) {/* Do Nothing */;} + if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} else if (DataBuffer.compare(0, 5, "Beam=") == 0) { check_Beam = true ; diff --git a/NPSimulation/src/EventGeneratorTransfertToResonance.cc b/NPSimulation/src/EventGeneratorTransfertToResonance.cc index 07742f8c9645680f00b9143353089548e33a3c12..c199ed8fe2f1f0d97a0445f0ff8a7a28b15cbb0b 100644 --- a/NPSimulation/src/EventGeneratorTransfertToResonance.cc +++ b/NPSimulation/src/EventGeneratorTransfertToResonance.cc @@ -25,6 +25,7 @@ // C++ headers #include <iostream> #include <fstream> +#include <limits> // G4 header defining G4 types #include "globals.hh" @@ -190,7 +191,7 @@ while(ReadingStatus){ ReactionFile >> DataBuffer; //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) {/* Do Nothing */;} + if (DataBuffer.compare(0, 1, "%") == 0) { ReactionFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} else if (DataBuffer.compare(0, 5, "Beam=") == 0) { check_Beam = true ; diff --git a/NPSimulation/src/MUST2Array.cc b/NPSimulation/src/MUST2Array.cc index 5571d526603b26052f2e7ada31b3c0245826e008..83c65039c50c7cee9ee430608ef34dee3d4b57fc 100644 --- a/NPSimulation/src/MUST2Array.cc +++ b/NPSimulation/src/MUST2Array.cc @@ -9,7 +9,7 @@ * Original Author: Adrien MATTA contact address: matta@ipno.in2p3.fr * * * * Creation Date : January 2009 * - * Last update : * + * Last update : October 2009 * *---------------------------------------------------------------------------* * Decription: * * This file describe the MUST2 charge particle Detector * diff --git a/NPSimulation/src/Plastic.cc b/NPSimulation/src/Plastic.cc index 698be1e4f21bde588a8f5d70f157781ab01d1035..5c569b85ed93a11229a27cb335d73d6980148786 100644 --- a/NPSimulation/src/Plastic.cc +++ b/NPSimulation/src/Plastic.cc @@ -22,7 +22,7 @@ // C++ headers #include <sstream> #include <cmath> - +#include <limits> //G4 Geometry object #include "G4Tubs.hh" @@ -152,7 +152,7 @@ void Plastic::ReadConfiguration(string Path) ConfigFile >> DataBuffer ; // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} // Finding another telescope (safety), toggle out else if (DataBuffer.compare(0, 6, "Plastic") == 0) { diff --git a/NPSimulation/src/Target.cc b/NPSimulation/src/Target.cc index 589f643d40f9e7cac751064cb0bfc545715ca984..e176eae06111165479ac91c3dc1ccff7fc5db651 100644 --- a/NPSimulation/src/Target.cc +++ b/NPSimulation/src/Target.cc @@ -25,7 +25,7 @@ *****************************************************************************/ // C++ header #include <fstream> - +#include <limits> // G4 geometry header #include "G4Tubs.hh" @@ -232,7 +232,7 @@ void Target::ReadConfiguration(string Path) ConfigFile >> DataBuffer; //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) {/*Do Nothing*/;} + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} else if (DataBuffer.compare(0, 10, "THICKNESS=") == 0) { check_Thickness = true ; diff --git a/NPSimulation/src/ThinSi.cc b/NPSimulation/src/ThinSi.cc index e03aeaf948e42e701fe7e843e1fd37dffacee17c..a196e56324f03402947b3942876cf0dacb4279bb 100644 --- a/NPSimulation/src/ThinSi.cc +++ b/NPSimulation/src/ThinSi.cc @@ -9,7 +9,7 @@ * Original Author: Adrien MATTA contact address: matta@ipno.in2p3.fr * * * * Creation Date : January 2009 * - * Last update : * + * Last update : October 2009 * *---------------------------------------------------------------------------* * Decription: * * This class describe a 20um Silicium detector * @@ -22,7 +22,7 @@ // C++ headers #include <sstream> #include <cmath> - +#include <limits> //G4 Geometry object #include "G4Trd.hh" #include "G4Box.hh" @@ -309,7 +309,7 @@ void ThinSi::ReadConfiguration(string Path) ConfigFile >> DataBuffer ; // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} // Finding another telescope (safety), toggle out else if (DataBuffer.compare(0, 6, "ThinSi") == 0) {