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