source: trunk/examples/novice/N06/exampleN06.cc@ 888

Last change on this file since 888 was 807, checked in by garnier, 17 years ago

update

File size: 5.1 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//
27// $Id: exampleN06.cc,v 1.14 2006/06/29 17:53:52 gunter Exp $
28// GEANT4 tag $Name: $
29//
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32//
33// Description: Test of Continuous Process G4Cerenkov
34// and RestDiscrete Process G4Scintillation
35// -- Generation Cerenkov Photons --
36// -- Generation Scintillation Photons --
37// -- Transport of optical Photons --
38// Version: 5.0
39// Created: 1996-04-30
40// Author: Juliet Armstrong
41// mail: gum@triumf.ca
42//
43//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44
45#include "G4RunManager.hh"
46#include "G4UImanager.hh"
47#include "G4UIterminal.hh"
48#include "G4UItcsh.hh"
49
50#include "G4ios.hh"
51
52#include "ExN06DetectorConstruction.hh"
53#include "ExN06PhysicsList.hh"
54#include "ExN06PrimaryGeneratorAction.hh"
55#include "ExN06RunAction.hh"
56#include "ExN06EventAction.hh"
57#include "ExN06StackingAction.hh"
58#include "ExN06SteppingVerbose.hh"
59
60#include "Randomize.hh"
61
62#ifdef G4VIS_USE
63#include "G4VisExecutive.hh"
64#endif
65
66//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67
68int main(int argc,char** argv)
69{
70 // Seed the random number generator manually
71 //
72 G4long myseed = 345354;
73 CLHEP::HepRandom::setTheSeed(myseed);
74
75 // User Verbose output class
76 //
77 G4VSteppingVerbose* verbosity = new ExN06SteppingVerbose;
78 G4VSteppingVerbose::SetInstance(verbosity);
79
80 // Run manager
81 //
82 G4RunManager* runManager = new G4RunManager;
83
84 // UserInitialization classes - mandatory
85 //
86 G4VUserDetectorConstruction* detector = new ExN06DetectorConstruction;
87 runManager-> SetUserInitialization(detector);
88 //
89 G4VUserPhysicsList* physics = new ExN06PhysicsList;
90 runManager-> SetUserInitialization(physics);
91
92#ifdef G4VIS_USE
93 // visualization manager
94 //
95 G4VisManager* visManager = new G4VisExecutive;
96 visManager->Initialize();
97#endif
98
99 // UserAction classes
100 //
101 G4UserRunAction* run_action = new ExN06RunAction;
102 runManager->SetUserAction(run_action);
103 //
104 G4VUserPrimaryGeneratorAction* gen_action = new ExN06PrimaryGeneratorAction;
105 runManager->SetUserAction(gen_action);
106 //
107 G4UserEventAction* event_action = new ExN06EventAction;
108 runManager->SetUserAction(event_action);
109 //
110 G4UserStackingAction* stacking_action = new ExN06StackingAction;
111 runManager->SetUserAction(stacking_action);
112
113 // Initialize G4 kernel
114 //
115 runManager->Initialize();
116
117 // Get the pointer to the User Interface manager
118 //
119 G4UImanager* UI = G4UImanager::GetUIpointer();
120
121 if (argc==1) // Define UI session for interactive mode
122 {
123 G4UIsession* session = 0;
124#ifdef G4UI_USE_TCSH
125 session = new G4UIterminal(new G4UItcsh);
126#else
127 session = new G4UIterminal();
128#endif
129 UI->ApplyCommand("/control/execute vis.mac");
130 session->SessionStart();
131 delete session;
132 }
133
134 else // Batch mode
135 {
136 G4String command = "/control/execute ";
137 G4String fileName = argv[1];
138 UI->ApplyCommand(command+fileName);
139 }
140
141 // Job termination
142 // Free the store: user actions, physics_list and detector_description are
143 // owned and deleted by the run manager, so they should not
144 // be deleted in the main() program !
145
146#ifdef G4VIS_USE
147 delete visManager;
148#endif
149 delete runManager;
150 delete verbosity;
151
152 return 0;
153}
154
155//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.