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 | // File: CompositeCalorimeter.cc |
---|
28 | // Description: Main function for Geant4 application HCAL Test-BEAM H2-96 |
---|
29 | /////////////////////////////////////////////////////////////////////////////// |
---|
30 | |
---|
31 | #include "CCalDetectorConstruction.hh" |
---|
32 | #include "CCalEndOfEventAction.hh" |
---|
33 | #include "CCalRunAction.hh" |
---|
34 | |
---|
35 | #include "CCalPrimaryGeneratorAction.hh" |
---|
36 | #include "LHEP.hh" |
---|
37 | #include "QGSP.hh" |
---|
38 | #include "QGSC.hh" |
---|
39 | |
---|
40 | #include "G4RunManager.hh" |
---|
41 | #include "G4UIterminal.hh" |
---|
42 | |
---|
43 | #ifdef G4UI_USE_XM |
---|
44 | #include "G4UIXm.hh" |
---|
45 | #endif |
---|
46 | |
---|
47 | #ifdef G4VIS_USE |
---|
48 | #include "G4VisExecutive.hh" |
---|
49 | #endif |
---|
50 | |
---|
51 | |
---|
52 | int main(int argc,char** argv) { |
---|
53 | |
---|
54 | #ifdef G4VIS_USE |
---|
55 | G4VisManager *visManager = new G4VisExecutive; |
---|
56 | visManager->Initialize(); |
---|
57 | #endif |
---|
58 | |
---|
59 | G4RunManager * runManager = new G4RunManager; |
---|
60 | runManager->SetUserInitialization(new CCalDetectorConstruction); |
---|
61 | |
---|
62 | //***LOOKHERE*** CHOOSE THE PHYSICS LIST. |
---|
63 | // runManager->SetUserInitialization(new LHEP); // LHEP |
---|
64 | runManager->SetUserInitialization(new QGSP); // QGSP |
---|
65 | // runManager->SetUserInitialization(new QGSC); // QGSC |
---|
66 | //***endLOOKHERE*** |
---|
67 | |
---|
68 | //////////////////////////// |
---|
69 | // User action classes. // |
---|
70 | // -------------------- // |
---|
71 | //////////////////////////// |
---|
72 | |
---|
73 | ////////////////////////////////// |
---|
74 | // PRIMARY PARTICLEs GENERATION // |
---|
75 | ////////////////////////////////// |
---|
76 | |
---|
77 | CCalPrimaryGeneratorAction* primaryGenerator = new CCalPrimaryGeneratorAction; |
---|
78 | runManager->SetUserAction(primaryGenerator); |
---|
79 | |
---|
80 | ///////// |
---|
81 | // RUN // |
---|
82 | ///////// |
---|
83 | |
---|
84 | runManager->SetUserAction(new CCalRunAction); |
---|
85 | |
---|
86 | /////////// |
---|
87 | // EVENT // |
---|
88 | /////////// |
---|
89 | |
---|
90 | runManager->SetUserAction(new CCalEndOfEventAction(primaryGenerator)); |
---|
91 | |
---|
92 | G4UImanager * UI = G4UImanager::GetUIpointer(); |
---|
93 | UI->ApplyCommand("/CCal/generator/verbose 2"); |
---|
94 | UI->ApplyCommand("/gun/position -1380. 0. 0. mm"); |
---|
95 | UI->ApplyCommand("/gun/direction 1. 0. 0."); |
---|
96 | UI->ApplyCommand("/gun/energy 100 GeV"); |
---|
97 | |
---|
98 | G4UIsession * session = 0; |
---|
99 | // Define (G)UI terminal for interactive mode |
---|
100 | if (argc==1) { |
---|
101 | |
---|
102 | #ifdef G4UI_USE_XM |
---|
103 | session = new G4UIXm(argc,argv); |
---|
104 | #else // G4UIterminal is a (dumb) terminal. |
---|
105 | session = new G4UIterminal; |
---|
106 | #endif |
---|
107 | |
---|
108 | G4cout <<" Run initializing ..."<<G4endl; |
---|
109 | UI->ApplyCommand("/process/verbose 0"); |
---|
110 | UI->ApplyCommand("/run/verbose 2"); |
---|
111 | UI->ApplyCommand("/run/initialize"); |
---|
112 | |
---|
113 | #ifdef G4VIS_USE |
---|
114 | // Create empty scene |
---|
115 | G4String visCommand = "/vis/scene/create"; |
---|
116 | UI->ApplyCommand(visCommand); |
---|
117 | |
---|
118 | // Choose one default viewer |
---|
119 | // (the user can always change it later on) |
---|
120 | // visCommand = "/vis/open DAWNFILE"; |
---|
121 | // visCommand = "/vis/open VRML2FILE"; |
---|
122 | visCommand = "/vis/open OGLIX"; |
---|
123 | UI->ApplyCommand(visCommand); |
---|
124 | |
---|
125 | visCommand = "/vis/viewer/flush"; |
---|
126 | UI->ApplyCommand(visCommand); |
---|
127 | visCommand = "/tracking/storeTrajectory 1"; |
---|
128 | UI->ApplyCommand(visCommand); |
---|
129 | #endif |
---|
130 | |
---|
131 | #ifdef G4UI_USE_XM |
---|
132 | // Customize the G4UIXm menubar with a macro file : |
---|
133 | UI->ApplyCommand("/control/execute gui.mac"); |
---|
134 | #else |
---|
135 | G4cout <<"Now, please, apply beamOn command..."<<G4endl; |
---|
136 | #endif |
---|
137 | |
---|
138 | session->SessionStart(); |
---|
139 | delete session; |
---|
140 | |
---|
141 | } else { |
---|
142 | |
---|
143 | // Batch mode |
---|
144 | G4String command = "/control/execute "; |
---|
145 | G4String fileName = argv[1]; |
---|
146 | UI->ApplyCommand(command+fileName); |
---|
147 | |
---|
148 | } |
---|
149 | |
---|
150 | delete runManager; |
---|
151 | |
---|
152 | #ifdef G4VIS_USE |
---|
153 | delete visManager; |
---|
154 | #endif |
---|
155 | |
---|
156 | return 0; |
---|
157 | } |
---|
158 | |
---|