#include "G4RunManager.hh" #include "G4UImanager.hh" #include "PiMuG4DetectorConstruction.hh" #include "PiMuG4PrimaryGeneratorAction.hh" #include "PiMuG4UserRunAction.hh" #include "PiMuG4UserEventAction.hh" #include "QGSP_FTFP_BERT.hh" #include "G4UItcsh.hh" #include "G4UIterminal.hh" #include "G4UIsession.hh" #include "G4VisExecutive.hh" #include using namespace std; int main(int narg, char *argv[]) { // Optional arguments are: NumEvents ptype // where ptype is a string like "pi+" or "mu+" int Nevents=0; const char *ptype="pi+"; if(narg>1) Nevents = atoi(argv[1]); if(narg>2) ptype = argv[2]; // construct the default run manager G4RunManager* runManager = new G4RunManager; // set mandatory initialization classes runManager->SetUserInitialization(new PiMuG4DetectorConstruction); // Use the QGSP_BERT and FTFP_BERT default physics lists // as suggested at: http://geant4.cern.ch/support/proc_mod_catalog/physics_lists/useCases.shtml runManager->SetUserInitialization(new QGSP_FTFP_BERT); // set user action classes runManager->SetUserAction(new PiMuG4PrimaryGeneratorAction(ptype)); runManager->SetUserAction(new PiMuG4UserRunAction()); runManager->SetUserAction(new PiMuG4UserEventAction()); // set up visualization G4VisManager* visManager = new G4VisExecutive; visManager->Initialize(); // initialize G4 kernel runManager->Initialize(); // If user specified some number of events, process those // and then exit. Otherwise, drop into interactive mode. if(Nevents>0){ cout<BeamOn(Nevents); }else{ // get the pointer to the UI manager and set verbosities G4UItcsh *tcsh = new G4UItcsh(); tcsh->SetPrompt("$s>"); G4UIsession *session = new G4UIterminal(tcsh); session->SessionStart(); } // job termination delete runManager; cout<