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

Last change on this file was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

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