source: trunk/examples/extended/runAndEvent/RE02/exampleRE02.cc @ 1215

Last change on this file since 1215 was 1187, checked in by garnier, 15 years ago

CVS update

File size: 4.3 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// $Id: exampleRE02.cc,v 1.3 2006/11/18 01:37:22 asaim Exp $
28// GEANT4 tag $Name:  $
29//
30//
31//
32//
33#include "RE02DetectorConstruction.hh"
34#include "RE02PhysicsList.hh"
35#include "RE02PrimaryGeneratorAction.hh"
36#include "RE02RunAction.hh"
37#include "RE02EventAction.hh"
38
39#include "G4RunManager.hh"
40#include "G4UImanager.hh"
41#include "G4UIterminal.hh"
42#include "G4UItcsh.hh"
43#include "G4UIQt.hh"
44#include "G4Qt.hh"
45
46#ifdef G4VIS_USE
47#include "G4VisExecutive.hh"
48#endif
49
50//
51int main(int argc,char** argv) {
52
53  // Run manager
54  G4RunManager * runManager = new G4RunManager;
55
56  // UserInitialization classes (mandatory)
57  //---
58  //  Create Detector
59  RE02DetectorConstruction* detector = new RE02DetectorConstruction;
60  detector->SetPhantomSize(G4ThreeVector(200*mm,200*mm,400*mm)); //Default
61  detector->SetNumberOfSegmentsInPhantom(100,100,200); //Default
62  //  If your machine does not have enough memory,
63  //  please try to reduce Number of Segements in phantom.
64  //detector->SetNumberOfSegmentsInPhantom(1,1,100);  // For small memory size.
65  //
66  detector->SetLeadSegment(TRUE); // Default (Water and Lead)
67  // Water and Lead segments are placed alternately, by defult.,
68  //  If you want to simulation homogeneous water phantom, please set it FALSE.
69  //detector->SetLeadSegment(FALSE); // Homogeneous water phantom
70  //
71  runManager->SetUserInitialization(detector);
72  runManager->SetUserInitialization(new RE02PhysicsList);
73 
74#ifdef G4VIS_USE
75  // Visualization, if you choose to have it!
76  G4VisManager* visManager = new G4VisExecutive;
77  visManager->Initialize();
78#endif
79   
80  // UserAction classes
81  runManager->SetUserAction(new RE02PrimaryGeneratorAction);
82  runManager->SetUserAction(new RE02RunAction); 
83  runManager->SetUserAction(new RE02EventAction);
84
85  //Initialize G4 kernel
86  runManager->Initialize();
87     
88  //get the pointer to the User Interface manager
89  G4UImanager * UI = G4UImanager::GetUIpointer(); 
90
91  if(argc==1)
92  // Define (G)UI terminal for interactive mode 
93  { 
94    // G4UIterminal is a (dumb) terminal.
95    G4UIsession * session = 0;
96#ifdef G4UI_USE_TCSH
97      session = new G4UIterminal(new G4UItcsh);     
98#elif defined(G4UI_USE_QT)
99      session = new G4UIQt(argc,argv);
100      //      UI->ApplyCommand("/control/execute visTutor/gui.mac");     
101#else
102      session = new G4UIterminal();
103#endif   
104
105    UI->ApplyCommand("/control/execute vis.mac");   
106    session->SessionStart();
107    delete session;
108  }
109  else
110  // Batch mode
111  { 
112    G4String command = "/control/execute ";
113    G4String fileName = argv[1];
114    UI->ApplyCommand(command+fileName);
115  }
116
117#ifdef G4VIS_USE
118  delete visManager;
119#endif
120  delete runManager;
121
122  return 0;
123}
124
125//
126
Note: See TracBrowser for help on using the repository browser.