source: trunk/source/digits_hits/utils/test/test2/test2.cc

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

update to last version 4.9.4

File size: 4.2 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: test2.cc,v 1.3 2010/11/03 08:48:57 taso 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 "Test2DetectorConstruction.hh"
43#include "Test2ParallelWorld.hh"
44#include "Test2PhysicsList.hh"
45#include "Test2PrimaryGeneratorAction.hh"
46#include "Test2RunAction.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(0);
55
56 // Set mandatory initialization classes
57 //
58 // Sensitivity Type = 0 none
59 // 1 PrimitiveScorer
60 // 2 SensitiveDetector
61 // mass world
62 Test2DetectorConstruction* detector = new Test2DetectorConstruction;
63 detector->SetSensitivityType(2);
64 Test2ParallelWorld* parallel = new Test2ParallelWorld("ParallelScoringWorld");
65 parallel->SetSensitivityType(1);
66 // parallel world
67 detector->RegisterParallelWorld(parallel);
68 runManager->SetUserInitialization(detector);
69
70 //
71 G4VUserPhysicsList* physics = new Test2PhysicsList;
72 runManager->SetUserInitialization(physics);
73
74 // Set user action classes
75 //
76 G4VUserPrimaryGeneratorAction* gen_action = new Test2PrimaryGeneratorAction;
77 runManager->SetUserAction(gen_action);
78 //
79 G4UserRunAction* run_action = new Test2RunAction;
80 runManager->SetUserAction(run_action);
81
82#ifdef G4VIS_USE
83 // Visualization manager
84 //
85 G4VisManager* visManager = new G4VisExecutive;
86 visManager->Initialize();
87#endif
88
89 // Initialize G4 kernel
90 //
91 runManager->Initialize();
92
93 // Get the pointer to the User Interface manager
94 //
95 G4UImanager* UI = G4UImanager::GetUIpointer();
96
97 if (argc==1) // Define UI session for interactive mode
98 {
99 G4UIsession* session=0;
100
101 // G4UIterminal is a (dumb) terminal
102 //
103#ifdef G4UI_USE_TCSH
104 session = new G4UIterminal(new G4UItcsh);
105#else
106 session = new G4UIterminal();
107#endif
108
109// UI->ApplyCommand("/control/execute vis.mac");
110 session->SessionStart();
111
112 delete session;
113 }
114 else // Batch mode
115 {
116 G4String command = "/control/execute ";
117 G4String fileName = argv[1];
118 UI->ApplyCommand(command+fileName);
119 }
120
121 // Job termination
122 // Free the store: user actions, physics_list and detector_description are
123 // owned and deleted by the run manager, so they should not
124 // be deleted in the main() program !
125
126#ifdef G4VIS_USE
127 delete visManager;
128#endif
129 delete runManager;
130
131 return 0;
132}
Note: See TracBrowser for help on using the repository browser.