source: trunk/examples/extended/radioactivedecay/exrdm/exRDM.cc@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 4.0 KB
RevLine 
[807]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#ifdef G4UI_USE_GAG
29#include "G4UIGAG.hh"
30#endif
31#include "G4UIterminal.hh"
32#include "G4UItcsh.hh"
33#ifdef G4UI_USE_XM
34#include "G4UIXm.hh"
35#endif
36
37
38#include "exrdmDetectorConstruction.hh"
39#include "exrdmPhysicsList.hh"
40#include "exrdmEventAction.hh"
41#include "exrdmRunAction.hh"
42#include "exrdmSteppingAction.hh"
43#include "exrdmPrimaryGeneratorAction.hh"
44#include "exrdmAnalysisManager.hh"
45#include "Randomize.hh"
46
47#ifdef G4VIS_USE
48#include "G4VisExecutive.hh"
49#endif
50
51int main(int argc,char** argv)
52{
53 // random engine
54 CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
55
56 // Construct the default run manager
57 G4RunManager* runManager = new G4RunManager;
58
59 // Creation of the analysis manager
60 exrdmAnalysisManager* analysis = exrdmAnalysisManager::getInstance();
61
62 // set mandatory initialization classes
63
64 exrdmDetectorConstruction* Detector = new exrdmDetectorConstruction;
65 runManager->SetUserInitialization(Detector);
66 runManager->SetUserInitialization(new exrdmPhysicsList);
67
68 // set mandatory user action class
69 runManager->SetUserAction(new exrdmPrimaryGeneratorAction);
70 runManager->SetUserAction(new exrdmRunAction);
71 runManager->SetUserAction(new exrdmEventAction);
72 runManager->SetUserAction(new exrdmSteppingAction);
73 //
74 //
75 G4UIsession* session=0;
76
77 if (argc==1) // Define UI session for interactive mode.
78 {
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#ifdef G4VIS_USE
91 // visualization manager
92 G4VisManager* visManager = new G4VisExecutive;
93 visManager->Initialize();
94#endif
95
96 // Initialize G4 kernel
97 // do this at run time so the geometry/physics can be changed
98 // runManager->Initialize();
99
100 // get the pointer to the User Interface manager
101 G4UImanager* UI = G4UImanager::GetUIpointer();
102 if (session) // Define UI session for interactive mode.
103 {
104 session->SessionStart();
105 delete session;
106 }
107 else // Batch mode
108 {
109 G4String command = "/control/execute ";
110 G4String fileName = argv[1];
111 UI->ApplyCommand(command+fileName);
112 }
113
114 // job termination
115#ifdef G4VIS_USE
116 delete visManager;
117#endif
118 delete analysis;
119 delete runManager;
120
121 return 0;
122}
123
124
125
126
127
128
129
130
Note: See TracBrowser for help on using the repository browser.