source: trunk/source/visualization/test/test19.cc @ 1347

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

geant4 tag 9.4

File size: 5.1 KB
RevLine 
[834]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//
[1340]27// $Id: test19.cc,v 1.34 2010/10/26 16:17:44 allison Exp $
[1347]28// GEANT4 tag $Name: geant4-09-04-ref-00 $
[834]29//
30//
31
32// Usage: test19 [<session>] [<verbosity>]
33// Without verbosity, verbosity=warnings.
34
35#include <stdio.h>
36#include <ctype.h>
37#include <stdlib.h>
38
39#include "globals.hh"
40//#include "SharedSolidDetectorConstruction.hh"
41#include "test19DetectorConstruction.hh"
[1340]42#include "QGSP_BERT.hh"
[834]43#include "MyRunAction.hh"
44#include "MyPrimaryGeneratorAction.hh"
45#include "MyEventAction.hh"
46#include "MySteppingAction.hh"
47
[1140]48#ifdef G4UI_USE
49#include "G4UIExecutive.hh"
[1025]50#endif
[834]51
52#include "G4RunManager.hh"
53
54#ifdef G4VIS_USE
55#include "G4VisExecutive.hh"
56// G4VisExecutive is a G4VisManager that implements graphics system
57// registration in the user domain.
58#include "G4XXX.hh"
59#include "G4XXXFile.hh"
60#include "G4XXXStored.hh"
61#ifdef G4VIS_USE_XXXSG
62#include "G4XXXSG.hh"
63#endif
64#endif
65
66
67#ifdef G4UI_USE_WIN32
68#include <windows.h>
69int WINAPI WinMain (
70HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpszCmdLine,int nCmdShow) {
71#else
72int main (int argc, char** argv) {
73#endif
74
75  G4String verbosityString("warnings");
76#ifndef G4UI_USE_WIN32
77  if ((argc >= 3)) verbosityString = argv[2];
78#endif
79
[1140]80#ifdef G4UI_USE
[834]81  // Choose (G)UI.
[1228]82  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
[834]83#endif
84
85  // Run manager
86  G4cout << "RunManager is constructing...." << G4endl;
87  G4RunManager * runManager = new G4RunManager;
88
89  // User initialization classes
90  runManager -> SetUserInitialization (new test19DetectorConstruction);
91  //runManager -> SetUserInitialization (new SharedSolidDetectorConstruction);
[1340]92  runManager -> SetUserInitialization (new QGSP_BERT);
[834]93
94  // UserAction classes.
95  runManager -> SetUserAction (new MyRunAction);
96  runManager -> SetUserAction (new MyPrimaryGeneratorAction);
97  runManager -> SetUserAction (new MyEventAction);
98  runManager -> SetUserAction (new MySteppingAction);
99
100  //Initialize G4 kernel
101  //runManager->Initialize();  // Do this with /run/initialize so that
102                               // you can, optionally, choose detector
103                               // (/test19det/detector N) first.
104
105#ifdef G4VIS_USE
106  // Instantiate and initialise Visualization Manager.
107  G4VisManager* visManager = new G4VisExecutive;
108  visManager -> SetVerboseLevel (verbosityString);
109  visManager -> RegisterGraphicsSystem(new G4XXX);
110  visManager -> RegisterGraphicsSystem(new G4XXXFile);
111  visManager -> RegisterGraphicsSystem(new G4XXXStored);
112#ifdef G4VIS_USE_XXXSG
113  visManager -> RegisterGraphicsSystem(new G4XXXSG);
114#endif
115  visManager -> Initialize ();
116#endif
117
[1228]118  G4UImanager* UImanager = G4UImanager::GetUIpointer ();
[834]119#ifdef G4UI_USE_WIN32
120  G4cout << "Reading win32.g4m file...." << G4endl;
[1228]121  UImanager -> ApplyCommand ("/control/execute win32.g4m");
[834]122#else
123  G4cout << "Reading test19.g4m file...." << G4endl;
[1228]124  UImanager -> ApplyCommand ("/control/execute test19.g4m");
[834]125#endif
126
127  G4cout << 
128    "Choose a detector with /test19det/detector (or let default be"
129    " constructed)."
130       << G4endl;
131
[1140]132#ifdef G4UI_USE
[834]133  // Start an interactive session.
[1228]134  ui -> SessionStart();
[1140]135#endif
[834]136
137#ifdef G4VIS_USE
138  G4cout << "vis_test19: Deleting vis manager..." << G4endl;
139  delete visManager;
140  G4cout << "vis_test19: Vis manager deleted." << G4endl;
141#endif
142  G4cout << "vis_test19: Deleting run manager..." << G4endl;
143  delete runManager;
144  G4cout << "vis_test19: Run manager deleted." << G4endl;
145  G4cout << "vis_test19: Deleting session..." << G4endl;
[1140]146#ifdef G4UI_USE
[1228]147  delete ui;
[834]148  G4cout << "vis_test19: Session deleted." << G4endl;
[1140]149#endif
[834]150
151  return 0;
152}
Note: See TracBrowser for help on using the repository browser.