Import Geant4 9.4.0 source tree
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: exampleN03Con.cc,v 1.2 2007/05/26 00:24:09 tkoi Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: exampleN03Con.cc,v 1.5 2010/11/12 19:16:31 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -33,30 +33,24 @@
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIterminal.hh"
|
||||
#include "G4UItcsh.hh"
|
||||
|
||||
#ifdef G4UI_USE_XM
|
||||
#include "G4UIXm.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4UI_USE_WIN32
|
||||
#include "G4UIWin32.hh"
|
||||
#endif
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PhysicsList.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
#include "SteppingVerbose.hh"
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
#include "G4VisExecutive.hh"
|
||||
#endif
|
||||
|
||||
#include "ExN03DetectorConstruction.hh"
|
||||
#include "ExN03PhysicsList.hh"
|
||||
#include "ExN03PrimaryGeneratorAction.hh"
|
||||
#include "ExN03RunAction.hh"
|
||||
#include "ExN03EventAction.hh"
|
||||
#include "ExN03SteppingAction.hh"
|
||||
#include "ExN03SteppingVerbose.hh"
|
||||
#ifdef G4UI_USE
|
||||
#include "G4UIExecutive.hh"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -68,8 +62,7 @@ int main(int argc,char** argv)
|
||||
|
||||
// User Verbose output class
|
||||
//
|
||||
G4VSteppingVerbose* verbosity = new ExN03SteppingVerbose;
|
||||
G4VSteppingVerbose::SetInstance(verbosity);
|
||||
G4VSteppingVerbose::SetInstance(new SteppingVerbose);
|
||||
|
||||
// Construct the default run manager
|
||||
//
|
||||
@@ -77,92 +70,71 @@ int main(int argc,char** argv)
|
||||
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
ExN03DetectorConstruction* detector = new ExN03DetectorConstruction;
|
||||
DetectorConstruction* detector = new DetectorConstruction;
|
||||
runManager->SetUserInitialization(detector);
|
||||
//
|
||||
G4VUserPhysicsList* physics = new ExN03PhysicsList;
|
||||
PhysicsList* physics = new PhysicsList;
|
||||
runManager->SetUserInitialization(physics);
|
||||
|
||||
G4UIsession* session=0;
|
||||
|
||||
if (argc==1) // Define UI session for interactive mode.
|
||||
{
|
||||
// G4UIterminal is a (dumb) terminal
|
||||
//
|
||||
#if defined(G4UI_USE_XM)
|
||||
session = new G4UIXm(argc,argv);
|
||||
#elif defined(G4UI_USE_WIN32)
|
||||
session = new G4UIWin32();
|
||||
#elif defined(G4UI_USE_TCSH)
|
||||
session = new G4UIterminal(new G4UItcsh);
|
||||
#else
|
||||
session = new G4UIterminal();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
// Visualization manager
|
||||
//
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
#endif
|
||||
|
||||
// Set user action classes
|
||||
//
|
||||
G4VUserPrimaryGeneratorAction* gen_action = new ExN03PrimaryGeneratorAction(detector);
|
||||
PrimaryGeneratorAction* gen_action =
|
||||
new PrimaryGeneratorAction(detector);
|
||||
runManager->SetUserAction(gen_action);
|
||||
//
|
||||
ExN03RunAction* run_action = new ExN03RunAction;
|
||||
RunAction* run_action = new RunAction;
|
||||
runManager->SetUserAction(run_action);
|
||||
//
|
||||
ExN03EventAction* event_action = new ExN03EventAction(run_action);
|
||||
EventAction* event_action = new EventAction(run_action);
|
||||
runManager->SetUserAction(event_action);
|
||||
//
|
||||
G4UserSteppingAction* stepping_action =
|
||||
new ExN03SteppingAction(detector, event_action);
|
||||
SteppingAction* stepping_action =
|
||||
new SteppingAction(detector, event_action);
|
||||
runManager->SetUserAction(stepping_action);
|
||||
|
||||
// Initialize G4 kernel
|
||||
//
|
||||
runManager->Initialize();
|
||||
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
// Initialize visualization
|
||||
//
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
visManager->Initialize();
|
||||
#endif
|
||||
|
||||
// Get the pointer to the User Interface manager
|
||||
//
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
|
||||
if (session) // Define UI session for interactive mode
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
if (argc!=1) // batch mode
|
||||
{
|
||||
// G4UIterminal is a (dumb) terminal
|
||||
//
|
||||
// UI->ApplyCommand("/control/execute vis.mac");
|
||||
#if defined(G4UI_USE_XM) || defined(G4UI_USE_WIN32)
|
||||
// Customize the G4UIXm,Win32 menubar with a macro file
|
||||
//
|
||||
// UI->ApplyCommand("/control/execute visTutor/gui.mac");
|
||||
#endif
|
||||
session->SessionStart();
|
||||
delete session;
|
||||
}
|
||||
else // Batch mode
|
||||
{
|
||||
#ifdef G4VIS_USE
|
||||
visManager->SetVerboseLevel("quiet");
|
||||
#endif
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UI->ApplyCommand(command+fileName);
|
||||
UImanager->ApplyCommand(command+fileName);
|
||||
}
|
||||
|
||||
else
|
||||
{ // interactive mode : define UI session
|
||||
#ifdef G4UI_USE
|
||||
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
|
||||
#ifdef G4VIS_USE
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
#endif
|
||||
if (ui->IsGUI())
|
||||
UImanager->ApplyCommand("/control/execute visTutor/gui.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Job termination
|
||||
// Free the store: user actions, physics_list and detector_description are
|
||||
// owned and deleted by the run manager, so they should not
|
||||
// be deleted in the main() program !
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
delete visManager;
|
||||
#endif
|
||||
#endif
|
||||
delete runManager;
|
||||
delete verbosity;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user