Geant4  10.01
ParN02.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: ParN02.cc 76296 2013-11-08 13:17:47Z gcosmo $
31 //
32 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
37 #include "ExN02PhysicsList.hh"
39 #include "ExN02RunAction.hh"
40 #include "ExN02EventAction.hh"
41 #include "ExN02SteppingAction.hh"
42 #include "ExN02SteppingVerbose.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 #include "ParTopC.icc"
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
59 int main(int argc,char** argv)
60 {
61  // User Verbose output class
62  //
65 
66  // Run manager
67  //
68  G4RunManager * runManager = new G4RunManager;
69 
70  // User Initialization classes (mandatory)
71  //
73  runManager->SetUserInitialization(detector);
74  //
75  G4VUserPhysicsList* physics = new ExN02PhysicsList;
76  runManager->SetUserInitialization(physics);
77 
78 #ifdef G4VIS_USE
79  // Visualization, if you choose to have it!
80  //
81  G4VisManager* visManager = new G4VisExecutive;
82  visManager->Initialize();
83 #endif
84 
85  // User Action classes
86  //
88  runManager->SetUserAction(gen_action);
89  //
90  G4UserRunAction* run_action = new ExN02RunAction;
91  runManager->SetUserAction(run_action);
92  //
93  G4UserEventAction* event_action = new ExN02EventAction;
94  runManager->SetUserAction(event_action);
95  //
96  G4UserSteppingAction* stepping_action = new ExN02SteppingAction;
97  runManager->SetUserAction(stepping_action);
98 
99  // Initialize G4 kernel
100  //
101  runManager->Initialize();
102 
103  // Get the pointer to the User Interface manager
104  //
105  G4UImanager * UImanager = G4UImanager::GetUIpointer();
106 
107  if(argc==1) // Define (G)UI terminal for interactive mode
108  {
109 #ifdef G4UI_USE
110  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
111  UImanager->ApplyCommand("/run/beamOn 10");
112  ui->SessionStart();
113  delete ui;
114 #endif
115  }
116  else // Batch mode
117  {
118  G4String command = "/control/execute ";
119  G4String fileName = argv[1];
120  UImanager->ApplyCommand(command+fileName);
121  }
122 
123  // Free the store: user actions, physics_list and detector_description are
124  // owned and deleted by the run manager, so they should not
125  // be deleted in the main() program !
126 
127 #ifdef G4VIS_USE
128  delete visManager;
129 #endif
130  delete runManager;
131  delete verbosity;
132 
133  return 0;
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137 
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
int main(int argc, char **argv)
Definition: ParN02.cc:59
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432
virtual void SetUserAction(G4UserRunAction *userAction)