source: trunk/examples/extended/electromagnetic/TestEm8/TestEm8.cc@ 1353

Last change on this file since 1353 was 1342, checked in by garnier, 15 years ago

update ti head

File size: 3.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// $Id: TestEm8.cc,v 1.10 2010/09/08 09:12:10 vnivanch Exp $
27// GEANT4 tag $Name: examples-V09-03-09 $
28//
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#include "G4RunManager.hh"
33#include "G4UImanager.hh"
34#include "Randomize.hh"
35
36#include "DetectorConstruction.hh"
37#include "PhysicsList.hh"
38#include "PrimaryGeneratorAction.hh"
39#include "RunAction.hh"
40#include "EventAction.hh"
41
42#ifdef G4VIS_USE
43#include "G4VisExecutive.hh"
44#endif
45
46#ifdef G4UI_USE
47#include "G4UIExecutive.hh"
48#endif
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51
52int main(int argc,char** argv)
53{
54 //choose the Random engine
55 CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
56
57 // Construct the default run manager
58 G4RunManager * runManager = new G4RunManager;
59
60 // set mandatory initialization classes
61 runManager->SetUserInitialization(new PhysicsList);
62 PrimaryGeneratorAction* gun = new PrimaryGeneratorAction();
63 runManager->SetUserInitialization(new DetectorConstruction(gun));
64
65 // set user action classes
66 runManager->SetUserAction(gun);
67 runManager->SetUserAction(new RunAction());
68 runManager->SetUserAction(new EventAction());
69
70 G4UImanager* UI = G4UImanager::GetUIpointer();
71
72 if (argc!=1) // batch mode
73 {
74 G4String command = "/control/execute ";
75 G4String fileName = argv[1];
76 UI->ApplyCommand(command+fileName);
77 }
78
79 else //define visualization and UI terminal for interactive mode
80 {
81#ifdef G4VIS_USE
82 G4VisManager* visManager = new G4VisExecutive;
83 visManager->Initialize();
84#endif
85
86#ifdef G4UI_USE
87 G4UIExecutive * ui = new G4UIExecutive(argc,argv);
88 ui->SessionStart();
89 delete ui;
90#endif
91
92#ifdef G4VIS_USE
93 delete visManager;
94#endif
95 }
96
97 // job termination
98 //
99 delete runManager;
100
101 return 0;
102}
103
104//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
105
Note: See TracBrowser for help on using the repository browser.