source: trunk/examples/advanced/composite_calorimeter/CompositeCalorimeter.cc@ 1254

Last change on this file since 1254 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

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