source: trunk/examples/extended/persistency/P02/exampleP02.cc@ 1170

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

update

File size: 3.8 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: exampleP02.cc,v 1.1 2007/11/29 17:05:21 witoldp Exp $
28// GEANT4 tag $Name: $
29//
30//
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
34#include "ExP02DetectorConstruction.hh"
35#include "ExP02DetConstrReader.hh"
36#include "ExP02PhysicsList.hh"
37#include "ExP02PrimaryGeneratorAction.hh"
38
39#include "G4RunManager.hh"
40#include "G4UImanager.hh"
41#include "G4UIterminal.hh"
42#include "G4UItcsh.hh"
43
44#ifdef G4VIS_USE
45#include "G4VisExecutive.hh"
46#endif
47
48//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49
50int main(int argc, char** argv)
51{
52
53 if(argc==1)
54 {
55 std::cout << "Please give 'write' or 'read' as argument " << std::endl;
56 return 0;
57 }
58
59 G4VUserDetectorConstruction* det;
60
61 if(std::string(argv[1]) == "read")
62 {
63 det = new ExP02DetConstrReader;
64 }
65 else if(std::string(argv[1]) == "write")
66 {
67 det = new ExP02DetectorConstruction;
68 }
69 else
70 {
71 std::cout << "Wrong argument!" << std::endl;
72 return 0;
73 }
74
75 // Run manager
76 G4RunManager * runManager = new G4RunManager;
77
78 // UserInitialization classes (mandatory)
79 runManager->SetUserInitialization(det);
80 runManager->SetUserInitialization(new ExP02PhysicsList);
81
82#ifdef G4VIS_USE
83 // Visualization, if you choose to have it!
84 G4VisManager* visManager = new G4VisExecutive;
85 visManager->Initialize();
86#endif
87
88 // UserAction classes
89 runManager->SetUserAction(new ExP02PrimaryGeneratorAction());
90
91 //Initialize G4 kernel
92 runManager->Initialize();
93
94 //get the pointer to the User Interface manager
95 G4UImanager * UI = G4UImanager::GetUIpointer();
96
97 // Define (G)UI terminal for interactive mode
98 // G4UIterminal is a (dumb) terminal.
99 G4UIsession * session = 0;
100#ifdef G4UI_USE_TCSH
101 session = new G4UIterminal(new G4UItcsh);
102#else
103 session = new G4UIterminal();
104#endif
105
106 UI->ApplyCommand("/control/execute vis.mac");
107 session->SessionStart();
108 delete session;
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.