diff --git a/NPSimulation/CMakeLists.txt b/NPSimulation/CMakeLists.txt index e0e1e932675146237b5b2488d0d42d0f60411384..8648fb2e11a1985fd6104df3314e49e669b14bdf 100644 --- a/NPSimulation/CMakeLists.txt +++ b/NPSimulation/CMakeLists.txt @@ -60,7 +60,6 @@ if(Geant4_gdml_FOUND) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNPS_GDML") endif() - # set the Geant4 version info set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DNPS_GEANT4_VERSION_MAJOR=${NPS_GEANT4_VERSION_MAJOR}") diff --git a/NPSimulation/Process/BeamReaction.cc b/NPSimulation/Process/BeamReaction.cc index bd5ca564c68bca9f1760d613b67e83c6514db5a5..66eea8347260e59cb66e2af6b34b07d1435fb0c1 100644 --- a/NPSimulation/Process/BeamReaction.cc +++ b/NPSimulation/Process/BeamReaction.cc @@ -113,7 +113,6 @@ G4bool NPS::BeamReaction::IsApplicable(const G4ParticleDefinition& particleType) //////////////////////////////////////////////////////////////////////////////// G4bool NPS::BeamReaction::ModelTrigger(const G4FastTrack& fastTrack) { - //cout<< "--------- MODEL TRIG ---------"<<endl; static double rand = 0; const G4Track* PrimaryTrack = fastTrack.GetPrimaryTrack(); @@ -132,15 +131,15 @@ G4bool NPS::BeamReaction::ModelTrigger(const G4FastTrack& fastTrack) { if(m_Parent_ID!=0) return false; - if(!m_shoot){ - rand = G4RandFlat::shoot(); - m_PreviousLength = m_StepSize; - m_PreviousEnergy = PrimaryTrack->GetKineticEnergy(); - m_PreviousDirection = PrimaryTrack->GetMomentumDirection(); + if(!m_shoot){ + rand = G4RandFlat::shoot(); + m_PreviousLength = m_StepSize; + m_PreviousEnergy = PrimaryTrack->GetKineticEnergy(); + m_PreviousDirection = PrimaryTrack->GetMomentumDirection(); - // Clear Previous Event - m_ReactionConditions->Clear(); - m_shoot=true; + // Clear Previous Event + m_ReactionConditions->Clear(); + m_shoot=true; } else if (((in-m_StepSize) <= 1E-20) && m_shoot) { // last step return true; @@ -171,6 +170,8 @@ G4bool NPS::BeamReaction::ModelTrigger(const G4FastTrack& fastTrack) { m_PreviousEnergy = PrimaryTrack->GetKineticEnergy(); m_PreviousDirection = PrimaryTrack->GetMomentumDirection(); } + else + return true; return false; } diff --git a/NPSimulation/Simulation.cc b/NPSimulation/Simulation.cc index a8e1345365f59cfdb3e3f88efdc0b6b669e1fd4f..d27003e1bf72fdd71df6eb0cedae78d1676cc28c 100644 --- a/NPSimulation/Simulation.cc +++ b/NPSimulation/Simulation.cc @@ -12,13 +12,9 @@ #include "G4UItcsh.hh" #include "G4VisManager.hh" -#ifdef G4VIS_USE #include "G4VisExecutive.hh" -#endif -#ifdef G4UI_USE #include "G4UIExecutive.hh" -#endif // G4 local source #include "DetectorConstruction.hh" @@ -104,9 +100,7 @@ int main(int argc, char** argv){ // Get the pointer to the User Interface manager G4cout << "//////////// Starting UI ////////////"<< endl; G4UImanager* UImanager = G4UImanager::GetUIpointer(); -#ifdef G4UI_USE G4UIExecutive* ui = new G4UIExecutive(argc, argv); -#endif /////////////////////////////////////////////////////////////// @@ -131,21 +125,19 @@ int main(int argc, char** argv){ G4VisManager* visManager=NULL; -#ifdef G4UI_USE if(!OptionManager->GetG4BatchMode()){ string Path_Macro = getenv("NPTOOL"); Path_Macro+="/NPSimulation/ressources/macro/"; UImanager->ApplyCommand("/control/execute " +Path_Macro+"verbose.mac"); - #ifdef G4VIS_USE UImanager->ApplyCommand("/control/execute " +Path_Macro+"aliases.mac"); visManager = new G4VisExecutive("Quiet"); visManager->Initialize(); UImanager->ApplyCommand("/control/execute " +Path_Macro+"vis.mac"); - #endif if (ui->IsGUI()){ UImanager->ApplyCommand("/control/execute " +Path_Macro+"gui.mac"); } + #ifdef __APPLE__ string command= "osascript "; command+= getenv("NPTOOL"); @@ -168,12 +160,9 @@ int main(int argc, char** argv){ delete ui; -#endif -#ifdef G4VIS_USE if(visManager) delete visManager; -#endif /////////////////////////////////////////////////////////////// ////////////////////// Job termination ////////////////////////