source: trunk/examples/extended/visualization/userVisAction/userVisAction.cc@ 807

Last change on this file since 807 was 807, checked in by garnier, 17 years ago

update

File size: 4.2 KB
RevLine 
[807]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: userVisAction.cc,v 1.2 2006/06/29 17:46:00 gunter Exp $
28// GEANT4 tag $Name: $
29//
30//
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
34#include "UVA_DetectorConstruction.hh"
35#include "UVA_PhysicsList.hh"
36#include "UVA_PrimaryGeneratorAction.hh"
37#include "UVA_RunAction.hh"
38#include "UVA_EventAction.hh"
39#include "UVA_SteppingAction.hh"
40#include "UVA_SteppingVerbose.hh"
41
42#include "G4RunManager.hh"
43#include "G4UImanager.hh"
44#include "G4UIterminal.hh"
45#include "G4UItcsh.hh"
46
47#ifdef G4VIS_USE
48#include "G4VisExecutive.hh"
49#include "UVA_VisAction.hh"
50#endif
51
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
54int main(int argc,char** argv) {
55
56 //my Verbose output class
57 G4VSteppingVerbose::SetInstance(new UVA_SteppingVerbose);
58
59 // Run manager
60 G4RunManager * runManager = new G4RunManager;
61
62 // UserInitialization classes (mandatory)
63 UVA_DetectorConstruction* UVA_detector = new UVA_DetectorConstruction;
64 runManager->SetUserInitialization(UVA_detector);
65 runManager->SetUserInitialization(new UVA_PhysicsList);
66
67#ifdef G4VIS_USE
68 // Visualization, if you choose to have it!
69 G4VisManager* visManager = new G4VisExecutive;
70 visManager->Initialize();
71 // Set User Vis Action...
72 visManager->SetUserAction
73 (new UVA_VisAction, G4VisExtent(-1*m,1*m,-2*m,0,3.5*m,5.5*m));
74 // 2nd argument optional - overridden by /vis/scene/add/userAction
75 // arguments, if any.
76#endif
77
78 // UserAction classes
79 runManager->SetUserAction(new UVA_PrimaryGeneratorAction(UVA_detector));
80 runManager->SetUserAction(new UVA_RunAction);
81 runManager->SetUserAction(new UVA_EventAction);
82 runManager->SetUserAction(new UVA_SteppingAction);
83
84 //Initialize G4 kernel
85 runManager->Initialize();
86
87 //get the pointer to the User Interface manager
88 G4UImanager * UI = G4UImanager::GetUIpointer();
89
90 if(argc==1)
91 // Define (G)UI terminal for interactive mode
92 {
93 // G4UIterminal is a (dumb) terminal.
94 G4UIsession * session = 0;
95#ifdef G4UI_USE_TCSH
96 session = new G4UIterminal(new G4UItcsh);
97#else
98 session = new G4UIterminal();
99#endif
100
101 UI->ApplyCommand("/control/execute vis.mac");
102 session->SessionStart();
103 delete session;
104 }
105 else
106 // Batch mode
107 {
108 G4String command = "/control/execute ";
109 G4String fileName = argv[1];
110 UI->ApplyCommand(command+fileName);
111 }
112
113#ifdef G4VIS_USE
114 delete visManager;
115#endif
116 delete runManager;
117
118 return 0;
119}
120
121//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122
Note: See TracBrowser for help on using the repository browser.