Geant4  10.01
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 // $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
75 void (G4RunManager::*f1_DumpRegion)(const G4String&) const
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 }
void GeometryHasBeenModified(G4bool prop=true)
G4int GetVerboseLevel() const
virtual void AbortRun(G4bool softAbort=false)
const G4String & GetVersionString() const
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
const G4VUserPrimaryGeneratorAction * GetUserPrimaryGeneratorAction() const
void(G4RunManager::* f1_DumpRegion)(const G4String &) const
void(G4RunManager::* f1_SetUserInitialization)(G4VUserDetectorConstruction *)
void(G4RunManager::* f6_SetUserAction)(G4UserSteppingAction *)
const G4String & GetRandomNumberStoreDir() const
void SetVerboseLevel(G4int vl)
G4bool GetRandomNumberStore() const
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
void(G4RunManager::* f2_SetUserAction)(G4VUserPrimaryGeneratorAction *)
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
void SetRandomNumberStore(G4bool flag)
const G4UserSteppingAction * GetUserSteppingAction() const
const G4Run * GetCurrentRun() const
G4bool GetGeometryToBeOptimized()
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
virtual void RestoreRandomNumberStatus(const G4String &fileN)
virtual void rndmSaveThisRun()
void(G4RunManager::* f5_SetUserAction)(G4UserTrackingAction *)
const G4UserStackingAction * GetUserStackingAction() const
void PhysicsHasBeenModified()
virtual void rndmSaveThisEvent()
const G4UserEventAction * GetUserEventAction() const
const G4UserTrackingAction * GetUserTrackingAction() const
void(G4RunManager::* f3_SetUserAction)(G4UserEventAction *)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
void SetRunIDCounter(G4int i)
void(G4RunManager::* f1_SetUserAction)(G4UserRunAction *)
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_DefineWorldVolume, DefineWorldVolume, 1, 2) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GeometryHasBeenModified
virtual void Initialize()
virtual void AbortEvent()
const G4UserRunAction * GetUserRunAction() const
const G4Event * GetCurrentEvent() const
const G4VUserPhysicsList * GetUserPhysicsList() const
void SetRandomNumberStoreDir(const G4String &dir)
void(G4RunManager::* f4_SetUserAction)(G4UserStackingAction *)
void(G4RunManager::* f2_DumpRegion)(G4Region *) const
void(G4RunManager::* f2_SetUserInitialization)(G4VUserPhysicsList *)
void DumpRegion(const G4String &rname) const
virtual void SetUserAction(G4UserRunAction *userAction)
void export_G4RunManager()