source: trunk/examples/advanced/radioprotection/remsim.cc @ 1282

Last change on this file since 1282 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 4.1 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: remsim.cc,v 1.14 2006/07/24 09:53:27 guatelli Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29
30#include "G4RunManager.hh"
31#include "G4UImanager.hh"
32#include "G4UIterminal.hh"
33#include "RemSimDetectorConstruction.hh"
34#include "RemSimPhysicsList.hh"
35#include "RemSimPrimaryGeneratorAction.hh"
36#include "RemSimEventAction.hh"
37#include "RemSimRunAction.hh"
38#include "RemSimSteppingAction.hh"
39#ifdef G4VIS_USE
40#include "G4VisExecutive.hh"
41#endif
42#ifdef G4ANALYSIS_USE
43#include "RemSimAnalysisManager.hh"
44#endif
45#include "G4UItcsh.hh"
46
47int main(int argc,char** argv)
48{
49  // Construct the default run manager
50  G4RunManager* runManager = new G4RunManager;
51
52  //  HepRandom :: setTheSeed(0);
53  // Set mandatory initialization classes
54 
55  // Geometry
56  RemSimDetectorConstruction* detector = new RemSimDetectorConstruction();
57  runManager -> SetUserInitialization(detector);
58 
59  // Physics
60  runManager->SetUserInitialization(new RemSimPhysicsList);
61
62  // Set mandatory user action class
63
64  // Primary particles
65  RemSimPrimaryGeneratorAction* primary = new RemSimPrimaryGeneratorAction();
66  runManager -> SetUserAction(primary);
67 
68  // Set optional user action class
69  RemSimEventAction* event = new RemSimEventAction();
70  runManager -> SetUserAction(event);
71
72  RemSimRunAction* run = new RemSimRunAction();
73  runManager -> SetUserAction(run);
74
75  runManager -> SetUserAction(new RemSimSteppingAction(primary));
76
77#ifdef G4VIS_USE
78   // Visualisation
79   G4VisManager* visManager = new G4VisExecutive;
80   visManager -> Initialize();
81#endif
82
83#ifdef G4ANALYSIS_USE
84 RemSimAnalysisManager* analysis = RemSimAnalysisManager::getInstance();
85 analysis -> SetFormat("hbook");
86#endif
87 
88  // get the pointer to the UI manager and set verbosities
89  G4UImanager* UI = G4UImanager::GetUIpointer();
90   
91  if(argc == 1)
92    // Define (G)UI terminal for interactive mode 
93    { 
94      // G4UIterminal is a (dumb) terminal.
95      G4UIsession * session = 0;
96#ifdef G4UI_USE_TCSH
97      session = new G4UIterminal(new G4UItcsh);     
98#else
99      session = new G4UIterminal();
100#endif   
101
102      UI -> ApplyCommand("/control/execute vis.mac");   
103      session -> SessionStart();
104      delete session;
105    }
106  else
107    // Batch mode
108    { 
109      G4String command = "/control/execute ";
110      G4String fileName = argv[1];
111      UI -> ApplyCommand(command+fileName);
112    }
113
114#ifdef G4ANALYSIS_USE
115 analysis -> finish();
116#endif
117
118#ifdef G4VIS_USE
119 delete visManager;
120#endif
121
122  // job termination
123  delete runManager;
124 
125  return 0;
126}
127
Note: See TracBrowser for help on using the repository browser.