source: trunk/examples/extended/parallel/ParN02/ParN02.cc @ 1337

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

tag geant4.9.4 beta 1 + modifs locales

File size: 4.6 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: ParN02.cc,v 1.5 2006/07/05 12:45:59 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
34#include "ExN02DetectorConstruction.hh"
35#include "ExN02PhysicsList.hh"
36#include "ExN02PrimaryGeneratorAction.hh"
37#include "ExN02RunAction.hh"
38#include "ExN02EventAction.hh"
39#include "ExN02SteppingAction.hh"
40#include "ExN02SteppingVerbose.hh"
41
42#include "G4RunManager.hh"
43#include "G4UImanager.hh"
44#include "G4UIterminal.hh"
45#include "G4UItcsh.hh"
46
47#ifdef G4VIS_USE
48#include "G4VisExecutive.hh"
49#endif
50
51#include "ParTopC.icc"
52
53//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54
55int main(int argc,char** argv)
56{
57  // User Verbose output class
58  //
59  G4VSteppingVerbose* verbosity = new ExN02SteppingVerbose;
60  G4VSteppingVerbose::SetInstance(verbosity);
61 
62  // Run manager
63  //
64  G4RunManager * runManager = new G4RunManager;
65
66  // User Initialization classes (mandatory)
67  //
68  ExN02DetectorConstruction* detector = new ExN02DetectorConstruction;
69  runManager->SetUserInitialization(detector);
70  //
71  G4VUserPhysicsList* physics = new ExN02PhysicsList;
72  runManager->SetUserInitialization(physics);
73 
74#ifdef G4VIS_USE
75  // Visualization, if you choose to have it!
76  //
77  G4VisManager* visManager = new G4VisExecutive;
78  visManager->Initialize();
79#endif
80   
81  // User Action classes
82  //
83  G4VUserPrimaryGeneratorAction* gen_action = new ExN02PrimaryGeneratorAction(detector);
84  runManager->SetUserAction(gen_action);
85  //
86  G4UserRunAction* run_action = new ExN02RunAction;
87  runManager->SetUserAction(run_action); 
88  //
89  G4UserEventAction* event_action = new ExN02EventAction;
90  runManager->SetUserAction(event_action);
91  //
92  G4UserSteppingAction* stepping_action = new ExN02SteppingAction;
93  runManager->SetUserAction(stepping_action);
94
95  // Initialize G4 kernel
96  //
97  runManager->Initialize();
98     
99  // Get the pointer to the User Interface manager
100  //
101  G4UImanager * UI = G4UImanager::GetUIpointer(); 
102
103  if(argc==1)  // Define (G)UI terminal for interactive mode
104  { 
105    // G4UIterminal is a (dumb) terminal
106    //
107    G4UIsession * session = 0;
108#ifdef G4UI_USE_TCSH
109      session = new G4UIterminal(new G4UItcsh);     
110#else
111      session = new G4UIterminal();
112#endif   
113    UI->ApplyCommand("/run/beamOn 10");   
114    session->SessionStart();
115    delete session;
116  }
117  else  // Batch mode
118  { 
119    G4String command = "/control/execute ";
120    G4String fileName = argv[1];
121    UI->ApplyCommand(command+fileName);
122  }
123
124  // Free the store: user actions, physics_list and detector_description are
125  //                 owned and deleted by the run manager, so they should not
126  //                 be deleted in the main() program !
127
128#ifdef G4VIS_USE
129  delete visManager;
130#endif
131  delete runManager;
132  delete verbosity;
133
134  return 0;
135}
136
137//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
138
Note: See TracBrowser for help on using the repository browser.