ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyG4RunManager.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 // ====================================================================
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"
39 #include "G4UserStackingAction.hh"
40 #include "G4UserTrackingAction.hh"
41 #include "G4UserSteppingAction.hh"
42 #include "G4Region.hh"
43 #include "G4Run.hh"
44 #include "G4Event.hh"
45 
46 using namespace boost::python;
47 
48 // ====================================================================
49 // thin wrappers
50 // ====================================================================
51 namespace pyG4RunManager {
52 
53 // SetUserInitialization()
58 
59 // SetUserAction()
72 
73 // DumpRegion
78 
79 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_DumpRegion, DumpRegion, 0, 1)
80 
81 // BeamOn()
82 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_BeamOn, BeamOn, 1, 3)
83 
84 // AbortRun()
85 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_AbortRun, AbortRun, 0, 1)
86 
87 // DefineWorldVolume()
88 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_DefineWorldVolume,
89  DefineWorldVolume, 1, 2)
90 
91 // GeometryHasBeenModified()
92 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GeometryHasBeenModified,
94 
95 }
96 
97 using 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 }