source: trunk/source/digits_hits/utils/test/test3/test3.cc @ 1350

Last change on this file since 1350 was 1350, checked in by garnier, 13 years ago

update to last version 4.9.4

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//
27// $Id: test3.cc,v 1.1 2010/09/15 21:16:41 asaim Exp $
28// GEANT4 tag $Name:  $
29//
30//
31
32#include "G4RunManager.hh"
33#include "G4UImanager.hh"
34#include "G4UIterminal.hh"
35#include "G4UItcsh.hh"
36
37#include "G4ScoringManager.hh"
38
39#ifdef G4VIS_USE
40#include "G4VisExecutive.hh"
41#endif
42#include "Tst1DetectorConstruction.hh"
43#include "Tst1PhysicsList.hh"
44#include "Tst1PrimaryGeneratorAction.hh"
45
46int main(int argc,char** argv)
47{
48 // Construct the run manager
49 //
50 G4RunManager * runManager = new G4RunManager;
51 G4ScoringManager * scManager = G4ScoringManager::GetScoringManager();
52 scManager->SetVerboseLevel(1);
53
54 // Set mandatory initialization classes
55 //
56 G4VUserDetectorConstruction* detector = new Tst1DetectorConstruction;
57 runManager->SetUserInitialization(detector);
58 //
59 G4VUserPhysicsList* physics = new Tst1PhysicsList;
60 runManager->SetUserInitialization(physics);
61   
62 // Set user action classes
63 //
64 G4VUserPrimaryGeneratorAction* gen_action = new Tst1PrimaryGeneratorAction;
65 runManager->SetUserAction(gen_action);
66 //
67 
68#ifdef G4VIS_USE
69 // Visualization manager
70 //
71 G4VisManager* visManager = new G4VisExecutive;
72 visManager->Initialize();
73#endif
74   
75 // Initialize G4 kernel
76 //
77 runManager->Initialize();
78 
79 // Get the pointer to the User Interface manager
80 //
81 G4UImanager* UI = G4UImanager::GetUIpointer(); 
82
83 if (argc==1)   // Define UI session for interactive mode
84 {
85   G4UIsession* session=0;
86 
87   // G4UIterminal is a (dumb) terminal
88   //
89#ifdef G4UI_USE_TCSH
90   session = new G4UIterminal(new G4UItcsh);     
91#else
92   session = new G4UIterminal();
93#endif   
94     
95//   UI->ApplyCommand("/control/execute vis.mac");   
96   session->SessionStart();
97
98   delete session;
99 }
100 else           // Batch mode
101 { 
102   G4String command = "/control/execute ";
103   G4String fileName = argv[1];
104   UI->ApplyCommand(command+fileName);
105 }
106
107  // Job termination
108  // Free the store: user actions, physics_list and detector_description are
109  //                 owned and deleted by the run manager, so they should not
110  //                 be deleted in the main() program !
111
112#ifdef G4VIS_USE
113 delete visManager;
114#endif
115 delete runManager;
116
117 return 0;
118}
Note: See TracBrowser for help on using the repository browser.