Geant4  10.03
GammaTherapy.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 //
26 // $Id: GammaTherapy.cc 67994 2013-03-13 11:05:39Z gcosmo $
27 //
30 //
31 //
32 // -------------------------------------------------------------
33 // GEANT4 ibrem
34 //
35 // History: based on object model of
36 // 2nd December 1995, G.Cosmo
37 // ---------- ibrem ----------------------------
38 //
39 // Modified: 05.04.01 Vladimir Ivanchenko new design of ibrem
40 //
41 // -------------------------------------------------------------
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45 
46 #include "G4RunManager.hh"
47 #include "G4UImanager.hh"
48 #include "Randomize.hh"
49 
50 #ifdef G4VIS_USE
51 #include "G4VisExecutive.hh"
52 #endif
53 
54 #ifdef G4UI_USE
55 #include "G4UIExecutive.hh"
56 #endif
57 
58 #include "DetectorConstruction.hh"
59 #include "PhysicsList.hh"
60 #include "PrimaryGeneratorAction.hh"
61 #include "TrackingAction.hh"
62 #include "RunAction.hh"
63 #include "Histo.hh"
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
67 
68 int main(int argc,char** argv) {
69 
70  //choose the Random engine
71  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
72 
73  // Construct the default run manager
74  G4RunManager * runManager = new G4RunManager();
75 
76  // set mandatory initialization classes
78  runManager->SetUserInitialization(det);
79 
80  runManager->SetUserInitialization(new PhysicsList());
81 
82  // set user action classes
83  runManager->SetUserAction(new PrimaryGeneratorAction(det));
84  runManager->SetUserAction(new RunAction());
85  runManager->SetUserAction(new TrackingAction());
86 
87  // get the pointer to the User Interface manager
89 
90 #ifdef G4VIS_USE
91  G4VisManager* visManager = new G4VisExecutive("Quiet");
92  visManager->Initialize();
93 #endif
94 
95  if (argc==1) // Define UI terminal for interactive mode
96  {
97 #ifdef G4UI_USE
98  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
99 #ifdef G4VIS_USE
100  UImanager->ApplyCommand("/control/execute vis.mac");
101 #endif
102  ui->SessionStart();
103  delete ui;
104 #endif
105  }
106  else if (argc>1) // Batch mode with 1 or more files
107  {
108  G4String command = "/control/execute ";
109  G4String fileName = argv[1];
110  UImanager->ApplyCommand(command+fileName);
111  }
112 
113 #ifdef G4VIS_USE
114  delete visManager;
115 #endif
116 
117  // job termination
118  delete runManager;
119 
120  return 0;
121 }
122 
123 
The primary generator action class with particle gun.
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
int main(int argc, char **argv)
Definition: GammaTherapy.cc:68
void Initialize()
Detector construction class to demonstrate various ways of placement.
Run action class.
Definition: RunAction.hh:45
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446
virtual void SetUserAction(G4UserRunAction *userAction)
Physics list class.
Definition: PhysicsList.hh:47