source: trunk/source/geometry/solids/test/SurfaceVisTest/SurfaceVisTest.cc@ 1350

Last change on this file since 1350 was 1347, checked in by garnier, 15 years ago

geant4 tag 9.4

File size: 4.2 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//geotest.cc
28//Geant4 includes
29#include "G4RunManager.hh"
30#include "G4UImanager.hh"
31#include "G4UIterminal.hh"
32#include "G4UItcsh.hh"
33#include "G4Circle.hh"
34#include "G4VisExecutive.hh"
35#include "G4VSolid.hh"
36#include "globals.hh"
37#include <vector>
38#include "G4LogicalVolumeStore.hh"
39// random number generator
40#include "CLHEP/Random/RanluxEngine.h"
41
42//a pre-built physics list
43#include "QGSP_BERT_EMV.hh"
44
45//My includes
46#include "DetectorConstruction.hh"
47#include "PrimaryGeneratorAction.hh"
48#include "RunAction.hh"
49#include "EventAction.hh"
50
51
52int main(int argc,char** argv)
53{
54 //Random number generator=always starts with the same seed
55 CLHEP::RanluxEngine defaultEngine( 1234567, 4 );
56 CLHEP::HepRandom::setTheEngine( &defaultEngine );
57 G4int seed = time( NULL );
58 CLHEP::HepRandom::setTheSeed( seed );
59 G4cout << G4endl
60 << " ===================================================== " << G4endl
61 << " Initial seed = " << seed << G4endl
62 << " ===================================================== " << G4endl
63 << G4endl;
64
65 //Construct the default run manager
66 G4RunManager* runManager = new G4RunManager;
67 G4VisManager* visManager = new G4VisExecutive;
68
69
70 //Set mandatory initialization and user action classes
71 runManager->SetUserInitialization(new QGSP_BERT_EMV);
72
73 runManager->SetUserInitialization(new DetectorConstruction);
74 runManager->SetUserAction(new PrimaryGeneratorAction);
75 RunAction *runAction = new RunAction;
76 runManager->SetUserAction(runAction);
77 EventAction* eventAction = new EventAction(runAction);
78 runManager->SetUserAction(eventAction);
79 //Initialize G4 kernel
80 runManager->Initialize();
81 visManager->Initialize();
82
83 // run initialisation macro
84
85 if ( argc==1 ) { // Define UI session for interactive mode.
86 //Open a tcsh session: will stay there until the user types "exit"
87
88 G4UIsession* session = new G4UIterminal(new G4UItcsh);
89 G4UImanager* UI = G4UImanager::GetUIpointer();
90 UI->ApplyCommand("/control/execute vis.mac");
91
92
93 session->SessionStart();
94 delete session;
95 }else{// Batch mode
96 G4String command = "/control/execute ";
97 G4String fileName = argv[1];
98 G4UIsession* session = new G4UIterminal(new G4UItcsh);
99 G4UImanager* UI = G4UImanager::GetUIpointer();
100 UI->ApplyCommand(command+fileName);
101 session->SessionStart();
102 delete session;
103 }
104
105 delete visManager;
106
107 // job termination
108 delete runManager;
109
110 return 0;
111
112}// end of main()
113
114//end of geotest.cc
115
Note: See TracBrowser for help on using the repository browser.