Geant4  10.00.p02
exampleP01.cc
Go to the documentation of this file.
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 //
28 //
29 //
30 // $Id: exampleP01.cc 68025 2013-03-13 13:43:46Z gcosmo $
31 //
32 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
37 #include "ExP01PhysicsList.hh"
39 #include "ExP01RunAction.hh"
40 #include "ExP01EventAction.hh"
41 #include "ExP01SteppingAction.hh"
42 #include "ExP01SteppingVerbose.hh"
43 
44 #include "G4RunManager.hh"
45 #include "G4UImanager.hh"
46 
47 #ifdef G4VIS_USE
48 #include "G4VisExecutive.hh"
49 #endif
50 
51 #ifdef G4UI_USE
52 #include "G4UIExecutive.hh"
53 #endif
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56 
57 int main(int argc,char** argv) {
58 
59  //my Verbose output class
61 
62  // Run manager
63  G4RunManager * runManager = new G4RunManager;
64 
65  // UserInitialization classes (mandatory)
67  runManager->SetUserInitialization(ExP01detector);
68  runManager->SetUserInitialization(new ExP01PhysicsList);
69 
70 #ifdef G4VIS_USE
71  // Visualization, if you choose to have it!
72  G4VisManager* visManager = new G4VisExecutive;
73  visManager->Initialize();
74 #endif
75 
76  // UserAction classes
77  runManager->SetUserAction(new ExP01PrimaryGeneratorAction(ExP01detector));
78  runManager->SetUserAction(new ExP01RunAction);
79  runManager->SetUserAction(new ExP01EventAction);
80  runManager->SetUserAction(new ExP01SteppingAction);
81 
82  //Initialize G4 kernel
83  runManager->Initialize();
84 
85  //get the pointer to the User Interface manager
86  G4UImanager * UImanager = G4UImanager::GetUIpointer();
87 
88  if(argc==1)
89  // Define (G)UI terminal for interactive mode
90  {
91 #ifdef G4UI_USE
92  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
93 #ifdef G4VIS_USE
94  UImanager->ApplyCommand("/control/execute vis.mac");
95 #endif
96  ui->SessionStart();
97  delete ui;
98 #endif
99  }
100  else
101  // Batch mode
102  {
103  G4String command = "/control/execute ";
104  G4String fileName = argv[1];
105  UImanager->ApplyCommand(command+fileName);
106  }
107 
108 #ifdef G4VIS_USE
109  delete visManager;
110 #endif
111 
112  delete runManager;
113 
114  return 0;
115 }
116 
117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118 
Definition of the ExP01RunAction class.
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Definition of the ExP01SteppingAction class.
int main(int argc, char **argv)
Definition: exampleP01.cc:57
Definition of the ExP01DetectorConstruction class.
Definition of the ExP01EventAction class.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
Detector Construction for the persistency example.
Stepping verbose for the persistency example.
Definition of the ExP01SteppingVerbose class.
Run action for the persistency example.
Physics list for the persistency example.
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
Definition of the ExP01PhysicsList class.
Primary generator action for the persistency example.
virtual void Initialize()
Event action for the persistency example.
Stepping action for the persistency example.
Definition of the ExP01PrimaryGeneratorAction class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432
virtual void SetUserAction(G4UserRunAction *userAction)