Geant4  10.00.p02
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 76884 2013-11-18 12:54:03Z 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 }
93 
94 using namespace pyG4RunManager;
95 
96 // ====================================================================
97 // module definition
98 // ====================================================================
100 {
101  class_<G4RunManager, boost::noncopyable>
102  ("G4RunManager", "run manager class")
103  // ---
104  .def("GetRunManager", &G4RunManager::GetRunManager,
105  "Get an instance of G4RunManager",
106  return_value_policy<reference_existing_object>())
107  .staticmethod("GetRunManager")
108  // ---
109  .def("SetVerboseLevel", &G4RunManager::SetVerboseLevel)
110  .def("GetVerboseLevel", &G4RunManager::GetVerboseLevel)
111  // ---
112  .def("Initialize", &G4RunManager::Initialize)
113  .def("BeamOn", &G4RunManager::BeamOn,
114  f_BeamOn((arg("n_event"), arg("macroFile")=0,
115  arg("n_select")=-1),
116  "Starts event loop."))
117  // ---
118  .def("SetUserInitialization", f1_SetUserInitialization)
119  .def("SetUserInitialization", f2_SetUserInitialization)
120  .def("SetUserAction", f1_SetUserAction)
121  .def("SetUserAction", f2_SetUserAction)
122  .def("SetUserAction", f3_SetUserAction)
123  .def("SetUserAction", f4_SetUserAction)
124  .def("SetUserAction", f5_SetUserAction)
125  .def("SetUserAction", f6_SetUserAction)
126  // ---
127  .def("GetUserDetectorConstruction",
129  return_internal_reference<>())
130  .def("GetUserPhysicsList",
132  return_internal_reference<>())
133  .def("GetUserPrimaryGeneratorAction",
135  return_internal_reference<>())
136  .def("GetUserRunAction", &G4RunManager::GetUserRunAction,
137  return_internal_reference<>())
138  .def("GetUserEventAction", &G4RunManager::GetUserEventAction,
139  return_internal_reference<>())
140  .def("GetUserStackingAction", &G4RunManager::GetUserStackingAction,
141  return_internal_reference<>())
142  .def("GetUserTrackingAction", &G4RunManager::GetUserTrackingAction,
143  return_internal_reference<>())
144  .def("GetUserSteppingAction", &G4RunManager::GetUserSteppingAction,
145  return_internal_reference<>())
146  // ---
147  .def("AbortRun", &G4RunManager::AbortRun,
148  f_AbortRun((arg("soft_abort")=false),
149  "Abort run (event loop)."))
150  .def("AbortEvent", &G4RunManager::AbortEvent)
151  .def("DefineWorldVolume", &G4RunManager::DefineWorldVolume,
152  f_DefineWorldVolume())
153  .def("DumpRegion", f1_DumpRegion)
154  .def("DumpRegion", f2_DumpRegion, f_DumpRegion())
155  .def("rndmSaveThisRun", &G4RunManager::rndmSaveThisRun)
156  .def("rndmSaveThisEvent", &G4RunManager::rndmSaveThisEvent)
157  .def("RestoreRandomNumberStatus",
159  .def("SetRandomNumberStore", &G4RunManager::SetRandomNumberStore)
160  .def("GetRandomNumberStore", &G4RunManager::GetRandomNumberStore)
161  .def("SetRandomNumberStoreDir", &G4RunManager::SetRandomNumberStoreDir)
162  .def("GeometryHasBeenModified", &G4RunManager::GeometryHasBeenModified)
163  .def("PhysicsHasBeenModified", &G4RunManager::PhysicsHasBeenModified)
164  .def("GetGeometryToBeOptimized",&G4RunManager::GetGeometryToBeOptimized)
165  .def("GetCurrentRun", &G4RunManager::GetCurrentRun,
166  return_value_policy<reference_existing_object>())
167  .def("GetCurrentEvent", &G4RunManager::GetCurrentEvent,
168  return_value_policy<reference_existing_object>())
169  .def("SetRunIDCounter", &G4RunManager::SetRunIDCounter)
170 
171 #if G4VERSION_NUMBER >= 932
172  .def("GetVersionString", &G4RunManager::GetVersionString,
173  return_value_policy<reference_existing_object>())
174  .def("GetRandomNumberStoreDir", &G4RunManager::GetRandomNumberStoreDir,
175  return_internal_reference<>())
176 #else
177  .def("GetVersionString", &G4RunManager::GetVersionString)
178  .def("GetRandomNumberStoreDir", &G4RunManager::GetRandomNumberStoreDir)
179 #endif
180  ;
181 
182  // reduced functionality...
183  // void SetPrimaryTransformer(G4PrimaryTransformer* pt)
184  // void SetNumberOfAdditionalWaitingStacks(G4int iAdd)
185  // void CutOffHasBeenModified()
186  // void SetGeometryToBeOptimized(G4bool vl)
187  // const G4Event* GetPreviousEvent(G4int i) const
188  // void SetNumberOfEventsToBeStored(G4int val)
189  // void SetDCtable(G4DCtable* DCtbl)
190 
191 }
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)
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateTubeVolume, CreateTubeVolume, 4, 6) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateConeVolume
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:74
void SetRunIDCounter(G4int i)
void(G4RunManager::* f1_SetUserAction)(G4UserRunAction *)
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()