source: trunk/examples/advanced/air_shower/Ultra.cc@ 1271

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

update

File size: 4.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// --------------------------------------------------------------
28// GEANT 4 - ULTRA experiment example
29// --------------------------------------------------------------
30//
31// Code developed by:
32// B. Tome, M.C. Espirito-Santo
33//
34// *******************************************************
35// * Ultra.cc
36// *******************************************************
37
38
39#include "G4RunManager.hh"
40#include "G4UImanager.hh"
41#include "G4UIterminal.hh"
42
43#ifdef G4UI_USE_XM
44#include "G4UIXm.hh"
45#endif
46
47#include "Randomize.hh"
48
49#ifdef G4VIS_USE
50#include "G4VisExecutive.hh"
51#endif
52
53#include "UltraRunAction.hh"
54#include "UltraDetectorConstruction.hh"
55#include "UltraPrimaryGeneratorAction.hh"
56#include "UltraPhysicsList.hh"
57#include "UltraEventAction.hh"
58//#include "CLHEP/Random/RanluxEngine.h"
59
60int main(int argc,char** argv) {
61
62//choose the Random engine from CLHEP
63//(lets use C++ implementation of Jame's RANLUX generator)
64
65 CLHEP::HepRandom::setTheEngine(new CLHEP::RanluxEngine);
66 G4RunManager* runManager = new G4RunManager;
67
68 // UserInitialization classes - mandatory
69 UltraDetectorConstruction* detector = new UltraDetectorConstruction;
70 UltraPhysicsList* list = new UltraPhysicsList();
71 runManager->SetUserInitialization(detector);
72 runManager->SetUserInitialization(list);
73
74 // UserAction classes - optional
75 UltraPrimaryGeneratorAction* PrimGenAct = new UltraPrimaryGeneratorAction();
76 runManager->SetUserAction(PrimGenAct);
77 UltraRunAction* RunAct = new UltraRunAction();
78 runManager->SetUserAction(RunAct);
79 UltraEventAction* EvAct = new UltraEventAction(RunAct);
80 runManager->SetUserAction(EvAct);
81
82#ifdef G4VIS_USE
83 // Visualization, if you choose to have it!
84 G4VisManager* visManager = new G4VisExecutive;
85 visManager->Initialize();
86#endif
87
88 //Initialize G4 kernel
89 runManager->Initialize();
90
91 // Get the Pointer to the UI Manager
92 G4UImanager* UImanager = G4UImanager::GetUIpointer();
93
94 // User interactions
95 // Define (G)UI for interactive mode
96 if(argc==1)
97 {
98 // G4UIterminal is a (dumb) terminal.
99#ifdef G4UI_USE_XM
100 G4UIsession* session = new G4UIXm(argc,argv);
101#else
102 G4UIsession* session = new G4UIterminal();
103#endif
104 session->SessionStart();
105 delete session;
106 }
107 else
108 // Batch mode
109 {
110 G4String command = "/control/execute ";
111 G4String fileName = argv[1];
112 UImanager->ApplyCommand(command+fileName);
113 }
114
115#ifdef G4VIS_USE
116 delete visManager;
117#endif
118
119 delete runManager;
120
121 return 0;
122}
123
Note: See TracBrowser for help on using the repository browser.