Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exampleN06.cc
Go to the documentation of this file.
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$
28 //
29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //
32 // Description: Test of Continuous Process G4Cerenkov
33 // and RestDiscrete Process G4Scintillation
34 // -- Generation Cerenkov Photons --
35 // -- Generation Scintillation Photons --
36 // -- Transport of optical Photons --
37 // Version: 5.0
38 // Created: 1996-04-30
39 // Author: Juliet Armstrong
40 // mail: gum@triumf.ca
41 //
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
44 #include "G4RunManager.hh"
45 #include "G4UImanager.hh"
46 
47 #include "ExN06PhysicsList.hh"
50 #include "ExN06RunAction.hh"
51 #include "ExN06StackingAction.hh"
52 #include "ExN06SteppingVerbose.hh"
53 
54 #ifdef G4VIS_USE
55 #include "G4VisExecutive.hh"
56 #endif
57 
58 #ifdef G4UI_USE
59 #include "G4UIExecutive.hh"
60 #endif
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
64 int main(int argc,char** argv)
65 {
66  // Seed the random number generator manually
67  //
68  G4long myseed = 345354;
70 
71  // User Verbose output class
72  //
75 
76  // Run manager
77  //
78  G4RunManager* runManager = new G4RunManager;
79 
80  // UserInitialization classes - mandatory
81  //
82  G4VUserPhysicsList* physics = new ExN06PhysicsList;
83  runManager-> SetUserInitialization(physics);
84  //
86  runManager->SetUserAction(gen_action);
87  //
89  runManager-> SetUserInitialization(detector);
90 
91 #ifdef G4VIS_USE
92  // visualization manager
93  //
94  G4VisManager* visManager = new G4VisExecutive;
95  visManager->Initialize();
96 #endif
97 
98  // UserAction classes
99  //
100  G4UserRunAction* run_action = new ExN06RunAction;
101  runManager->SetUserAction(run_action);
102  //
103  G4UserStackingAction* stacking_action = new ExN06StackingAction;
104  runManager->SetUserAction(stacking_action);
105 
106  // Initialize G4 kernel
107  //
108  runManager->Initialize();
109 
110  // Get the pointer to the User Interface manager
111  //
112  G4UImanager* UImanager = G4UImanager::GetUIpointer();
113 
114  if (argc==1) // Define UI session for interactive mode
115  {
116 #ifdef G4UI_USE
117  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
118 #ifdef G4VIS_USE
119  UImanager->ApplyCommand("/control/execute vis.mac");
120 #endif
121  ui->SessionStart();
122  delete ui;
123 #endif
124  }
125  else // Batch mode
126  {
127  G4String command = "/control/execute ";
128  G4String fileName = argv[1];
129  UImanager->ApplyCommand(command+fileName);
130  }
131 
132  // Job termination
133  // Free the store: user actions, physics_list and detector_description are
134  // owned and deleted by the run manager, so they should not
135  // be deleted in the main() program !
136 
137 #ifdef G4VIS_USE
138  delete visManager;
139 #endif
140  delete runManager;
141  delete verbosity;
142 
143  return 0;
144 }
145 
146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......