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

Last change on this file since 1309 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 4.2 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.8 2006/06/29 17:15:22 gunter Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-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 "G4UIterminal.hh"
43#include "Randomize.hh"
44
45#ifdef G4VIS_USE
46#include "G4VisExecutive.hh"
47#endif
48
49#include "F01DetectorConstruction.hh"
50// #include "F01FieldSetup.hh"
51#include "F01PhysicsList.hh"
52#include "F01PrimaryGeneratorAction.hh"
53#include "F01RunAction.hh"
54#include "F01EventAction.hh"
55#include "F01SteppingAction.hh"
56#include "F01SteppingVerbose.hh"
57
58int main(int argc,char** argv) 
59{
60
61  //choose the Random engine
62
63  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
64 
65  //my Verbose output class
66
67  G4VSteppingVerbose::SetInstance(new F01SteppingVerbose);
68 
69  // Construct the default run manager
70
71  G4RunManager * runManager = new G4RunManager;
72
73  // Create class that constructs & messages the magnetic field
74  //  *** F01FieldSetup* field = new F01FieldSetup() ;
75  // --> Now done in detector construction
76
77  // Set mandatory initialization classes
78
79  F01DetectorConstruction* detector;
80  detector = new F01DetectorConstruction;
81  runManager->SetUserInitialization(detector);
82  runManager->SetUserInitialization(new F01PhysicsList(detector));
83 
84#ifdef G4VIS_USE
85
86  // visualization manager
87
88  G4VisManager* visManager = new G4VisExecutive;
89  visManager->Initialize();
90
91#endif
92 
93  // Set user action classes
94
95  runManager->SetUserAction(new F01PrimaryGeneratorAction(detector));
96
97  F01RunAction* runAction = new F01RunAction;
98
99  runManager->SetUserAction(runAction);
100
101  F01EventAction* eventAction = new F01EventAction(runAction);
102
103  runManager->SetUserAction(eventAction);
104
105  F01SteppingAction* steppingAction = new F01SteppingAction();
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     session->SessionStart();
120     delete session;
121  }
122  else           // Batch mode
123  { 
124     G4String command = "/control/execute ";
125     G4String fileName = argv[1];
126     UI->ApplyCommand(command+fileName);
127  }
128   
129  // job termination
130
131#ifdef G4VIS_USE
132  delete visManager;
133#endif
134  // delete field;
135  delete runManager;
136
137  return 0;
138}
139
Note: See TracBrowser for help on using the repository browser.