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: exampleP01.cc,v 1.2 2006/06/29 17:38:35 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
29 | // |
---|
30 | // |
---|
31 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
32 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
33 | |
---|
34 | #include "ExP01DetectorConstruction.hh" |
---|
35 | #include "ExP01PhysicsList.hh" |
---|
36 | #include "ExP01PrimaryGeneratorAction.hh" |
---|
37 | #include "ExP01RunAction.hh" |
---|
38 | #include "ExP01EventAction.hh" |
---|
39 | #include "ExP01SteppingAction.hh" |
---|
40 | #include "ExP01SteppingVerbose.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 | #endif |
---|
50 | |
---|
51 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
52 | |
---|
53 | int main(int argc,char** argv) { |
---|
54 | |
---|
55 | //my Verbose output class |
---|
56 | G4VSteppingVerbose::SetInstance(new ExP01SteppingVerbose); |
---|
57 | |
---|
58 | // Run manager |
---|
59 | G4RunManager * runManager = new G4RunManager; |
---|
60 | |
---|
61 | // UserInitialization classes (mandatory) |
---|
62 | ExP01DetectorConstruction* ExP01detector = new ExP01DetectorConstruction; |
---|
63 | runManager->SetUserInitialization(ExP01detector); |
---|
64 | runManager->SetUserInitialization(new ExP01PhysicsList); |
---|
65 | |
---|
66 | #ifdef G4VIS_USE |
---|
67 | // Visualization, if you choose to have it! |
---|
68 | G4VisManager* visManager = new G4VisExecutive; |
---|
69 | visManager->Initialize(); |
---|
70 | #endif |
---|
71 | |
---|
72 | // UserAction classes |
---|
73 | runManager->SetUserAction(new ExP01PrimaryGeneratorAction(ExP01detector)); |
---|
74 | runManager->SetUserAction(new ExP01RunAction); |
---|
75 | runManager->SetUserAction(new ExP01EventAction); |
---|
76 | runManager->SetUserAction(new ExP01SteppingAction); |
---|
77 | |
---|
78 | //Initialize G4 kernel |
---|
79 | runManager->Initialize(); |
---|
80 | |
---|
81 | //get the pointer to the User Interface manager |
---|
82 | G4UImanager * UI = G4UImanager::GetUIpointer(); |
---|
83 | |
---|
84 | if(argc==1) |
---|
85 | // Define (G)UI terminal for interactive mode |
---|
86 | { |
---|
87 | // G4UIterminal is a (dumb) terminal. |
---|
88 | G4UIsession * session = 0; |
---|
89 | #ifdef G4UI_USE_TCSH |
---|
90 | session = new G4UIterminal(new G4UItcsh); |
---|
91 | #else |
---|
92 | session = new G4UIterminal(); |
---|
93 | #endif |
---|
94 | |
---|
95 | UI->ApplyCommand("/control/execute vis.mac"); |
---|
96 | session->SessionStart(); |
---|
97 | delete session; |
---|
98 | } |
---|
99 | else |
---|
100 | // Batch mode |
---|
101 | { |
---|
102 | G4String command = "/control/execute "; |
---|
103 | G4String fileName = argv[1]; |
---|
104 | UI->ApplyCommand(command+fileName); |
---|
105 | } |
---|
106 | |
---|
107 | #ifdef G4VIS_USE |
---|
108 | delete visManager; |
---|
109 | #endif |
---|
110 | delete runManager; |
---|
111 | |
---|
112 | return 0; |
---|
113 | } |
---|
114 | |
---|
115 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
116 | |
---|