Geant4-11
pyG4RunManager.cc
Go to the documentation of this file.
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// ====================================================================
27// pyG4RunManager.cc
28//
29// 2005 Q
30// ====================================================================
31#include <boost/python.hpp>
32#include "G4Version.hh"
33#include "G4RunManager.hh"
35#include "G4VUserPhysicsList.hh"
36#include "G4UserRunAction.hh"
38#include "G4UserEventAction.hh"
42#include "G4Region.hh"
43#include "G4Run.hh"
44#include "G4Event.hh"
45
46using namespace boost::python;
47
48// ====================================================================
49// thin wrappers
50// ====================================================================
51namespace pyG4RunManager {
52
53// SetUserInitialization()
58
59// SetUserAction()
72
73// DumpRegion
74void (G4RunManager::*f1_DumpRegion)(const G4String&) const
78
79BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_DumpRegion, DumpRegion, 0, 1)
80
81// BeamOn()
82BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_BeamOn, BeamOn, 1, 3)
83
84// AbortRun()
85BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_AbortRun, AbortRun, 0, 1)
86
87// DefineWorldVolume()
89 DefineWorldVolume, 1, 2)
90
91// GeometryHasBeenModified()
92BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GeometryHasBeenModified,
94
95}
96
97using namespace pyG4RunManager;
98
99// ====================================================================
100// module definition
101// ====================================================================
103{
104 class_<G4RunManager, boost::noncopyable>
105 ("G4RunManager", "run manager class")
106 // ---
107 .def("GetRunManager", &G4RunManager::GetRunManager,
108 "Get an instance of G4RunManager",
109 return_value_policy<reference_existing_object>())
110 .staticmethod("GetRunManager")
111 // ---
112 .def("SetVerboseLevel", &G4RunManager::SetVerboseLevel)
113 .def("GetVerboseLevel", &G4RunManager::GetVerboseLevel)
114 // ---
115 .def("Initialize", &G4RunManager::Initialize)
116 .def("BeamOn", &G4RunManager::BeamOn,
117 f_BeamOn((arg("n_event"), arg("macroFile")=0,
118 arg("n_select")=-1),
119 "Starts event loop."))
120 // ---
121 .def("SetUserInitialization", f1_SetUserInitialization)
122 .def("SetUserInitialization", f2_SetUserInitialization)
123 .def("SetUserAction", f1_SetUserAction)
124 .def("SetUserAction", f2_SetUserAction)
125 .def("SetUserAction", f3_SetUserAction)
126 .def("SetUserAction", f4_SetUserAction)
127 .def("SetUserAction", f5_SetUserAction)
128 .def("SetUserAction", f6_SetUserAction)
129 // ---
130 .def("GetUserDetectorConstruction",
132 return_internal_reference<>())
133 .def("GetUserPhysicsList",
135 return_internal_reference<>())
136 .def("GetUserPrimaryGeneratorAction",
138 return_internal_reference<>())
139 .def("GetUserRunAction", &G4RunManager::GetUserRunAction,
140 return_internal_reference<>())
141 .def("GetUserEventAction", &G4RunManager::GetUserEventAction,
142 return_internal_reference<>())
143 .def("GetUserStackingAction", &G4RunManager::GetUserStackingAction,
144 return_internal_reference<>())
145 .def("GetUserTrackingAction", &G4RunManager::GetUserTrackingAction,
146 return_internal_reference<>())
147 .def("GetUserSteppingAction", &G4RunManager::GetUserSteppingAction,
148 return_internal_reference<>())
149 // ---
150 .def("AbortRun", &G4RunManager::AbortRun,
151 f_AbortRun((arg("soft_abort")=false),
152 "Abort run (event loop)."))
153 .def("AbortEvent", &G4RunManager::AbortEvent)
154 .def("DefineWorldVolume", &G4RunManager::DefineWorldVolume,
155 f_DefineWorldVolume())
156 .def("DumpRegion", f1_DumpRegion)
157 .def("DumpRegion", f2_DumpRegion, f_DumpRegion())
158 .def("rndmSaveThisRun", &G4RunManager::rndmSaveThisRun)
159 .def("rndmSaveThisEvent", &G4RunManager::rndmSaveThisEvent)
160 .def("RestoreRandomNumberStatus",
162 .def("SetRandomNumberStore", &G4RunManager::SetRandomNumberStore)
163 .def("GetRandomNumberStore", &G4RunManager::GetRandomNumberStore)
164 .def("SetRandomNumberStoreDir", &G4RunManager::SetRandomNumberStoreDir)
165 .def("GeometryHasBeenModified", &G4RunManager::GeometryHasBeenModified,
166 f_GeometryHasBeenModified())
167 .def("PhysicsHasBeenModified", &G4RunManager::PhysicsHasBeenModified)
168 .def("GetGeometryToBeOptimized",&G4RunManager::GetGeometryToBeOptimized)
169 .def("GetCurrentRun", &G4RunManager::GetCurrentRun,
170 return_value_policy<reference_existing_object>())
171 .def("GetCurrentEvent", &G4RunManager::GetCurrentEvent,
172 return_value_policy<reference_existing_object>())
173 .def("SetRunIDCounter", &G4RunManager::SetRunIDCounter)
174 .def("GetVersionString", &G4RunManager::GetVersionString,
175 return_value_policy<reference_existing_object>())
176 .def("GetRandomNumberStoreDir", &G4RunManager::GetRandomNumberStoreDir,
177 return_internal_reference<>())
178 ;
179
180 // reduced functionality...
181 // void SetPrimaryTransformer(G4PrimaryTransformer* pt)
182 // void SetNumberOfAdditionalWaitingStacks(G4int iAdd)
183 // void CutOffHasBeenModified()
184 // void SetGeometryToBeOptimized(G4bool vl)
185 // const G4Event* GetPreviousEvent(G4int i) const
186 // void SetNumberOfEventsToBeStored(G4int val)
187 // void SetDCtable(G4DCtable* DCtbl)
188
189}
const G4UserTrackingAction * GetUserTrackingAction() const
virtual void AbortRun(G4bool softAbort=false)
virtual void Initialize()
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
void SetRunIDCounter(G4int i)
virtual void RestoreRandomNumberStatus(const G4String &fileN)
const G4VUserPrimaryGeneratorAction * GetUserPrimaryGeneratorAction() const
const G4UserEventAction * GetUserEventAction() const
void SetRandomNumberStoreDir(const G4String &dir)
virtual void rndmSaveThisEvent()
static G4RunManager * GetRunManager()
virtual void AbortEvent()
virtual void rndmSaveThisRun()
virtual void BeamOn(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
const G4UserStackingAction * GetUserStackingAction() const
const G4String & GetVersionString() const
const G4UserSteppingAction * GetUserSteppingAction() const
void PhysicsHasBeenModified()
const G4Event * GetCurrentEvent() const
void SetVerboseLevel(G4int vl)
G4bool GetRandomNumberStore() const
const G4VUserPhysicsList * GetUserPhysicsList() const
const G4String & GetRandomNumberStoreDir() const
const G4Run * GetCurrentRun() const
virtual void SetUserAction(G4UserRunAction *userAction)
const G4UserRunAction * GetUserRunAction() const
void GeometryHasBeenModified(G4bool prop=true)
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetRandomNumberStore(G4bool flag)
void DumpRegion(const G4String &rname) const
G4bool GetGeometryToBeOptimized()
G4int GetVerboseLevel() const
void(G4RunManager::* f4_SetUserAction)(G4UserStackingAction *)
void(G4RunManager::* f2_SetUserInitialization)(G4VUserPhysicsList *)
void(G4RunManager::* f2_SetUserAction)(G4VUserPrimaryGeneratorAction *)
void(G4RunManager::* f1_SetUserInitialization)(G4VUserDetectorConstruction *)
void(G4RunManager::* f1_DumpRegion)(const G4String &) const
void(G4RunManager::* f3_SetUserAction)(G4UserEventAction *)
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_DefineWorldVolume, DefineWorldVolume, 1, 2) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GeometryHasBeenModified
void(G4RunManager::* f1_SetUserAction)(G4UserRunAction *)
void(G4RunManager::* f2_DumpRegion)(G4Region *) const
void(G4RunManager::* f5_SetUserAction)(G4UserTrackingAction *)
void(G4RunManager::* f6_SetUserAction)(G4UserSteppingAction *)
void export_G4RunManager()