Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
pyEzgeom.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: pyEzgeom.cc 76884 2013-11-18 12:54:03Z gcosmo $
27 // ====================================================================
28 // pyEZgeom.cc
29 //
30 // [ezgeom]
31 // a site-module of Geant4Py
32 //
33 // An easy way to build geometry
34 //
35 // 2005 Q
36 // ====================================================================
37 #include <boost/python.hpp>
39 #include "G4EzWorld.hh"
40 #include "G4EzVolume.hh"
41 #include "G4RunManager.hh"
42 #include "G4VSensitiveDetector.hh"
43 
44 using namespace boost::python;
45 
46 // ====================================================================
47 // thin wrappers
48 // ====================================================================
49 namespace pyEZgeom {
50 
51 // methods in global namespace
52 void Construct()
53 {
55  runMgr-> SetUserInitialization(new EzDetectorConstruction);
56 }
57 
59 {
60  G4EzWorld::Reset(dx, dy, dz);
61 }
62 
64 {
65  G4EzWorld::Resize(dx, dy, dz);
66 }
67 
68 
69 void SetWorldMaterial(G4Material* amaterial)
70 {
71  G4EzWorld::SetMaterial(amaterial);
72 }
73 
74 
76 {
78 }
79 
80 
81 // CreateTubeVolume
83  CreateTubeVolume, 4, 6)
84 
87 
88 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateSphereVolume,
89  CreateSphereVolume, 3, 7)
90 
91 // PlaceIt
92 G4VPhysicalVolume*(G4EzVolume::*f1_PlaceIt)
93  (const G4ThreeVector&, G4int, G4EzVolume*) = &G4EzVolume::PlaceIt;
94 
96  (const G4Transform3D&, G4int, G4EzVolume*) = &G4EzVolume::PlaceIt;
97 
98 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_PlaceIt, PlaceIt, 1, 3)
99 
100 // ReplicateIt
101 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ReplicateIt, ReplicateIt, 4, 5)
102 
103 // SetColor
105 void (G4EzVolume::*f2_SetColor)(G4double, G4double, G4double)
106  = &G4EzVolume::SetColor;
107 
108 }
109 
110 using namespace pyEZgeom;
111 
112 // ====================================================================
113 // Expose to Python
114 // ====================================================================
115 
117 
118  class_<G4EzVolume>("G4EzVolume", "an easy way of geometry configuration")
119  .def(init<const G4String&>())
120  // ---
121  .def("CreateBoxVolume", &G4EzVolume::CreateBoxVolume)
122  .def("CreateTubeVolume", &G4EzVolume::CreateTubeVolume,
123  f_CreateTubeVolume())
124  .def("CreateConeVolume", &G4EzVolume::CreateConeVolume,
125  f_CreateConeVolume())
126  .def("CreateShpereVolume", &G4EzVolume::CreateSphereVolume,
127  f_CreateSphereVolume())
128  .def("CreateOrbVolume", &G4EzVolume::CreateOrbVolume)
129  // ---
130  .def("SetSold", &G4EzVolume::SetSolid)
131  .def("GetSold", &G4EzVolume::GetSolid,
132  return_value_policy<reference_existing_object>())
133  .def("SetMaterial", &G4EzVolume::SetMaterial)
134  .def("GetMaterial", &G4EzVolume::GetMaterial,
135  return_value_policy<reference_existing_object>())
136  // ---
137  .def("PlaceIt", f1_PlaceIt,
138  f_PlaceIt()[return_value_policy<reference_existing_object>()])
139  .def("PlaceIt", f2_PlaceIt,
140  f_PlaceIt()[return_value_policy<reference_existing_object>()])
141  .def("ReplicateIt", &G4EzVolume::ReplicateIt,
142  f_ReplicateIt()[return_value_policy<reference_existing_object>()])
143  .def("VoxelizeIt", &G4EzVolume::VoxelizeIt)
144  // ---
145  .def("SetSensitiveDetector", &G4EzVolume::SetSensitiveDetector)
146  // ---
147  .def("SetColor", f1_SetColor)
148  .def("SetColor", f2_SetColor)
149  .def("SetVisibility", &G4EzVolume::SetVisibility)
150  ;
151 
152  // -------------------------------------------------------------------
153  def("Construct", Construct);
154  def("ResetWorld", ResetWorld);
155  def("ResizeWorld", ResizeWorld);
156  def("SetWorldMaterial", SetWorldMaterial);
157  def("SetWorldVisibility", SetWorldVisibility);
158 
159 }
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateTubeVolume, CreateTubeVolume, 4, 6) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateConeVolume
void Construct()
Definition: pyExN01geom.cc:48
void(G4EzVolume::* f2_SetColor)(G4double, G4double, G4double)
Definition: pyEzgeom.cc:105
G4ThreeVector VoxelizeIt(G4int nx, G4int ny, G4int nz)
Definition: G4EzVolume.cc:257
void SetSensitiveDetector(G4VSensitiveDetector *asd)
Definition: G4EzVolume.cc:301
static void Resize(G4double dx, G4double dy, G4double dz)
Definition: G4EzWorld.cc:109
static void Reset(G4double dx, G4double dy, G4double dz)
Definition: G4EzWorld.cc:97
CreateConeVolume
Definition: pyEzgeom.cc:86
void SetWorldMaterial(G4Material *amaterial)
Definition: pyEzgeom.cc:69
void CreateTubeVolume(G4Material *amaterial, G4double rmin, G4double rmax, G4double dz, G4double phi0=0., G4double dphi=360 *deg)
Definition: G4EzVolume.cc:101
void CreateConeVolume(G4Material *amaterial, G4double rmin1, G4double rmax1, G4double rmin2, G4double rmax2, G4double dz, G4double phi0=0., G4double dphi=360.*deg)
Definition: G4EzVolume.cc:122
void(G4EzVolume::* f1_SetColor)(const G4Color &)
Definition: pyEzgeom.cc:104
void CreateOrbVolume(G4Material *amaterial, G4double rmax)
Definition: G4EzVolume.cc:168
G4Material * GetMaterial() const
Definition: G4EzVolume.hh:143
void SetSolid(G4VSolid *asolid)
Definition: G4EzVolume.hh:133
void SetVisibility(G4bool qvisible)
Definition: G4EzVolume.hh:151
const G4VSolid * GetSolid() const
Definition: G4EzVolume.hh:135
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
void CreateBoxVolume(G4Material *amaterial, G4double dx, G4double dy, G4double dz)
Definition: G4EzVolume.cc:81
void SetWorldVisibility(G4bool qvis)
Definition: pyEzgeom.cc:75
void CreateSphereVolume(G4Material *amaterial, G4double rmin, G4double rmax, G4double phi0=0., G4double dphi=360.*deg, G4double theta0=0., G4double dtheta=180.*deg)
Definition: G4EzVolume.cc:146
const G4ThreeVector const G4double const
void SetMaterial(G4Material *amaterial)
Definition: G4EzVolume.hh:137
BOOST_PYTHON_MODULE(testem0)
Definition: pytestem0.cc:88
int G4int
Definition: G4Types.hh:78
void ResizeWorld(G4double dx, G4double dy, G4double dz)
Definition: pyEzgeom.cc:63
static void SetVisibility(G4bool qvis)
Definition: G4EzWorld.cc:131
void ResetWorld(G4double dx, G4double dy, G4double dz)
Definition: pyEzgeom.cc:58
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateSphereVolume, CreateSphereVolume, 3, 7) G4VPhysicalVolume *(G4EzVolume G4VPhysicalVolume *(G4EzVolume::* f2_PlaceIt)(const G4Transform3D &, G4int, G4EzVolume *)
Definition: pyEzgeom.cc:96
static void SetMaterial(G4Material *amaterial)
Definition: G4EzWorld.cc:123
G4VPhysicalVolume * ReplicateIt(G4EzVolume *parent, EAxis pAxis, G4int nReplicas, G4double width, G4double offset=0)
Definition: G4EzVolume.cc:237