Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
exampleRE05.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 // $Id: exampleRE05.cc 110007 2018-05-14 08:23:07Z gcosmo $
27 //
30 //
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #include "G4Types.hh"
36 
37 #ifdef G4MULTITHREADED
38 #include "G4MTRunManager.hh"
40 #else
41 #include "G4RunManager.hh"
42 #include "RE05SteppingVerbose.hh"
43 #endif
44 
45 #include "G4UImanager.hh"
46 
49 #include "QBBC.hh"
52 
53 #include "G4VisExecutive.hh"
54 #include "G4UIExecutive.hh"
55 
56 int main(int argc,char** argv)
57 {
58  // Instantiate G4UIExecutive if there are no arguments (interactive mode)
59  G4UIExecutive* ui = nullptr;
60  if ( argc == 1 ) {
61  ui = new G4UIExecutive(argc, argv);
62  }
63 
64 #ifdef G4MULTITHREADED
65  G4MTRunManager* runManager = new G4MTRunManager;
66  G4int number_of_threads = 4; // default number of threads
67  runManager->SetNumberOfThreads(number_of_threads);
69 #else
70  G4VSteppingVerbose* verbosity = new RE05SteppingVerbose;
72  G4RunManager* runManager = new G4RunManager;
73 #endif
74 
75  G4String parallelWorldName = "ReadoutWorld";
76  // User Initialization classes (mandatory)
77  //
79  detector->RegisterParallelWorld
80  (new RE05CalorimeterParallelWorld(parallelWorldName));
81  runManager->SetUserInitialization(detector);
82  //
83  G4VModularPhysicsList* physicsList = new QBBC;
84  physicsList
85  ->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
86  runManager->SetUserInitialization(physicsList);
87  //
89  runManager->SetUserInitialization(actions);
90 
91  runManager->Initialize();
92 
93  G4VisManager* visManager = new G4VisExecutive;
94  visManager->Initialize();
95 
96  //get the pointer to the User Interface manager
97  G4UImanager* UImanager = G4UImanager::GetUIpointer();
98 
99  if (!ui) // batch mode
100  {
101  G4String command = "/control/execute ";
102  G4String fileName = argv[1];
103  UImanager->ApplyCommand(command+fileName);
104  }
105  else // interactive mode : define UI session
106  {
107  UImanager->ApplyCommand("/control/execute vis.mac");
108  ui->SessionStart();
109  delete ui;
110  }
111 
112  delete visManager;
113 
114  // Job termination
115  // Free the store: user actions, physics_list and detector_description are
116  // owned and deleted by the run manager, so they should not
117  // be deleted in the main() program !
118  delete runManager;
119 
120  return 0;
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetNumberOfThreads(G4int n)
Definition of the RE05DetectorConstruction class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:466
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:73
Definition: QBBC.hh:44
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RegisterPhysics(G4VPhysicsConstructor *)
virtual void SetUserInitialization(G4VUserPhysicsList *userPL)
int main(int argc, char **argv)
Definition: genwindef.cc:359
Definition of the RE05SteppingVerbose class.
int G4int
Definition: G4Types.hh:78
Definition of the RE05ActionInitialization class.
static void SetInstance(G4VSteppingVerbose *Instance)
void Initialize()
void RegisterParallelWorld(G4VUserParallelWorld *)
Definition of the RE05WorkerInitialization class.
virtual void Initialize()
Definition of the RE05CalorimeterParallelWorld class.