Geant4.10
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
dnageometry.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "SteppingAction.hh"
#include "HistoManager.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 56 of file dnageometry.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4RunManager::Initialize(), G4VisManager::Initialize(), G4UIsession::SessionStart(), G4RunManager::SetUserAction(), and G4RunManager::SetUserInitialization().

57 {
58  // Choose the Random engine
59 
60  G4Random::setTheEngine(new CLHEP::RanecuEngine);
61 
62  // Construct the default run manager
63  G4RunManager * runManager = new G4RunManager;
64 
65  // Set mandatory user initialization classes
67  runManager->SetUserInitialization(detector);
68 
69  runManager->SetUserInitialization(new PhysicsList);
70 
71  // Set mandatory user action classes
72  runManager->SetUserAction(new PrimaryGeneratorAction(detector));
73  PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector);
74 
75  HistoManager* histo = new HistoManager();
76 
77  // Set optional user action classes
78  RunAction* RunAct = new RunAction(detector,histo);
79  runManager->SetUserAction(RunAct);
80 
81  runManager->SetUserAction(new SteppingAction(RunAct,detector,primary,histo));
82 
83 #ifdef G4VIS_USE
84  G4VisManager* visManager = new G4VisExecutive;
85  visManager->Initialize();
86 #endif
87 
88  // Initialize G4 kernel
89  runManager->Initialize();
90 
91  remove ("geom_dna.root");
92 
93  // Get the pointer to the User Interface manager
94  G4UImanager* UImanager = G4UImanager::GetUIpointer();
95 
96  if (argc==1) // Define UI session for interactive mode.
97  {
98 #ifdef _WIN32
99  G4UIsession * session = new G4UIterminal();
100 #else
101  G4UIsession * session = new G4UIterminal(new G4UItcsh);
102 #endif
103  UImanager->ApplyCommand("/control/execute dnageometry.mac");
104  session->SessionStart();
105  delete session;
106  }
107  else // Batch mode
108  {
109  G4String command = "/control/execute ";
110  G4String fileName = argv[1];
111  UImanager->ApplyCommand(command+fileName);
112  }
113 
114 #ifdef G4VIS_USE
115  delete visManager;
116 #endif
117 
118  delete runManager;
119 
120  return 0;
121 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:38
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)