Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
exampleP01.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: exampleP01.cc 110382 2018-05-22 07:48:02Z gcosmo $
31 //
32 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
36 #include "G4Types.hh"
37 
40 #include "ExP01RunAction.hh"
41 #include "ExP01EventAction.hh"
42 #include "ExP01SteppingAction.hh"
43 #include "ExP01SteppingVerbose.hh"
44 
45 #include "FTFP_BERT.hh"
46 
47 #include "G4RunManager.hh"
48 #include "G4UImanager.hh"
49 
50 #include "G4VisExecutive.hh"
51 #include "G4UIExecutive.hh"
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
55 int main(int argc,char** argv) {
56 
57  // Instantiate G4UIExecutive if interactive mode
58  G4UIExecutive* ui = nullptr;
59  if ( argc == 1 ) {
60  ui = new G4UIExecutive(argc, argv);
61  }
62 
63  //my Verbose output class
65 
66  // Run manager
67  G4RunManager * runManager = new G4RunManager;
68 
69  // UserInitialization classes (mandatory)
71  runManager->SetUserInitialization(ExP01detector);
72 
73  G4VModularPhysicsList* physicsList = new FTFP_BERT;
74  runManager->SetUserInitialization(physicsList);
75 
76  // Visualization
77  G4VisManager* visManager = new G4VisExecutive;
78  visManager->Initialize();
79 
80  // UserAction classes
81  runManager->SetUserAction(new ExP01PrimaryGeneratorAction(ExP01detector));
82  runManager->SetUserAction(new ExP01RunAction);
83  runManager->SetUserAction(new ExP01EventAction);
84  runManager->SetUserAction(new ExP01SteppingAction);
85 
86  //Initialize G4 kernel
87  runManager->Initialize();
88 
89  //get the pointer to the User Interface manager
90  G4UImanager * UImanager = G4UImanager::GetUIpointer();
91 
92  if(ui)
93  // Define (G)UI terminal for interactive mode
94  {
95  UImanager->ApplyCommand("/control/execute vis.mac");
96  ui->SessionStart();
97  delete ui;
98  }
99  else
100  // Batch mode
101  {
102  G4String command = "/control/execute ";
103  G4String fileName = argv[1];
104  UImanager->ApplyCommand(command+fileName);
105  }
106 
107  delete visManager;
108 
109  delete runManager;
110 
111  return 0;
112 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115 
Definition of the ExP01RunAction class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:466
virtual void SetUserAction(G4UserRunAction *userAction)
Primary generator action for the persistency example.
Stepping verbose for the persistency example.
Definition of the ExP01SteppingAction class.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:73
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Definition of the ExP01EventAction class.
Detector Construction for the persistency example.
Run action for the persistency example.
int main(int argc, char **argv)
Definition: genwindef.cc:359
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
Definition of the ExP01DetectorConstruction class.
Stepping action for the persistency example.
static void SetInstance(G4VSteppingVerbose *Instance)
void Initialize()
Definition of the ExP01SteppingVerbose class.
Definition of the ExP01PrimaryGeneratorAction class.
Event action for the persistency example.
virtual void Initialize()