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

Last change on this file since 1229 was 807, checked in by garnier, 16 years ago

update

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