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 | // SBT (Solids Batch Test) main program |
---|
28 | // |
---|
29 | |
---|
30 | #include "G4RunManager.hh" |
---|
31 | #include "G4UImanager.hh" |
---|
32 | #include "G4UIterminal.hh" |
---|
33 | #include "G4UItcsh.hh" |
---|
34 | |
---|
35 | #include "G4InteractiveSolid.hh" |
---|
36 | #include "SBTMessenger.hh" |
---|
37 | #include "SBTvoxelMessenger.hh" |
---|
38 | #include "SBTVisManager.hh" |
---|
39 | |
---|
40 | /* |
---|
41 | MEDERNACH Emmanuel |
---|
42 | Aug 2000 |
---|
43 | |
---|
44 | You could now run SBT with an argument script |
---|
45 | and exit SBT. |
---|
46 | */ |
---|
47 | |
---|
48 | int main(int argc,char *argv[]) |
---|
49 | { |
---|
50 | // Initialize visualization manager |
---|
51 | SBTVisManager *visManager = new SBTVisManager; |
---|
52 | visManager->Initialize(); |
---|
53 | |
---|
54 | // Build our "interactive" volume, |
---|
55 | // a volume that is also a messenger |
---|
56 | G4InteractiveSolid *interactiveSolid = new G4InteractiveSolid( "/solid/" ); |
---|
57 | |
---|
58 | // Build our batch test messenger. |
---|
59 | // A new batch test will be created by it. |
---|
60 | // The test messenger gets the target solid |
---|
61 | // from a solid query class G4QuerySolid, as specified in the |
---|
62 | // second argument |
---|
63 | SBTMessenger *testMessenger = new SBTMessenger( "/test/", (G4SolidQuery *)interactiveSolid, visManager ); |
---|
64 | |
---|
65 | // |
---|
66 | // Build our voxel test messenger |
---|
67 | SBTvoxelMessenger *voxelMessenger = new SBTvoxelMessenger( "/voxel/", (G4SolidQuery *)interactiveSolid, visManager ); |
---|
68 | |
---|
69 | // Give control to interactive terminal |
---|
70 | G4UIsession *session; |
---|
71 | |
---|
72 | #ifdef G4UI_USE_TCSH |
---|
73 | session = new G4UIterminal(new G4UItcsh); |
---|
74 | #else |
---|
75 | session = new G4UIterminal; |
---|
76 | #endif |
---|
77 | |
---|
78 | if (argc > 1) // when run with an argument, run each scripts and exit |
---|
79 | { |
---|
80 | G4UImanager * UI = G4UImanager::GetUIpointer(); |
---|
81 | |
---|
82 | for (int i=1;i<argc;i++) |
---|
83 | { |
---|
84 | UI->ApplyCommand("/control/execute "+G4String(argv[i])); |
---|
85 | } |
---|
86 | } |
---|
87 | else |
---|
88 | { |
---|
89 | session->SessionStart(); |
---|
90 | } |
---|
91 | |
---|
92 | // All finished... |
---|
93 | delete session; |
---|
94 | delete testMessenger; |
---|
95 | delete voxelMessenger; |
---|
96 | delete interactiveSolid; |
---|
97 | return 0; |
---|
98 | } |
---|