Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
pyG4RunManager.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: pyG4RunManager.cc 86749 2014-11-17 15:03:05Z gcosmo $
27 // ====================================================================
28 // pyG4RunManager.cc
29 //
30 // 2005 Q
31 // ====================================================================
32 #include <boost/python.hpp>
33 #include "G4Version.hh"
34 #include "G4RunManager.hh"
36 #include "G4VUserPhysicsList.hh"
37 #include "G4UserRunAction.hh"
39 #include "G4UserEventAction.hh"
40 #include "G4UserStackingAction.hh"
41 #include "G4UserTrackingAction.hh"
42 #include "G4UserSteppingAction.hh"
43 #include "G4Region.hh"
44 #include "G4Run.hh"
45 #include "G4Event.hh"
46 
47 using namespace boost::python;
48 
49 // ====================================================================
50 // thin wrappers
51 // ====================================================================
52 namespace pyG4RunManager {
53 
54 // SetUserInitialization()
59 
60 // SetUserAction()
73 
74 // DumpRegion
79 
80 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_DumpRegion, DumpRegion, 0, 1)
81 
82 // BeamOn()
83 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_BeamOn, BeamOn, 1, 3)
84 
85 // AbortRun()
86 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_AbortRun, AbortRun, 0, 1)
87 
88 // DefineWorldVolume()
89 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_DefineWorldVolume,
90  DefineWorldVolume, 1, 2)
91 
92 // GeometryHasBeenModified()
93 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GeometryHasBeenModified,
95 
96 }
97 
98 using namespace pyG4RunManager;
99 
100 // ====================================================================
101 // module definition
102 // ====================================================================
104 {
105  class_<G4RunManager, boost::noncopyable>
106  ("G4RunManager", "run manager class")
107  // ---
108  .def("GetRunManager", &G4RunManager::GetRunManager,
109  "Get an instance of G4RunManager",
110  return_value_policy<reference_existing_object>())
111  .staticmethod("GetRunManager")
112  // ---
113  .def("SetVerboseLevel", &G4RunManager::SetVerboseLevel)
114  .def("GetVerboseLevel", &G4RunManager::GetVerboseLevel)
115  // ---
116  .def("Initialize", &G4RunManager::Initialize)
117  .def("BeamOn", &G4RunManager::BeamOn,
118  f_BeamOn((arg("n_event"), arg("macroFile")=0,
119  arg("n_select")=-1),
120  "Starts event loop."))
121  // ---
122  .def("SetUserInitialization", f1_SetUserInitialization)
123  .def("SetUserInitialization", f2_SetUserInitialization)
124  .def("SetUserAction", f1_SetUserAction)
125  .def("SetUserAction", f2_SetUserAction)
126  .def("SetUserAction", f3_SetUserAction)
127  .def("SetUserAction", f4_SetUserAction)
128  .def("SetUserAction", f5_SetUserAction)
129  .def("SetUserAction", f6_SetUserAction)
130  // ---
131  .def("GetUserDetectorConstruction",
133  return_internal_reference<>())
134  .def("GetUserPhysicsList",
136  return_internal_reference<>())
137  .def("GetUserPrimaryGeneratorAction",
139  return_internal_reference<>())
140  .def("GetUserRunAction", &G4RunManager::GetUserRunAction,
141  return_internal_reference<>())
142  .def("GetUserEventAction", &G4RunManager::GetUserEventAction,
143  return_internal_reference<>())
144  .def("GetUserStackingAction", &G4RunManager::GetUserStackingAction,
145  return_internal_reference<>())
146  .def("GetUserTrackingAction", &G4RunManager::GetUserTrackingAction,
147  return_internal_reference<>())
148  .def("GetUserSteppingAction", &G4RunManager::GetUserSteppingAction,
149  return_internal_reference<>())
150  // ---
151  .def("AbortRun", &G4RunManager::AbortRun,
152  f_AbortRun((arg("soft_abort")=false),
153  "Abort run (event loop)."))
154  .def("AbortEvent", &G4RunManager::AbortEvent)
155  .def("DefineWorldVolume", &G4RunManager::DefineWorldVolume,
156  f_DefineWorldVolume())
157  .def("DumpRegion", f1_DumpRegion)
158  .def("DumpRegion", f2_DumpRegion, f_DumpRegion())
159  .def("rndmSaveThisRun", &G4RunManager::rndmSaveThisRun)
160  .def("rndmSaveThisEvent", &G4RunManager::rndmSaveThisEvent)
161  .def("RestoreRandomNumberStatus",
163  .def("SetRandomNumberStore", &G4RunManager::SetRandomNumberStore)
164  .def("GetRandomNumberStore", &G4RunManager::GetRandomNumberStore)
165  .def("SetRandomNumberStoreDir", &G4RunManager::SetRandomNumberStoreDir)
166  .def("GeometryHasBeenModified", &G4RunManager::GeometryHasBeenModified,
167  f_GeometryHasBeenModified())
168  .def("PhysicsHasBeenModified", &G4RunManager::PhysicsHasBeenModified)
169  .def("GetGeometryToBeOptimized",&G4RunManager::GetGeometryToBeOptimized)
170  .def("GetCurrentRun", &G4RunManager::GetCurrentRun,
171  return_value_policy<reference_existing_object>())
172  .def("GetCurrentEvent", &G4RunManager::GetCurrentEvent,
173  return_value_policy<reference_existing_object>())
174  .def("SetRunIDCounter", &G4RunManager::SetRunIDCounter)
175  .def("GetVersionString", &G4RunManager::GetVersionString,
176  return_value_policy<reference_existing_object>())
177  .def("GetRandomNumberStoreDir", &G4RunManager::GetRandomNumberStoreDir,
178  return_internal_reference<>())
179  ;
180 
181  // reduced functionality...
182  // void SetPrimaryTransformer(G4PrimaryTransformer* pt)
183  // void SetNumberOfAdditionalWaitingStacks(G4int iAdd)
184  // void CutOffHasBeenModified()
185  // void SetGeometryToBeOptimized(G4bool vl)
186  // const G4Event* GetPreviousEvent(G4int i) const
187  // void SetNumberOfEventsToBeStored(G4int val)
188  // void SetDCtable(G4DCtable* DCtbl)
189 
190 }
virtual void AbortRun(G4bool softAbort=false)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
const G4Run * GetCurrentRun() const
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateTubeVolume, CreateTubeVolume, 4, 6) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateConeVolume
void(G4RunManager::* f1_SetUserAction)(G4UserRunAction *)
const G4UserRunAction * GetUserRunAction() const
const G4String & GetRandomNumberStoreDir() const
const G4UserEventAction * GetUserEventAction() const
const G4VUserPhysicsList * GetUserPhysicsList() const
const G4UserStackingAction * GetUserStackingAction() const
void(G4RunManager::* f2_DumpRegion)(G4Region *) const
void(G4RunManager::* f1_DumpRegion)(const G4String &) const
void SetRandomNumberStoreDir(const G4String &dir)
const G4UserTrackingAction * GetUserTrackingAction() const
void SetVerboseLevel(G4int vl)
virtual void SetUserAction(G4UserRunAction *userAction)
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
void(G4RunManager::* f3_SetUserAction)(G4UserEventAction *)
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
virtual void rndmSaveThisRun()
G4bool GetRandomNumberStore() const
const G4UserSteppingAction * GetUserSteppingAction() const
void(G4RunManager::* f4_SetUserAction)(G4UserStackingAction *)
void GeometryHasBeenModified(G4bool prop=true)
G4bool GetGeometryToBeOptimized()
void export_G4RunManager()
const G4Event * GetCurrentEvent() const
void(G4RunManager::* f5_SetUserAction)(G4UserTrackingAction *)
void(G4RunManager::* f2_SetUserInitialization)(G4VUserPhysicsList *)
void SetRandomNumberStore(G4bool flag)
G4int GetVerboseLevel() const
void(G4RunManager::* f1_SetUserInitialization)(G4VUserDetectorConstruction *)
void DumpRegion(const G4String &rname) const
virtual void RestoreRandomNumberStatus(const G4String &fileN)
void PhysicsHasBeenModified()
virtual void rndmSaveThisEvent()
virtual void AbortEvent()
void(G4RunManager::* f2_SetUserAction)(G4VUserPrimaryGeneratorAction *)
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData
virtual void Initialize()
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
const G4String & GetVersionString() const
const G4VUserPrimaryGeneratorAction * GetUserPrimaryGeneratorAction() const
void SetRunIDCounter(G4int i)
void(G4RunManager::* f6_SetUserAction)(G4UserSteppingAction *)