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

Last change on this file since 1309 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 5.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: exampleN06.cc,v 1.16 2009/10/30 15:12:40 allison Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
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
48#include "ExN06DetectorConstruction.hh"
49#include "ExN06PhysicsList.hh"
50#include "ExN06PrimaryGeneratorAction.hh"
51#include "ExN06RunAction.hh"
52#include "ExN06EventAction.hh"
53#include "ExN06StackingAction.hh"
54#include "ExN06SteppingVerbose.hh"
55
56#include "Randomize.hh"
57
58#ifdef G4VIS_USE
59#include "G4VisExecutive.hh"
60#endif
61
62#ifdef G4UI_USE
63#include "G4UIExecutive.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* UImanager = G4UImanager::GetUIpointer(); 
120   
121  if (argc==1)   // Define UI session for interactive mode
122    {
123#ifdef G4UI_USE
124      G4UIExecutive * ui = new G4UIExecutive(argc,argv);
125#ifdef G4VIS_USE
126      UImanager->ApplyCommand("/control/execute vis.mac");     
127#endif
128      ui->SessionStart();
129      delete ui;
130#endif
131    }
132  else         // Batch mode
133    {
134      G4String command = "/control/execute ";
135      G4String fileName = argv[1];
136      UImanager->ApplyCommand(command+fileName);
137    }
138   
139  // Job termination
140  // Free the store: user actions, physics_list and detector_description are
141  //                 owned and deleted by the run manager, so they should not
142  //                 be deleted in the main() program !
143
144#ifdef G4VIS_USE
145  delete visManager;
146#endif
147  delete runManager;
148  delete verbosity;
149
150  return 0;
151}
152
153//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.