source: trunk/examples/extended/eventgenerator/exgps/exGPS.cc@ 1313

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

update to geant4.9.3

File size: 4.0 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#include "G4RunManager.hh"
27#include "G4UImanager.hh"
28#include "G4UIterminal.hh"
29#include "G4UItcsh.hh"
30
31#ifdef G4UI_USE_XM
32#include "G4UIXm.hh"
33#endif
34
35#ifdef G4ANALYSIS_USE
36#include "exGPSAnalysisManager.hh"
37#endif
38
39#ifdef G4VIS_USE
40#include "G4VisExecutive.hh"
41#endif
42
43#include "exGPSGeometryConstruction.hh"
44#include "exGPSPhysicsList.hh"
45#include "exGPSPrimaryGeneratorAction.hh"
46#include "exGPSRunAction.hh"
47#include "exGPSEventAction.hh"
48
49
50int main(int argc,char** argv) {
51
52 // Construct the default run manager
53 G4RunManager * runManager = new G4RunManager;
54
55#ifdef G4ANALYSIS_USE
56 //constructe the analysis manager (need here to activate the UI)
57 exGPSAnalysisManager::getInstance();
58#endif
59
60 // set mandatory initialization classes
61 exGPSGeometryConstruction* detector = new exGPSGeometryConstruction;
62 runManager->SetUserInitialization(detector);
63 runManager->SetUserInitialization(new exGPSPhysicsList);
64
65 // Set optional user action classes
66 exGPSEventAction* eventAction = new exGPSEventAction();
67 exGPSRunAction* runAction = new exGPSRunAction();
68
69 // set user action classes
70 runManager->SetUserAction(new exGPSPrimaryGeneratorAction);
71 runManager->SetUserAction(runAction);
72 runManager->SetUserAction(eventAction);
73
74 G4UIsession* session=0;
75
76 if (argc==1) // Define UI session for interactive mode.
77 {
78 // G4UIterminal is a (dumb) terminal.
79#ifdef G4UI_USE_XM
80 session = new G4UIXm(argc,argv);
81#else
82#ifdef G4UI_USE_TCSH
83 session = new G4UIterminal(new G4UItcsh);
84#else
85 session = new G4UIterminal();
86#endif
87#endif
88 }
89
90 // visualization manager
91#ifdef G4VIS_USE
92 G4VisManager* visManager = new G4VisExecutive;
93 visManager->Initialize();
94#endif
95
96 //Initialize G4 kernel
97 runManager->Initialize();
98
99 // get the pointer to the User Interface manager
100 G4UImanager* UI = G4UImanager::GetUIpointer();
101 // UI->ApplyCommand("/control/execute display.mac");
102
103 if (session) // Define UI session for interactive mode.
104 {
105 // G4UIterminal is a (dumb) terminal.
106 session->SessionStart();
107 delete session;
108 }
109 else // Batch mode
110 {
111 G4String command = "/control/execute ";
112 G4String fileName = argv[1];
113 UI->ApplyCommand(command+fileName);
114 }
115
116 // job termination
117
118#ifdef G4ANALYSIS_USE
119 exGPSAnalysisManager::dispose();
120#endif
121
122#ifdef G4VIS_USE
123 delete visManager;
124#endif
125 delete runManager;
126
127 return 0;
128}
Note: See TracBrowser for help on using the repository browser.