ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Brachy.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Brachy.cc
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 currently by:
31 // S.Guatelli & D. Cutajar
32 
33 //
34 // *******************************
35 // * *
36 // * Brachy.cc *
37 // * *
38 // *******************************
39 //
40 //
41 #include "G4Types.hh"
42 
43 #ifdef G4MULTITHREADED
44  #include "G4MTRunManager.hh"
45 #else
46  #include "G4RunManager.hh"
47 #endif
48 
49 #include "G4UImanager.hh"
50 #include "G4UIExecutive.hh"
51 
53 
54 #ifdef ANALYSIS_USE
55 #include "BrachyAnalysisManager.hh"
56 #endif
57 
58 #include "G4VisExecutive.hh"
59 
61 #include "BrachyPhysicsList.hh"
63 #include "G4SDManager.hh"
64 #include "Randomize.hh"
65 #include "G4RunManager.hh"
66 #include "G4SDManager.hh"
67 #include "G4UImanager.hh"
68 #include "G4UImessenger.hh"
69 
70 #include "G4ScoringManager.hh"
71 #include "G4UIExecutive.hh"
72 
73 #include "G4ScoringManager.hh"
74 #include "BrachyUserScoreWriter.hh"
75 
76 int main(int argc ,char ** argv)
77 
78 {
79 #ifdef G4MULTITHREADED
80  G4MTRunManager* pRunManager = new G4MTRunManager;
81  pRunManager->SetNumberOfThreads(4); // Is equal to 2 by default
82 #else
83  G4RunManager* pRunManager = new G4RunManager;
84 #endif
85 
86  G4cout << "***********************" << G4endl;
87  G4cout << "*** Seed: " << G4Random::getTheSeed() << " ***" << G4endl;
88  G4cout << "***********************" << G4endl;
89  // Access to the Scoring Manager pointer
90 
92 
93  // Overwrite the default output file with user-defined one
94  scoringManager->SetScoreWriter(new BrachyUserScoreWriter());
95 
96  // Initialize the physics component
97  pRunManager -> SetUserInitialization(new BrachyPhysicsList);
98 
99  // Initialize the detector component
100  BrachyDetectorConstruction *pDetectorConstruction = new BrachyDetectorConstruction();
101  pRunManager -> SetUserInitialization(pDetectorConstruction);
102 
103 // Analysis Manager
104 #ifdef ANALYSIS_USE
106  analysis -> book();
107 #endif
108 
109  // User action initialization
110 
112  pRunManager->SetUserInitialization(actions);
113 
114  //Initialize G4 kernel
115  // pRunManager -> Initialize();
116 
117  // Visualization manager
118  G4VisManager* visManager = new G4VisExecutive;
119  visManager->Initialize();
120 
121  // get the pointer to the User Interface manager
122  G4UImanager* UImanager = G4UImanager::GetUIpointer();
123  if (argc == 1) // Define UI session for interactive mode.
124  {
125  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
126  G4cout << " UI session starts ..." << G4endl;
127  UImanager -> ApplyCommand("/control/execute VisualisationMacro.mac");
128  ui -> SessionStart();
129  delete ui;
130  }
131  else // Batch mode
132  {
133  G4String command = "/control/execute ";
134  G4String fileName = argv[1];
135  UImanager -> ApplyCommand(command+fileName);
136  }
137 
138  // Job termination
139 
140  delete visManager;
141 
142 
143 #ifdef ANALYSIS_USE
144 // Close the output ROOT file with the results
145  analysis -> save();
146  delete analysis;
147 #endif
148 
149  delete pRunManager;
150 
151  return 0;
152 }