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

Last change on this file since 1343 was 1342, checked in by garnier, 14 years ago

update ti head

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