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

Last change on this file since 1319 was 1313, checked in by garnier, 14 years ago

geant4.9.4 beta rc0

File size: 5.0 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.17 2010/06/06 04:08:35 perl Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-cand-00 $
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 "ExN06StackingAction.hh"
53#include "ExN06SteppingVerbose.hh"
54
55#include "Randomize.hh"
56
57#ifdef G4VIS_USE
58#include "G4VisExecutive.hh"
59#endif
60
61#ifdef G4UI_USE
62#include "G4UIExecutive.hh"
63#endif
64
65//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66
67int main(int argc,char** argv)
68{
69  // Seed the random number generator manually
70  //
71  G4long myseed = 345354;
72  CLHEP::HepRandom::setTheSeed(myseed);
73 
74  // User Verbose output class
75  //
76  G4VSteppingVerbose* verbosity = new ExN06SteppingVerbose;
77  G4VSteppingVerbose::SetInstance(verbosity);
78 
79  // Run manager
80  //
81  G4RunManager* runManager = new G4RunManager;
82
83  // UserInitialization classes - mandatory
84  //
85  G4VUserDetectorConstruction* detector = new ExN06DetectorConstruction;
86  runManager-> SetUserInitialization(detector);
87  //
88  G4VUserPhysicsList* physics = new ExN06PhysicsList;
89  runManager-> SetUserInitialization(physics);
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  G4VUserPrimaryGeneratorAction* gen_action = new ExN06PrimaryGeneratorAction;
104  runManager->SetUserAction(gen_action);
105  //
106  G4UserStackingAction* stacking_action = new ExN06StackingAction;
107  runManager->SetUserAction(stacking_action);
108 
109  // Initialize G4 kernel
110  //
111  runManager->Initialize();
112   
113  // Get the pointer to the User Interface manager
114  //
115  G4UImanager* UImanager = G4UImanager::GetUIpointer(); 
116   
117  if (argc==1)   // Define UI session for interactive mode
118    {
119#ifdef G4UI_USE
120      G4UIExecutive * ui = new G4UIExecutive(argc,argv);
121#ifdef G4VIS_USE
122      UImanager->ApplyCommand("/control/execute vis.mac");     
123#endif
124      ui->SessionStart();
125      delete ui;
126#endif
127    }
128  else         // Batch mode
129    {
130      G4String command = "/control/execute ";
131      G4String fileName = argv[1];
132      UImanager->ApplyCommand(command+fileName);
133    }
134   
135  // Job termination
136  // Free the store: user actions, physics_list and detector_description are
137  //                 owned and deleted by the run manager, so they should not
138  //                 be deleted in the main() program !
139
140#ifdef G4VIS_USE
141  delete visManager;
142#endif
143  delete runManager;
144  delete verbosity;
145
146  return 0;
147}
148
149//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.