source: trunk/examples/extended/field/field03/field03.cc

Last change on this file was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.1 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.9 2010/05/12 16:41:42 allison Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31// --------------------------------------------------------------
32//      GEANT 4 - Example F03
33//
34// --------------------------------------------------------------
35// Comments
36//     
37//   
38// --------------------------------------------------------------
39
40#include "G4RunManager.hh"
41#include "G4UImanager.hh"
42#include "Randomize.hh"
43
44#include "F03DetectorConstruction.hh"
45// #include "F03FieldSetup.hh"
46#include "F03PhysicsList.hh"
47#include "F03PrimaryGeneratorAction.hh"
48#include "F03RunAction.hh"
49#include "F03EventAction.hh"
50#include "F03SteppingAction.hh"
51#include "F03SteppingVerbose.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 F03SteppingVerbose);
71 
72  // Construct the default run manager
73
74  G4RunManager * runManager = new G4RunManager;
75
76  // Set mandatory initialization classes
77
78  F03DetectorConstruction* detector;
79  detector = new F03DetectorConstruction;
80  runManager->SetUserInitialization(detector);
81  runManager->SetUserInitialization(new F03PhysicsList(detector));
82 
83  // Set user action classes
84
85  runManager->SetUserAction(new F03PrimaryGeneratorAction(detector));
86
87  F03RunAction* runAction = new F03RunAction;
88
89  runManager->SetUserAction(runAction);
90
91  F03EventAction* eventAction = new F03EventAction(runAction);
92
93  runManager->SetUserAction(eventAction);
94
95  F03SteppingAction* steppingAction = new F03SteppingAction();
96  runManager->SetUserAction(steppingAction);
97 
98  // Initialize G4 kernel, physics tables ...
99
100  runManager->Initialize();
101   
102#ifdef G4VIS_USE
103
104  // visualization manager
105
106  G4VisManager* visManager = new G4VisExecutive;
107  visManager->Initialize();
108
109#endif
110 
111  // Get the pointer to the User Interface manager
112
113  G4UImanager* UImanager = G4UImanager::GetUIpointer(); 
114 
115  if (argc!=1)   // batch mode
116    {
117      G4String command = "/control/execute ";
118      G4String fileName = argv[1];
119      UImanager->ApplyCommand(command+fileName);   
120    }
121  else
122    {  // interactive mode : define UI session
123#ifdef G4UI_USE
124      G4UIExecutive* ui = new G4UIExecutive(argc, argv);
125      ui->SessionStart();
126      delete ui;
127#endif
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.