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

Last change on this file since 1348 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 4.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: userVisAction.cc,v 1.3 2009/12/22 15:07:19 allison Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
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
45#ifdef G4VIS_USE
46#include "G4VisExecutive.hh"
47#include "UVA_VisAction.hh"
48#endif
49
50#ifdef G4UI_USE
51#include "G4UIExecutive.hh"
52#endif
53
54//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55
56int main(int argc,char** argv) {
57
58 //my Verbose output class
59 G4VSteppingVerbose::SetInstance(new UVA_SteppingVerbose);
60
61 // Run manager
62 G4RunManager * runManager = new G4RunManager;
63
64 // UserInitialization classes (mandatory)
65 UVA_DetectorConstruction* UVA_detector = new UVA_DetectorConstruction;
66 runManager->SetUserInitialization(UVA_detector);
67 runManager->SetUserInitialization(new UVA_PhysicsList);
68
69#ifdef G4VIS_USE
70 // Visualization, if you choose to have it!
71 G4VisManager* visManager = new G4VisExecutive;
72 visManager->Initialize();
73 // Set User Vis Action...
74 visManager->SetUserAction
75 (new UVA_VisAction, G4VisExtent(-1*m,1*m,-2*m,0,3.5*m,5.5*m));
76 // 2nd argument optional - overridden by /vis/scene/add/userAction
77 // arguments, if any.
78#endif
79
80 // UserAction classes
81 runManager->SetUserAction(new UVA_PrimaryGeneratorAction(UVA_detector));
82 runManager->SetUserAction(new UVA_RunAction);
83 runManager->SetUserAction(new UVA_EventAction);
84 runManager->SetUserAction(new UVA_SteppingAction);
85
86 //Initialize G4 kernel
87 runManager->Initialize();
88
89 //get the pointer to the User Interface manager
90 G4UImanager * UImanager = G4UImanager::GetUIpointer();
91
92 if(argc==1)
93#ifdef G4UI_USE
94 // Define (G)UI terminal for interactive mode
95 {
96 G4UIExecutive * ui = new G4UIExecutive(argc, argv);
97 UImanager->ApplyCommand("/control/execute vis.mac");
98 ui->SessionStart();
99 delete ui;
100#endif
101 }
102 else
103 // Batch mode
104 {
105 G4String command = "/control/execute ";
106 G4String fileName = argv[1];
107 UImanager->ApplyCommand(command+fileName);
108 }
109
110#ifdef G4VIS_USE
111 delete visManager;
112#endif
113 delete runManager;
114
115 return 0;
116}
117
118//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119
Note: See TracBrowser for help on using the repository browser.