Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
field02.cc
Go to the documentation of this file.
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 //
28 //
29 
31 #include "F02ElectricFieldSetup.hh"
32 #include "F02PhysicsList.hh"
34 #include "F02RunAction.hh"
35 #include "F02EventAction.hh"
36 #include "F02SteppingVerbose.hh"
37 
38 #include "G4RunManager.hh"
39 #include "G4UImanager.hh"
40 #include "Randomize.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 int main(int argc,char** argv)
51 {
52 
53  //choose the Random engine
54 
56 
57  //my Verbose output class
58 
60 
61  // Construct the default run manager
62 
63  G4RunManager* runManager = new G4RunManager;
64 
65  // Construct the helper class to manage the electric field &
66  // the parameters for the propagation of particles in it.
67 
69 
70  // Set mandatory initialization classes
71 
73  runManager->SetUserInitialization(detector);
74  runManager->SetUserInitialization(new F02PhysicsList(detector));
75 
76  // Set user action classes
77 
78  runManager->SetUserAction(new F02PrimaryGeneratorAction(detector));
79 
80  F02RunAction* runAction = new F02RunAction;
81  runManager->SetUserAction(runAction);
82 
83  runManager->SetUserAction(new F02EventAction(runAction));
84 
85  // Initialize G4 kernel, physics tables ...
86 
87  runManager->Initialize();
88 
89 #ifdef G4VIS_USE
90 
91  // visualization manager
92 
93  G4VisManager* visManager = new G4VisExecutive;
94  visManager->Initialize();
95 
96 #endif
97 
98  // get the pointer to the User Interface manager
99 
100  G4UImanager* UImanager = G4UImanager::GetUIpointer();
101 
102  if (argc!=1) // batch mode
103  {
104  G4String command = "/control/execute ";
105  G4String fileName = argv[1];
106  UImanager->ApplyCommand(command+fileName);
107  }
108  else
109  { // interactive mode : define UI session
110 #ifdef G4UI_USE
111  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
112  ui->SessionStart();
113  delete ui;
114 #endif
115  }
116 
117  // job termination
118 
119 #ifdef G4VIS_USE
120  delete visManager;
121 #endif
122  delete field;
123  delete runManager;
124 
125  return 0;
126 }
127