source: trunk/examples/extended/field/field02/field02.cc @ 1342

Last change on this file since 1342 was 1337, checked in by garnier, 14 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: field02.cc,v 1.10 2010/05/12 16:36:58 allison Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31// --------------------------------------------------------------
32//      GEANT 4 - TestF02
33//
34// --------------------------------------------------------------
35// Comments
36//     
37//   
38// --------------------------------------------------------------
39
40#include "G4RunManager.hh"
41#include "G4UImanager.hh"
42#include "Randomize.hh"
43
44#include "F02DetectorConstruction.hh"
45#include "F02ElectricFieldSetup.hh"
46#include "F02PhysicsList.hh"
47#include "F02PrimaryGeneratorAction.hh"
48#include "F02RunAction.hh"
49#include "F02EventAction.hh"
50#include "F02SteppingAction.hh"
51#include "F02SteppingVerbose.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 F02SteppingVerbose);
71 
72  // Construct the default run manager
73
74  G4RunManager * runManager = new G4RunManager;
75
76  // Construct the helper class to manage the electric field &
77  //  the parameters for the propagation of particles in it.
78
79  F02ElectricFieldSetup* field = new F02ElectricFieldSetup() ;
80   
81  // Set mandatory initialization classes
82
83  F02DetectorConstruction* detector;
84  detector = new F02DetectorConstruction;
85  runManager->SetUserInitialization(detector);
86  runManager->SetUserInitialization(new F02PhysicsList(detector));
87 
88  // Set user action classes
89
90  runManager->SetUserAction(new F02PrimaryGeneratorAction(detector));
91
92  F02RunAction* runAction = new F02RunAction;
93
94  runManager->SetUserAction(runAction);
95
96  F02EventAction* eventAction = new F02EventAction(runAction);
97
98  runManager->SetUserAction(eventAction);
99
100  F02SteppingAction* steppingAction = new F02SteppingAction();
101  runManager->SetUserAction(steppingAction);
102 
103  // Initialize G4 kernel, physics tables ...
104
105  runManager->Initialize();
106   
107#ifdef G4VIS_USE
108
109  // visualization manager
110
111  G4VisManager* visManager = new G4VisExecutive;
112  visManager->Initialize();
113
114#endif
115 
116  // get the pointer to the User Interface manager
117
118  G4UImanager* UImanager = G4UImanager::GetUIpointer(); 
119 
120  if (argc!=1)   // batch mode
121    {
122      G4String command = "/control/execute ";
123      G4String fileName = argv[1];
124      UImanager->ApplyCommand(command+fileName);   
125    }
126  else
127    {  // interactive mode : define UI session
128#ifdef G4UI_USE
129      G4UIExecutive* ui = new G4UIExecutive(argc, argv);
130      ui->SessionStart();
131      delete ui;
132#endif
133    }
134   
135  // job termination
136
137#ifdef G4VIS_USE
138  delete visManager;
139#endif
140  delete field;
141  delete runManager;
142
143  return 0;
144}
145
Note: See TracBrowser for help on using the repository browser.