source: trunk/source/digits_hits/utils/test/test1/test1.cc @ 1347

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

geant4 tag 9.4

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