Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
XrayFluoSimulation.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 // $Id: XrayFluoSimulation.cc
28 //
29 // Author: Elena Guardincerri
30 //
31 // History:
32 // -----------
33 // 28 Nov 2001 Elena Guardincerri Created
34 // 24 Ago 2002 Splitted in a separet class Alfonso Mantero
35 // 18 Jan 2011 adapted to new deexcitation design
36 //
37 // -------------------------------------------------------------------
38 
39 #include "G4Types.hh"
40 
41 #ifdef G4MULTITHREADED
42 #include "G4MTRunManager.hh"
43 #else
44 #include "G4RunManager.hh"
45 #endif
46 
47 #include "G4UImanager.hh"
48 #include "Randomize.hh"
49 #ifdef G4VIS_USE
50 #include "G4VisExecutive.hh"
51 #endif
52 #ifdef G4UI_USE
53 #include "G4UIExecutive.hh"
54 #endif
58 #include "XrayFluoPhysicsList.hh"
59 #include "XrayFluoSimulation.hh"
60 
63 
64 
66 {;}
67 
68 
70 {;}
71 
72 void XrayFluoSimulation::RunSimulation(int argc,char* argv[])
73 {
74  // choose the Random engine
75  G4Random::setTheEngine(new CLHEP::RanecuEngine);
76  G4Random::setTheSeed(dir);
77 
78 #ifdef G4MULTITHREADED
79  // Construct the default run manager
80  G4MTRunManager* runManager = new G4MTRunManager();
81  G4cout << "Using the MT Run Manager (G4MULTITHREADED=ON)" << G4endl;
82 #else
83  G4RunManager * runManager = new G4RunManager;
84  G4cout << "Using the sequential Run Manager" << G4endl;
85 #endif
86 
87 
88  // chosing Geometry setup
89  G4int geometryNumber = 0;
90 
91  if (argc == 3){
92  geometryNumber = atoi(argv[2]);
93 
94  }
95  while ( (geometryNumber < 1) || (geometryNumber >4)) {
96  G4cout << "Please Select Simulation Geometrical Set-Up: "<< G4endl;
97  G4cout << "1 - Test Beam" << G4endl;
98  G4cout << "2 - Infinite Plane" << G4endl;
99  G4cout << "3 - Planet and Sun"<< G4endl;
100  G4cout << "4 - Phase-Space Production"<< G4endl;
101 
102  G4cin >> geometryNumber;
103  }
104 
105  // set analysis to have the messenger running...
106  XrayFluoAnalysisManager* analysis =
108 
109  // set mandatory initialization
110 
111  //Initialize geometry
112  if (geometryNumber == 1 || geometryNumber == 4) {
113  XrayFluoDetectorConstruction* testBeamDetector
115  if (geometryNumber == 4) {
116  testBeamDetector->PhaseSpaceOn();
117  analysis->PhaseSpaceOn();
118  }
119  runManager->SetUserInitialization(testBeamDetector);
120  }
121  else if (geometryNumber == 2) {
124  runManager->SetUserInitialization(planeDetector);
125  }
126  else if (geometryNumber == 3) {
127  XrayFluoMercuryDetectorConstruction* mercuryDetector =
129  runManager->SetUserInitialization(mercuryDetector);
130  }
131 
132 
133  //Initialize physics
134  runManager->SetUserInitialization(new XrayFluoPhysicsList());
135 
136  //Initialize actions
137  runManager->SetUserInitialization
138  (new XrayFluoActionInitializer(geometryNumber));
139 
140 #ifdef G4VIS_USE
141  //visualization manager
142  G4VisManager* visManager = new G4VisExecutive;
143  visManager->Initialize();
144 #endif
145 
146  // get the pointer to the User Interface manager
147  G4UImanager* UImanager = G4UImanager::GetUIpointer();
148 
149  if (getenv("G4VIS_USE")) {
150  UImanager->ApplyCommand("/control/execute vis.mac");
151  }
152 
153  if (argc == 1) // Define UI session for interactive mode.
154  {
155  UImanager->ApplyCommand("/control/execute initInter.mac");
156 #ifdef G4UI_USE
157  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
158  ui->SessionStart();
159  delete ui;
160 #endif
161  }
162  else // Batch mode
163  {
164  G4String command = "/control/execute ";
165  G4String fileName = argv[1];
166  UImanager->ApplyCommand(command+fileName);
167  }
168 
169  // job termination
170 #ifdef G4VIS_USE
171  delete visManager;
172  G4cout << "visManager deleted"<< G4endl;
173 #endif
174 
175 
176  delete runManager;
177 
178 
179 }
#define G4cin
Definition: G4ios.hh:60
static XrayFluoAnalysisManager * getInstance()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:466
#define G4endl
Definition: G4ios.hh:61
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:73
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static XrayFluoMercuryDetectorConstruction * GetInstance()
long seed
Definition: chem4.cc:68
static XrayFluoPlaneDetectorConstruction * GetInstance()
void RunSimulation(int argc, char *argv[])
int G4int
Definition: G4Types.hh:78
TDirectory * dir
XrayFluoSimulation(G4int seed)
G4GLOB_DLL std::ostream G4cout
void Initialize()
static XrayFluoDetectorConstruction * GetInstance()