source: trunk/source/geometry/magneticfield/test/field03/field03.cc@ 1199

Last change on this file since 1199 was 1199, checked in by garnier, 16 years ago

nvx fichiers dans CVS

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: field03.cc,v 1.2 2006/06/29 18:28:57 gunter Exp $
28// GEANT4 tag $Name: HEAD $
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 "G4UIterminal.hh"
43#include "Randomize.hh"
44
45#ifdef G4VIS_USE
46#include "F03VisManager.hh"
47#endif
48
49#include "F03DetectorConstruction.hh"
50#include "F03ElectroMagneticField.hh"
51#include "F03PhysicsList.hh"
52#include "F03PrimaryGeneratorAction.hh"
53#include "F03RunAction.hh"
54#include "F03EventAction.hh"
55#include "F03SteppingAction.hh"
56#include "F03SteppingVerbose.hh"
57
58int main(int argc,char** argv)
59{
60
61 //choose the Random engine
62
63 HepRandom::setTheEngine(new RanecuEngine);
64
65 //my Verbose output class
66
67 G4VSteppingVerbose::SetInstance(new F03SteppingVerbose);
68
69 F03ElectroMagneticField* field = new F03ElectroMagneticField() ;
70
71 // Construct the default run manager
72
73 G4RunManager * runManager = new G4RunManager;
74
75 // set mandatory initialization classes
76
77 F03DetectorConstruction* detector;
78 detector = new F03DetectorConstruction;
79 runManager->SetUserInitialization(detector);
80 runManager->SetUserInitialization(new F03PhysicsList(detector));
81
82#ifdef G4VIS_USE
83
84 // visualization manager
85
86 G4VisManager* visManager = new F03VisManager;
87 visManager->Initialize();
88
89#endif
90
91 // set user action classes
92
93 runManager->SetUserAction(new F03PrimaryGeneratorAction(detector));
94
95 F03RunAction* runAction = new F03RunAction;
96
97 runManager->SetUserAction(runAction);
98
99 F03EventAction* eventAction = new F03EventAction(runAction);
100
101 runManager->SetUserAction(eventAction);
102
103 F03SteppingAction* steppingAction = new F03SteppingAction(detector,
104 eventAction,
105 runAction);
106 runManager->SetUserAction(steppingAction);
107
108 //Initialize G4 kernel, physics tables ...
109
110 runManager->Initialize();
111
112 // get the pointer to the User Interface manager
113
114 G4UImanager* UI = G4UImanager::GetUIpointer();
115
116 if (argc==1) // Define UI terminal for interactive mode
117 {
118 G4UIsession * session = new G4UIterminal;
119 UI->ApplyCommand("/control/execute init.mac");
120 session->SessionStart();
121 delete session;
122 }
123 else // Batch mode
124 {
125 G4String command = "/control/execute ";
126 G4String fileName = argv[1];
127 UI->ApplyCommand(command+fileName);
128 }
129
130 // job termination
131
132#ifdef G4VIS_USE
133 delete visManager;
134#endif
135 delete runManager;
136
137 return 0;
138}
139
Note: See TracBrowser for help on using the repository browser.