Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
gdml_ext.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 //
30 // $Id: gdml_ext.cc 103280 2017-03-23 14:18:19Z gcosmo $
31 //
32 //
33 // --------------------------------------------------------------
34 // GEANT 4 - read_ext
35 //
36 // --------------------------------------------------------------
37 
38 // Geant4 includes
39 //
40 #include "G4RunManager.hh"
41 #include "G4UImanager.hh"
42 #include "globals.hh"
43 
44 // A pre-built physics list
45 //
46 #include "QGSP_BERT.hh"
47 
48 // Example includes
49 //
52 #include "G03RunAction.hh"
53 
54 #include "G4VisExecutive.hh"
55 #include "G4UIExecutive.hh"
56 
57 // --------------------------------------------------------------
58 
59 int main(int argc, char** argv)
60 {
61 
62  // Construct the default run manager
63  //
64  G4RunManager* runManager = new G4RunManager;
65 
66  // Set mandatory initialization and user action classes
67  //
69  runManager->SetUserInitialization(detector);
70  runManager->SetUserInitialization(new QGSP_BERT);
72  G03RunAction* runAction = new G03RunAction;
73  runManager->SetUserAction(runAction);
74 
75  // Initialisation of runManager via macro for the interactive mode
76  // This gives possibility to give different names for GDML file to READ
77 
78  // Initialize visualization
79  //
80  G4VisManager* visManager = new G4VisExecutive;
81  visManager->Initialize();
82 
83  // Run initialisation macro
84  //
86 
87  if ( argc==1 ) // Define UI session for interactive mode.
88  {
89  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
90  UImanager->ApplyCommand("/control/execute vis.mac");
91  ui->SessionStart();
92  delete ui;
93  }
94  else // Batch mode
95  {
96  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
97  G4String command = "/control/execute ";
98  G4String fileName = argv[1];
99  UImanager->ApplyCommand(command+fileName);
100  ui->SessionStart();
101  delete ui;
102  }
103 
104  // Job termination
105  //
106  delete visManager;
107  delete runManager;
108 
109  return 0;
110 }
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:466
virtual void SetUserAction(G4UserRunAction *userAction)
Detector construction for the GDML extensions example.
Definition of the G03RunAction class.
Definition of the G03DetectorConstruction class.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:73
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Primary generator action for the GDML extension example.
int main(int argc, char **argv)
Definition: genwindef.cc:359
Run action for the GDML extension example.
Definition: G03RunAction.hh:50
void Initialize()
Definition of the G03PrimaryGeneratorAction class.