Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
pyG4EmCalculator.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: pyG4EmCalculator.cc 76884 2013-11-18 12:54:03Z gcosmo $
27 // ====================================================================
28 // pyG4EmCalculator.cc
29 //
30 // 2006 Q
31 // ====================================================================
32 #include <boost/python.hpp>
33 #include "G4Version.hh"
34 #include "G4EmCalculator.hh"
35 #include "G4Region.hh"
36 #include "G4Material.hh"
37 #include "G4Element.hh"
38 #include "G4ParticleDefinition.hh"
39 #include "G4MaterialCutsCouple.hh"
40 
41 using namespace boost::python;
42 
43 // ====================================================================
44 // thin wrappers
45 // ====================================================================
46 namespace pyG4EmCalculator {
47 
48 // GetDEDX
49 G4double (G4EmCalculator::*f1_GetDEDX)
52 
53 G4double (G4EmCalculator::*f2_GetDEDX)
54  (G4double, const G4String&, const G4String&, const G4String&)
56 
57 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetDEDX, GetDEDX, 3, 4)
58 
59 // GetRange
60 G4double (G4EmCalculator::*f1_GetRange)
62  = &G4EmCalculator::GetRange;
63 
64 G4double (G4EmCalculator::*f2_GetRange)
65  (G4double, const G4String&, const G4String&, const G4String&)
66  = &G4EmCalculator::GetRange;
67 
68 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetRange, GetRange, 3, 4)
69 
70 // GetKinEnergy
71 G4double (G4EmCalculator::*f1_GetKinEnergy)
72  (G4double, const G4ParticleDefinition*, const G4Material*, const G4Region*)
73  = &G4EmCalculator::GetKinEnergy;
74 
75 G4double (G4EmCalculator::*f2_GetKinEnergy)
76  (G4double, const G4String&, const G4String&, const G4String&)
77  = &G4EmCalculator::GetKinEnergy;
78 
79 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetKinEnergy, GetKinEnergy, 3, 4)
80 
81 // GetCrossSectionPerVolume
82 G4double (G4EmCalculator::*f1_GetCrossSectionPerVolume)
83  (G4double, const G4ParticleDefinition*,
84  const G4String&, const G4Material*, const G4Region*)
85  = &G4EmCalculator::GetCrossSectionPerVolume;
86 
87 G4double (G4EmCalculator::*f2_GetCrossSectionPerVolume)
88  (G4double, const G4String&, const G4String&,
89  const G4String&, const G4String&)
90  = &G4EmCalculator::GetCrossSectionPerVolume;
91 
92 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetCrossSectionPerVolume,
93  GetCrossSectionPerVolume, 4, 5)
94 
95 // GetMeanFreePath
96 G4double (G4EmCalculator::*f1_GetMeanFreePath)
97  (G4double, const G4ParticleDefinition*,
98  const G4String&, const G4Material*, const G4Region*)
99  = &G4EmCalculator::GetMeanFreePath;
100 
101 G4double (G4EmCalculator::*f2_GetMeanFreePath)
102  (G4double, const G4String&, const G4String&,
103  const G4String&, const G4String&)
104  = &G4EmCalculator::GetMeanFreePath;
105 
107  GetMeanFreePath, 4, 5)
108 
109 // ComputeDEDX
110 G4double (G4EmCalculator::*f1_ComputeDEDX)
111  (G4double, const G4ParticleDefinition*,
112  const G4String&, const G4Material*, G4double)
113  = &G4EmCalculator::ComputeDEDX;
114 
115 G4double (G4EmCalculator::*f2_ComputeDEDX)
116  (G4double, const G4String&, const G4String&, const G4String&, G4double)
117  = &G4EmCalculator::ComputeDEDX;
118 
119 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeDEDX, ComputeDEDX, 4, 5)
120 
121 // ComputeNuclearDEDX
122 G4double (G4EmCalculator::*f1_ComputeNuclearDEDX)
123  (G4double, const G4ParticleDefinition*, const G4Material*)
124  = &G4EmCalculator::ComputeNuclearDEDX;
125 
126 G4double (G4EmCalculator::*f2_ComputeNuclearDEDX)
127  (G4double, const G4String&, const G4String&)
128  = &G4EmCalculator::ComputeNuclearDEDX;
129 
130 // ComputeElectronicDEDX
131 G4double (G4EmCalculator::*f1_ComputeElectronicDEDX)
132  (G4double, const G4ParticleDefinition*, const G4Material*, G4double)
133  = &G4EmCalculator::ComputeElectronicDEDX;
134 
135 G4double (G4EmCalculator::*f2_ComputeElectronicDEDX)
136  (G4double, const G4String&, const G4String&, G4double)
137  = &G4EmCalculator::ComputeElectronicDEDX;
138 
139 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeElectronicDEDX,
140  ComputeElectronicDEDX, 3, 4)
141 
142 // ComputeTotalDEDX
143 G4double (G4EmCalculator::*f1_ComputeTotalDEDX)
144  (G4double, const G4ParticleDefinition*, const G4Material*, G4double)
145  = &G4EmCalculator::ComputeTotalDEDX;
146 
147 G4double (G4EmCalculator::*f2_ComputeTotalDEDX)
148  (G4double, const G4String&, const G4String&, G4double)
149  = &G4EmCalculator::ComputeTotalDEDX;
150 
151 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeTotalDEDX, ComputeTotalDEDX,
152  3, 4)
153 // ComputeCrossSectionPerVolume
154 G4double (G4EmCalculator::*f1_ComputeCrossSectionPerVolume)
155  (G4double, const G4ParticleDefinition*,
156  const G4String&, const G4Material*, G4double)
157  = &G4EmCalculator::ComputeCrossSectionPerVolume;
158 
159 G4double (G4EmCalculator::*f2_ComputeCrossSectionPerVolume)
160  (G4double, const G4String&, const G4String&, const G4String&, G4double)
161  = &G4EmCalculator::ComputeCrossSectionPerVolume;
162 
163 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeCrossSectionPerVolume,
164  ComputeCrossSectionPerVolume, 4, 5)
165 
166 // ComputeCrossSectionPerAtom
167 G4double (G4EmCalculator::*f1_ComputeCrossSectionPerAtom)
168  (G4double, const G4ParticleDefinition*, const G4String&,
169  G4double, G4double, G4double)
171 
172 G4double (G4EmCalculator::*f2_ComputeCrossSectionPerAtom)
173  (G4double, const G4String&, const G4String&, const G4Element*, G4double)
174  = &G4EmCalculator::ComputeCrossSectionPerAtom;
175 
176 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeCrossSectionPerAtom,
177  ComputeCrossSectionPerAtom, 5, 6)
178 
179 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(g_ComputeCrossSectionPerAtom,
180  ComputeCrossSectionPerAtom, 4, 5)
181 
182 // ComputeEnergyCutFromRangeCut
183 G4double (G4EmCalculator::*f1_ComputeEnergyCutFromRangeCut)
184  (G4double, const G4ParticleDefinition*, const G4Material*)
185  = &G4EmCalculator::ComputeEnergyCutFromRangeCut;
186 
187 G4double (G4EmCalculator::*f2_ComputeEnergyCutFromRangeCut)
188  (G4double range, const G4String&, const G4String&)
189  = &G4EmCalculator::ComputeEnergyCutFromRangeCut;
190 
191 // ComputeMeanFreePath
192 G4double (G4EmCalculator::*f1_ComputeMeanFreePath)
193  (G4double, const G4ParticleDefinition*,
194  const G4String&, const G4Material*, G4double)
195  = &G4EmCalculator::ComputeMeanFreePath;
196 
197 G4double (G4EmCalculator::*f2_ComputeMeanFreePath)
198  (G4double, const G4String&, const G4String&, const G4String&, G4double)
199  = &G4EmCalculator::ComputeMeanFreePath;
200 
201 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeMeanFreePath,
202  ComputeMeanFreePath, 4, 5)
203 
204 // FindCouple
205 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_FindCouple, FindCouple, 1, 2)
206 
207 }
208 
209 using namespace pyG4EmCalculator;
210 
211 // ====================================================================
212 // module definition
213 // ====================================================================
215 {
216  class_<G4EmCalculator, boost::noncopyable>
217  ("G4EmCalculator", "Provide access to dE/dx and cross section")
218  // ---
219  .def("GetDEDX", f1_GetDEDX, f_GetDEDX())
220  .def("GetDEDX", f2_GetDEDX, f_GetDEDX())
221  .def("GetRange", f1_GetRange, f_GetRange())
222  .def("GetRange", f2_GetDEDX, f_GetRange())
223  .def("GetKinEnergy", f1_GetKinEnergy, f_GetKinEnergy())
224  .def("GetKinEnergy", f2_GetKinEnergy, f_GetKinEnergy())
225  .def("GetCrossSectionPerVolume",
226  f1_GetCrossSectionPerVolume, f_GetCrossSectionPerVolume())
227  .def("GetCrossSectionPerVolume",
228  f2_GetCrossSectionPerVolume, f_GetCrossSectionPerVolume())
229  .def("GetMeanFreePath", f1_GetMeanFreePath, f_GetMeanFreePath())
230  .def("GetMeanFreePath", f2_GetMeanFreePath, f_GetMeanFreePath())
231  // ---
232  .def("PrintDEDXTable", &G4EmCalculator::PrintDEDXTable)
233  .def("PrintRangeTable", &G4EmCalculator::PrintRangeTable)
234  .def("PrintInverseRangeTable", &G4EmCalculator::PrintInverseRangeTable)
235  // ---
236  .def("ComputeDEDX", f1_ComputeDEDX, f_ComputeDEDX())
237  .def("ComputeDEDX", f2_ComputeDEDX, f_ComputeDEDX())
238  .def("ComputeNuclearDEDX", f1_ComputeNuclearDEDX)
239  .def("ComputeNuclearDEDX", f2_ComputeNuclearDEDX)
240  .def("ComputeElectronicDEDX", f1_ComputeElectronicDEDX,
241  f_ComputeElectronicDEDX())
242  .def("ComputeDEDX", f2_ComputeElectronicDEDX,
243  f_ComputeElectronicDEDX())
244  .def("ComputeTotalDEDX", f1_ComputeTotalDEDX, f_ComputeTotalDEDX())
245  .def("ComputeTotalDEDX", f2_ComputeTotalDEDX, f_ComputeTotalDEDX())
246  // ---
247  .def("ComputeCrossSectionPerVolume",
248  f1_ComputeCrossSectionPerVolume, f_ComputeCrossSectionPerVolume())
249  .def("ComputeCrossSectionPerVolume",
250  f2_ComputeCrossSectionPerVolume, f_ComputeCrossSectionPerVolume())
251  .def("ComputeCrossSectionPerAtom",
252  f1_ComputeCrossSectionPerAtom, f_ComputeCrossSectionPerAtom())
253  .def("ComputeCrossSectionPerAtom",
254  f2_ComputeCrossSectionPerAtom, g_ComputeCrossSectionPerAtom())
255  .def("ComputeEnergyCutFromRangeCut", f1_ComputeEnergyCutFromRangeCut)
256  .def("ComputeEnergyCutFromRangeCut", f2_ComputeEnergyCutFromRangeCut)
257  // ---
258  .def("ComputeMeanFreePath",
259  f1_ComputeMeanFreePath, f_ComputeMeanFreePath())
260  .def("ComputeMeanFreePath",
261  f2_ComputeMeanFreePath, f_ComputeMeanFreePath())
262  // ---
263  .def("FindParticle", &G4EmCalculator::FindParticle,
264  return_value_policy<reference_existing_object>())
265  .def("FindMaterial", &G4EmCalculator::FindMaterial,
266  return_value_policy<reference_existing_object>())
267  .def("FindRegion", &G4EmCalculator::FindRegion,
268  return_value_policy<reference_existing_object>())
269  .def("FindCouple", &G4EmCalculator::FindCouple,
270  f_FindCouple()[return_value_policy<reference_existing_object>()])
271  // ---
272  .def("SetVerbose", &G4EmCalculator::SetVerbose)
273  ;
274 }
void PrintInverseRangeTable(const G4ParticleDefinition *)
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateTubeVolume, CreateTubeVolume, 4, 6) BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateConeVolume
const G4Region * FindRegion(const G4String &)
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
const G4Material * FindMaterial(const G4String &)
double G4double
Definition: G4Types.hh:76
const G4ParticleDefinition const G4Material *G4double range
void PrintDEDXTable(const G4ParticleDefinition *)
const G4ParticleDefinition * FindParticle(const G4String &)
const G4ThreeVector const G4double const
void PrintRangeTable(const G4ParticleDefinition *)
const G4MaterialCutsCouple * FindCouple(const G4Material *, const G4Region *r=nullptr)
void export_G4EmCalculator()
void SetVerbose(G4int val)