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

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

update ti head

File size: 3.6 KB
RevLine 
[807]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//
[1342]26// $Id: TestEm8.cc,v 1.10 2010/09/08 09:12:10 vnivanch Exp $
27// GEANT4 tag $Name: examples-V09-03-09 $
[807]28//
[1337]29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
[807]31
32#include "G4RunManager.hh"
33#include "G4UImanager.hh"
34#include "Randomize.hh"
35
[1342]36#include "DetectorConstruction.hh"
[807]37#include "PhysicsList.hh"
[1342]38#include "PrimaryGeneratorAction.hh"
39#include "RunAction.hh"
40#include "EventAction.hh"
[807]41
[1337]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
[807]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);
[1342]62 PrimaryGeneratorAction* gun = new PrimaryGeneratorAction();
63 runManager->SetUserInitialization(new DetectorConstruction(gun));
[807]64
65 // set user action classes
[1342]66 runManager->SetUserAction(gun);
67 runManager->SetUserAction(new RunAction());
68 runManager->SetUserAction(new EventAction());
[807]69
70 G4UImanager* UI = G4UImanager::GetUIpointer();
[1337]71
72 if (argc!=1) // batch mode
73 {
[1342]74 G4String command = "/control/execute ";
75 G4String fileName = argv[1];
76 UI->ApplyCommand(command+fileName);
[1337]77 }
78
79 else //define visualization and UI terminal for interactive mode
[807]80 {
81#ifdef G4VIS_USE
[1342]82 G4VisManager* visManager = new G4VisExecutive;
83 visManager->Initialize();
[1337]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
[1342]93 delete visManager;
[1337]94#endif
95 }
96
[807]97 // job termination
[1337]98 //
[807]99 delete runManager;
100
101 return 0;
102}
103
[1337]104//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
105
Note: See TracBrowser for help on using the repository browser.