Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DMX.cc File Reference
Include dependency graph for DMX.cc:

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 64 of file DMX.cc.

64  {
65 
66  // choose the Random engine
67  G4Random::setTheEngine(new CLHEP::RanecuEngine);
68 
69  // Construct the default run manager
70 #ifdef G4MULTITHREADED
71  G4MTRunManager* runManager = new G4MTRunManager;
72  //runManager->SetNumberOfThreads(2);
73 #else
74  G4RunManager* runManager = new G4RunManager;
75 #endif
76 
77  // set mandatory initialization classes
79  runManager->SetUserInitialization(new DMXPhysicsList);
81 
82 #ifdef G4VIS_USE
83  // visualization manager
84  G4VisManager* visManager = new G4VisExecutive;
85  visManager->Initialize();
86 #endif
87 
88 
89 #ifdef DMXENV_GPS_USE
90  G4cout << " Using GPS and not DMX gun " << G4endl;
91 #else
92  G4cout << " Using the DMX gun " << G4endl;
93 #endif
94 
95 
96  //Initialize G4 kernel
97  runManager->Initialize();
98 
99  // get the pointer to the User Interface manager
100  G4UImanager* UImanager = G4UImanager::GetUIpointer();
101 
102  // Define UI session for interactive mode.
103  if(argc == 1)
104  {
105 #ifdef G4UI_USE
106  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
107 #ifdef G4VIS_USE
108  UImanager->ApplyCommand("/control/execute initInter.mac");
109 #endif
110  ui->SessionStart();
111  delete ui;
112 #endif
113  }
114  // Batch mode
115  else
116  {
117  G4String command = "/control/execute ";
118  G4String fileName = argv[1];
119  UImanager->ApplyCommand(command+fileName);
120  }
121 
122  //Close-out analysis:
123  // Save histograms
124  G4AnalysisManager* man = G4AnalysisManager::Instance();
125  man->Write();
126  man->CloseFile();
127  // Complete clean-up
128  delete G4AnalysisManager::Instance();
129 
130 #ifdef G4VIS_USE
131  if(visManager) delete visManager;
132 #endif
133  delete runManager;
134 
135  return 0;
136 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
void Initialize()
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: