source: trunk/source/event/test/GeneralParticleSource/gps.cc @ 1316

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

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 3.3 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// This code has been created by C Ferguson, based on
28// example GEANT4 code, for a University of Southampton/
29// DERA/ESA/CERN collaboration. Further information
30// can be obtained from C Ferguson at the University of
31// Southampton.
32//
33
34#include "ExampleDetectorConstruction.hh"
35#include "ExamplePhysicsList.hh"
36#include "ExamplePrimaryGeneratorAction.hh"
37#include "G4UImanager.hh"
38#include "G4UIterminal.hh"
39
40#include "G4RunManager.hh"
41//#include "ExampleVisManager.hh"
42
43#include "G4ios.hh"
44
45int main(int argc,char** argv) {
46
47  int seed, count;
48
49  // Run manager
50  G4RunManager * runManager = new G4RunManager;
51
52  // UserInitialization classes
53  ExampleDetectorConstruction *Mydetector = new ExampleDetectorConstruction;
54  runManager->SetUserInitialization(Mydetector);
55  runManager->SetUserInitialization(new ExamplePhysicsList);
56
57  // Visualization, if you choose to have it!
58  //  G4VisManager* visManager = new ExampleVisManager;
59  //visManager->Initialize();
60   
61  // UserAction classes
62  runManager->SetUserAction(new ExamplePrimaryGeneratorAction);
63 
64  // User interactions
65  G4UImanager * UI = G4UImanager::GetUIpointer(); 
66  UI->ApplyCommand("/run/verbose 1");
67  UI->ApplyCommand("/event/verbose 1");
68  UI->ApplyCommand("/tracking/verbose 1");
69
70  if(argc==1)
71    // Define (G)UI terminal for interactive mode 
72    { 
73      // G4UIterminal is a (dumb) terminal.
74      G4UIsession * session = new G4UIterminal;
75      UI->ApplyCommand("/control/execute prerun.g4mac");   
76      session->SessionStart();
77      delete session;
78    }
79  else {
80    // Batch mode
81    G4String command = "/control/execute ";
82    G4String fileName = argv[1];
83    UI->ApplyCommand(command+fileName);
84  }
85
86  //delete visManager;
87  delete runManager;
88
89  return 0;
90}
91
92
93
94
95
96
97
98
Note: See TracBrowser for help on using the repository browser.