source: trunk/examples/extended/field/field01/field01.cc@ 1356

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

tag geant4.9.4 beta 1 + modifs locales

File size: 4.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// $Id: field01.cc,v 1.9 2010/05/12 16:30:59 allison Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31// --------------------------------------------------------------
32// GEANT 4 - TestF01
33//
34// --------------------------------------------------------------
35// Comments
36//
37//
38// --------------------------------------------------------------
39
40#include "G4RunManager.hh"
41#include "G4UImanager.hh"
42#include "Randomize.hh"
43
44#include "F01DetectorConstruction.hh"
45// #include "F01FieldSetup.hh"
46#include "F01PhysicsList.hh"
47#include "F01PrimaryGeneratorAction.hh"
48#include "F01RunAction.hh"
49#include "F01EventAction.hh"
50#include "F01SteppingAction.hh"
51#include "F01SteppingVerbose.hh"
52
53#ifdef G4VIS_USE
54#include "G4VisExecutive.hh"
55#endif
56
57#ifdef G4UI_USE
58#include "G4UIExecutive.hh"
59#endif
60
61int main(int argc,char** argv)
62{
63
64 //choose the Random engine
65
66 CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
67
68 //my Verbose output class
69
70 G4VSteppingVerbose::SetInstance(new F01SteppingVerbose);
71
72 // Construct the default run manager
73
74 G4RunManager * runManager = new G4RunManager;
75
76 // Create class that constructs & messages the magnetic field
77 // *** F01FieldSetup* field = new F01FieldSetup() ;
78 // --> Now done in detector construction
79
80 // Set mandatory initialization classes
81
82 F01DetectorConstruction* detector;
83 detector = new F01DetectorConstruction;
84 runManager->SetUserInitialization(detector);
85 runManager->SetUserInitialization(new F01PhysicsList(detector));
86
87 // Set user action classes
88
89 runManager->SetUserAction(new F01PrimaryGeneratorAction(detector));
90
91 F01RunAction* runAction = new F01RunAction;
92
93 runManager->SetUserAction(runAction);
94
95 F01EventAction* eventAction = new F01EventAction(runAction);
96
97 runManager->SetUserAction(eventAction);
98
99 F01SteppingAction* steppingAction = new F01SteppingAction();
100 runManager->SetUserAction(steppingAction);
101
102 // Initialize G4 kernel, physics tables ...
103
104 runManager->Initialize();
105
106#ifdef G4VIS_USE
107
108 // visualization manager
109
110 G4VisManager* visManager = new G4VisExecutive;
111 visManager->Initialize();
112
113#endif
114
115 // Get the pointer to the User Interface manager
116
117 G4UImanager* UImanager = G4UImanager::GetUIpointer();
118
119 if (argc!=1) // batch mode
120 {
121 G4String command = "/control/execute ";
122 G4String fileName = argv[1];
123 UImanager->ApplyCommand(command+fileName);
124 }
125 else
126 { // interactive mode : define UI session
127#ifdef G4UI_USE
128 G4UIExecutive* ui = new G4UIExecutive(argc, argv);
129 ui->SessionStart();
130 delete ui;
131#endif
132 }
133
134 // job termination
135
136#ifdef G4VIS_USE
137 delete visManager;
138#endif
139 // delete field;
140 delete runManager;
141
142 return 0;
143}
144
Note: See TracBrowser for help on using the repository browser.