Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Brachy.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 // --------------------------------------------------------------
27 // GEANT 4 - Brachytherapy example
28 // --------------------------------------------------------------
29 //
30 // Code developed by:
31 // S. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
32 
33 //
34 // *******************************
35 // * *
36 // * Brachy.cc *
37 // * *
38 // *******************************
39 //
40 //
41 
42 #include "G4RunManager.hh"
43 #include "G4UImanager.hh"
44 #include "G4UIExecutive.hh"
45 #include "BrachyFactoryIr.hh"
46 #include "BrachyAnalysis.hh"
47 #ifdef G4VIS_USE
48 #include "G4VisExecutive.hh"
49 #endif
50 
52 #include "BrachyPhysicsList.hh"
54 #include "G4SDManager.hh"
55 #include "BrachyRunAction.hh"
56 #include "Randomize.hh"
57 #include "G4RunManager.hh"
58 #include "G4SDManager.hh"
59 #include "G4UImanager.hh"
60 #include "G4UImessenger.hh"
61 
62 #include "G4ScoringManager.hh"
63 
64 #ifdef G4UI_USE
65 #include "G4UIExecutive.hh"
66 #endif
67 
68 #include "G4ScoringManager.hh"
69 #include "BrachyUserScoreWriter.hh"
70 
71 int main(int argc ,char ** argv)
72 
73 {
74  G4ScoringManager::GetScoringManager(); // instanciate the interactive scoring manager
75 
76  G4RunManager* pRunManager = new G4RunManager;
77 
78  // Access to the Scoring Manager pointer
80 
81  // Overwrite the default output file with user-defined one
82  scoringManager->SetScoreWriter(new BrachyUserScoreWriter());
83 
84  // Initialize the physics component
85  pRunManager -> SetUserInitialization(new BrachyPhysicsList);
86 
87  // Initialize the detector component
88  BrachyDetectorConstruction *pDetectorConstruction = new BrachyDetectorConstruction();
89  pRunManager -> SetUserInitialization(pDetectorConstruction);
90 
91  // Initialize the primary particles
93  pRunManager -> SetUserAction(primary);
94 
95  BrachyRunAction *pRunAction = new BrachyRunAction();
96  pRunManager -> SetUserAction(pRunAction);
97 
99 #ifdef G4VIS_USE
100  // Visualization manager
101  G4VisManager* visManager = new G4VisExecutive;
102  visManager->Initialize();
103 #endif
104 
105  //Initialize G4 kernel
106  pRunManager -> Initialize();
107 
108  // get the pointer to the User Interface manager
109  G4UImanager* UImanager = G4UImanager::GetUIpointer();
110  if (argc == 1) // Define UI session for interactive mode.
111  {
112 #ifdef G4UI_USE
113  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
114  G4cout << " UI session starts ..." << G4endl;
115  UImanager -> ApplyCommand("/control/execute VisualisationMacro.mac");
116  ui -> SessionStart();
117  delete ui;
118 #endif
119  }
120  else // Batch mode
121  {
122  G4String command = "/control/execute ";
123  G4String fileName = argv[1];
124  UImanager -> ApplyCommand(command+fileName);
125  }
126 
127  // Job termination
128 #ifdef G4VIS_USE
129  delete visManager;
130 #endif
131 
132  delete pRunManager;
133 
134  return 0;
135 }