// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** #include "G4UImanager.hh" #include "G4UIterminal.hh" #include "G4UItcsh.hh" #include "G4PhysListFactory.hh" #include "G4VModularPhysicsList.hh" #include "G4UnitsTable.hh" #include "G4UImessenger.hh" #include "globals.hh" #include #include "HistoManager.hh" #include "ActionInitialization.hh" #include "PhysicsList.hh" #include "MaterialDefinitions.hh" #include "BeamlineConstruction.hh" #include "IThembaBeamline.hh" #include "G4VModularPhysicsList.hh" #include "QGSP_BIC.hh" #include "QGSP_BIC_HP.hh" #include "QBBC.hh" namespace CLHEP {} using namespace CLHEP; #ifdef G4MULTITHREADED #include "G4MTRunManager.hh" #else #include "G4RunManager.hh" #endif #ifdef G4UI_USE #include "G4UIExecutive.hh" #endif #ifdef G4VIS_USE #include "G4VisExecutive.hh" #endif #ifdef G4ANALYSIS_USE_ROOT #include "TApplication.h" #endif // ********************************************************************************************************* int main(int argc ,char ** argv) // --------------------------------------------------------------------------------------------------------- { G4String macro; G4String session; #ifdef G4MULTITHREADED G4int nThreads = 1; #endif for ( G4int i=1; iDefineMaterials(); // Create speed & emittance units (not included by default) new G4UnitDefinition ( "meter/second", "m/s", "Speed", m/s ); new G4UnitDefinition ( "millimeter*milliradian", "mm*mrad", "Emittance", mm*mrad ); G4UnitDefinition::BuildUnitsTable(); // new way to make Geant4 actually take a random seed! CLHEP::RanluxEngine defaultEngine(1234567, 4); G4Random::setTheEngine( &defaultEngine ); G4int seed = time(NULL); G4Random::setTheSeed(seed); #ifdef G4MULTITHREADED G4MTRunManager* runManager = new G4MTRunManager; runManager->SetNumberOfThreads(nThreads); #else G4RunManager* runManager = new G4RunManager; #endif BeamlineConstruction* beamline = new BeamlineConstruction(); // IThembaBeamline* beamline = new IThembaBeamline(); runManager->SetUserInitialization(beamline); // Initialize the physics G4VModularPhysicsList* physList = 0; //PhysicsList* physList = new PhysicsList(); //physList->AddPhysicsList("QGSP_BIC_EMY"); physList = new QGSP_BIC(); runManager->SetUserInitialization(physList); #ifdef G4MULTITHREADED if(nThreads<=1) new HistoManager(); #else new HistoManager(); #endif // Optional UserActions: run, event, stepping // NOW ALL NEEDS TO BE DONE INSTIDWE ACTIONINITIALIZATION runManager -> SetUserInitialization(new ActionInitialization); // INITIALIZE THE RUN MANAGER /// NOTE: do not initialize here until I have figured out why the fuck things dont work when I do! //runManager->Initialize(); #ifdef G4VIS_USE // Initialize visualization G4VisManager* visManager = new G4VisExecutive; // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance. // G4VisManager* visManager = new G4VisExecutive("Quiet"); visManager->Initialize(); #endif // Get the pointer to the User Interface manager G4UImanager* UImanager = G4UImanager::GetUIpointer(); if ( macro.size() ) { // batch mode G4String command = "/control/execute "; UImanager->ApplyCommand(command+macro); } else { // interactive mode : define UI session #ifdef G4UI_USE G4UIExecutive* ui = new G4UIExecutive(argc, argv, session); #ifdef G4VIS_USE UImanager->ApplyCommand("/control/execute macro/vis.mac"); #else UImanager->ApplyCommand("/control/execute macro/vis.mac"); #endif if (ui->IsGUI()) UImanager->ApplyCommand("/control/execute macro/vis.mac");//run_iThemba191.mac"); ui->SessionStart(); delete ui; #endif #ifdef G4VIS_USE delete visManager; #endif } /// delete runManager; return 0; }