source: trunk/examples/novice/N04/exampleN04.cc@ 1348

Last change on this file since 1348 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.7 KB
RevLine 
[807]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//
[1313]27// $Id: exampleN04.cc,v 1.19 2010/06/04 17:50:22 vnivanch Exp $
[1337]28// GEANT4 tag $Name: geant4-09-04-beta-01 $
[807]29//
30//
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
34#include "G4RunManager.hh"
35#include "G4UImanager.hh"
36
37#include "ExN04DetectorConstruction.hh"
[1313]38#include "QGSP_BERT.hh"
[807]39#include "ExN04PrimaryGeneratorAction.hh"
40#include "ExN04RunAction.hh"
41#include "ExN04EventAction.hh"
42#include "ExN04StackingAction.hh"
43#include "ExN04TrackingAction.hh"
44#include "ExN04SteppingAction.hh"
45#include "ExN04SteppingVerbose.hh"
46
47#ifdef G4VIS_USE
48#include "G4VisExecutive.hh"
49#endif
50
[1190]51#ifdef G4UI_USE
52#include "G4UIExecutive.hh"
53#endif
54
[807]55int main(int argc,char** argv)
56{
57 // User Verbose output class
58 //
59 G4VSteppingVerbose* verbosity = new ExN04SteppingVerbose;
60 G4VSteppingVerbose::SetInstance(verbosity);
61
62 // Run manager
63 //
64 G4RunManager* runManager = new G4RunManager;
65
66 // User Initialization classes (mandatory)
67 //
68 G4VUserDetectorConstruction* detector = new ExN04DetectorConstruction;
69 runManager->SetUserInitialization(detector);
70 //
[1313]71 G4VUserPhysicsList* physics = new QGSP_BERT();
[807]72 runManager->SetUserInitialization(physics);
73
74 runManager->Initialize();
75
76 // User Action classes
77 //
78 G4VUserPrimaryGeneratorAction* gen_action = new ExN04PrimaryGeneratorAction;
79 runManager->SetUserAction(gen_action);
80 //
81 G4UserRunAction* run_action = new ExN04RunAction;
82 runManager->SetUserAction(run_action);
83 //
84 G4UserEventAction* event_action = new ExN04EventAction;
85 runManager->SetUserAction(event_action);
86 //
87 G4UserStackingAction* stacking_action = new ExN04StackingAction;
88 runManager->SetUserAction(stacking_action);
89 //
90 G4UserTrackingAction* tracking_action = new ExN04TrackingAction;
91 runManager->SetUserAction(tracking_action);
92 //
93 G4UserSteppingAction* stepping_action = new ExN04SteppingAction;
94 runManager->SetUserAction(stepping_action);
95
[1190]96#ifdef G4VIS_USE
97 G4VisManager* visManager = new G4VisExecutive;
98 visManager->Initialize();
99#endif
100
[807]101 //get the pointer to the User Interface manager
[1190]102 G4UImanager* UImanager = G4UImanager::GetUIpointer();
[807]103
104 if (argc!=1) // batch mode
105 {
[1190]106 G4String command = "/control/execute ";
107 G4String fileName = argv[1];
108 UImanager->ApplyCommand(command+fileName);
[807]109 }
[1190]110 else // interactive mode : define UI session
[807]111 {
[1190]112#ifdef G4UI_USE
113 G4UIExecutive * ui = new G4UIExecutive(argc,argv);
[807]114#ifdef G4VIS_USE
[1190]115 UImanager->ApplyCommand("/control/execute vis.mac");
[807]116#endif
[1190]117 ui->SessionStart();
118 delete ui;
119#endif
[807]120
121#ifdef G4VIS_USE
122 delete visManager;
123#endif
124 }
125
126 // Job termination
127 // Free the store: user actions, physics_list and detector_description are
128 // owned and deleted by the run manager, so they should not
129 // be deleted in the main() program !
130 delete runManager;
131 delete verbosity;
132
133 return 0;
134}
135
136//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.