Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
exampleRE06.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 //
28 //
29 // $Id: exampleRE06.cc 109972 2018-05-14 07:07:04Z gcosmo $
30 //
31 // --------------------------------------------------------------
32 // GEANT 4 - example RE06
33 // --------------------------------------------------------------
34 
35 #include "G4Types.hh"
36 
37 #ifdef G4MULTITHREADED
38 #include "G4MTRunManager.hh"
39 #else
40 #include "G4RunManager.hh"
41 #endif
42 
43 #include "G4VisExecutive.hh"
44 #include "G4UIExecutive.hh"
45 
46 #include "G4UImanager.hh"
47 #include "FTFP_BERT.hh"
49 
51 #include "RE06ParallelWorld.hh"
53 #include "RE06RunAction.hh"
54 #include "RE06SteppingVerbose.hh"
57 
58 int main(int argc,char** argv)
59 {
60  // Instantiate G4UIExecutive if there are no arguments (interactive mode)
61  G4UIExecutive* ui = nullptr;
62  if ( argc == 1 ) {
63  ui = new G4UIExecutive(argc, argv);
64  }
65 
66  // Construct the stepping verbose class
69 
70  // Construct the run manager
71  //
72 #ifdef G4MULTITHREADED
73  G4MTRunManager * runManager = new G4MTRunManager;
74  runManager->SetNumberOfThreads(4);
76 #else
77  G4RunManager* runManager = new G4RunManager;
78 #endif
79 
80  // Set mandatory initialization classes
81  //
82  G4String parallelWorldName = "ParallelScoringWorld";
84  detector->RegisterParallelWorld(new RE06ParallelWorld(parallelWorldName));
85  runManager->SetUserInitialization(detector);
86  //
87  G4VModularPhysicsList* physics = new FTFP_BERT;
88  physics->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
89  runManager->SetUserInitialization(physics);
90 
91  // Set user action classes
92  //
94 
95  // Visualization manager
96  //
97  G4VisManager* visManager = new G4VisExecutive;
98  visManager->Initialize();
99 
100  // Initialize G4 kernel
101  //
102  runManager->Initialize();
103 
104  // Get the pointer to the User Interface manager
105  //
106  G4UImanager* UImanager = G4UImanager::GetUIpointer();
107 
108  if (ui) // Define UI session for interactive mode
109  {
110  UImanager->ApplyCommand("/control/execute vis.mac");
111  ui->SessionStart();
112  delete ui;
113  }
114  else // Batch mode
115  {
116  G4String command = "/control/execute ";
117  G4String fileName = argv[1];
118  UImanager->ApplyCommand(command+fileName);
119  }
120 
121  // Job termination
122  // Free the store:
123  // user actions, physics_list and detector_description are
124  // owned and deleted by the run manager, so they should not
125  // be deleted in the main() program !
126 
127  delete visManager;
128  delete runManager;
129 
130  return 0;
131 }
void SetNumberOfThreads(G4int n)
Definition of the RE06SteppingVerbose class.
Definition of the RE06PrimaryGeneratorAction class.
Definition of the RE06WorkerInitialization class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:466
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:73
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RegisterPhysics(G4VPhysicsConstructor *)
virtual void SetUserInitialization(G4VUserPhysicsList *userPL)
Definition of the RE06DetectorConstruction class.
Definition of the RE06ParallelWorld class.
Definition of the RE06RunAction class.
int main(int argc, char **argv)
Definition: genwindef.cc:359
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
static void SetInstance(G4VSteppingVerbose *Instance)
void Initialize()
Definition of the RE06ActionInitialization class.
void RegisterParallelWorld(G4VUserParallelWorld *)
virtual void Initialize()