ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyG4EmCalculator.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 // ====================================================================
27 // pyG4EmCalculator.cc
28 //
29 // 2006 Q
30 // ====================================================================
31 #include <boost/python.hpp>
32 #include "G4Version.hh"
33 #include "G4EmCalculator.hh"
34 #include "G4Region.hh"
35 #include "G4Material.hh"
36 #include "G4Element.hh"
37 #include "G4ParticleDefinition.hh"
38 #include "G4MaterialCutsCouple.hh"
39 
40 using namespace boost::python;
41 
42 // ====================================================================
43 // thin wrappers
44 // ====================================================================
45 namespace pyG4EmCalculator {
46 
47 // GetDEDX
51 
53  (G4double, const G4String&, const G4String&, const G4String&)
55 
56 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetDEDX, GetDEDX, 3, 4)
57 
58 // GetRange
61  = &G4EmCalculator::GetRange;
62 
64  (G4double, const G4String&, const G4String&, const G4String&)
65  = &G4EmCalculator::GetRange;
66 
67 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetRange, GetRange, 3, 4)
68 
69 // GetKinEnergy
72  = &G4EmCalculator::GetKinEnergy;
73 
75  (G4double, const G4String&, const G4String&, const G4String&)
76  = &G4EmCalculator::GetKinEnergy;
77 
78 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetKinEnergy, GetKinEnergy, 3, 4)
79 
80 // GetCrossSectionPerVolume
83  const G4String&, const G4Material*, const G4Region*)
84  = &G4EmCalculator::GetCrossSectionPerVolume;
85 
87  (G4double, const G4String&, const G4String&,
88  const G4String&, const G4String&)
89  = &G4EmCalculator::GetCrossSectionPerVolume;
90 
91 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetCrossSectionPerVolume,
92  GetCrossSectionPerVolume, 4, 5)
93 
94 // GetMeanFreePath
95 G4double (G4EmCalculator::*f1_GetMeanFreePath)
97  const G4String&, const G4Material*, const G4Region*)
98  = &G4EmCalculator::GetMeanFreePath;
99 
101  (G4double, const G4String&, const G4String&,
102  const G4String&, const G4String&)
103  = &G4EmCalculator::GetMeanFreePath;
104 
106  GetMeanFreePath, 4, 5)
107 
108 // ComputeDEDX
109 G4double (G4EmCalculator::*f1_ComputeDEDX)
110  (G4double, const G4ParticleDefinition*,
111  const G4String&, const G4Material*, G4double)
112  = &G4EmCalculator::ComputeDEDX;
113 
114 G4double (G4EmCalculator::*f2_ComputeDEDX)
115  (G4double, const G4String&, const G4String&, const G4String&, G4double)
116  = &G4EmCalculator::ComputeDEDX;
117 
118 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeDEDX, ComputeDEDX, 4, 5)
119 
120 // ComputeNuclearDEDX
122  (G4double, const G4ParticleDefinition*, const G4Material*)
123  = &G4EmCalculator::ComputeNuclearDEDX;
124 
126  (G4double, const G4String&, const G4String&)
127  = &G4EmCalculator::ComputeNuclearDEDX;
128 
129 // ComputeElectronicDEDX
131  (G4double, const G4ParticleDefinition*, const G4Material*, G4double)
132  = &G4EmCalculator::ComputeElectronicDEDX;
133 
135  (G4double, const G4String&, const G4String&, G4double)
136  = &G4EmCalculator::ComputeElectronicDEDX;
137 
138 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeElectronicDEDX,
139  ComputeElectronicDEDX, 3, 4)
140 
141 // ComputeTotalDEDX
142 G4double (G4EmCalculator::*f1_ComputeTotalDEDX)
143  (G4double, const G4ParticleDefinition*, const G4Material*, G4double)
144  = &G4EmCalculator::ComputeTotalDEDX;
145 
147  (G4double, const G4String&, const G4String&, G4double)
148  = &G4EmCalculator::ComputeTotalDEDX;
149 
150 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeTotalDEDX, ComputeTotalDEDX,
151  3, 4)
152 // ComputeCrossSectionPerVolume
153 G4double (G4EmCalculator::*f1_ComputeCrossSectionPerVolume)
154  (G4double, const G4ParticleDefinition*,
155  const G4String&, const G4Material*, G4double)
156  = &G4EmCalculator::ComputeCrossSectionPerVolume;
157 
159  (G4double, const G4String&, const G4String&, const G4String&, G4double)
160  = &G4EmCalculator::ComputeCrossSectionPerVolume;
161 
162 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeCrossSectionPerVolume,
163  ComputeCrossSectionPerVolume, 4, 5)
164 
165 // ComputeCrossSectionPerAtom
166 G4double (G4EmCalculator::*f1_ComputeCrossSectionPerAtom)
167  (G4double, const G4ParticleDefinition*, const G4String&,
168  G4double, G4double, G4double)
170 
172  (G4double, const G4String&, const G4String&, const G4Element*, G4double)
173  = &G4EmCalculator::ComputeCrossSectionPerAtom;
174 
175 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeCrossSectionPerAtom,
176  ComputeCrossSectionPerAtom, 5, 6)
177 
178 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(g_ComputeCrossSectionPerAtom,
179  ComputeCrossSectionPerAtom, 4, 5)
180 
181 // ComputeEnergyCutFromRangeCut
183  (G4double, const G4ParticleDefinition*, const G4Material*)
184  = &G4EmCalculator::ComputeEnergyCutFromRangeCut;
185 
187  (G4double range, const G4String&, const G4String&)
188  = &G4EmCalculator::ComputeEnergyCutFromRangeCut;
189 
190 // ComputeMeanFreePath
192  (G4double, const G4ParticleDefinition*,
193  const G4String&, const G4Material*, G4double)
194  = &G4EmCalculator::ComputeMeanFreePath;
195 
197  (G4double, const G4String&, const G4String&, const G4String&, G4double)
198  = &G4EmCalculator::ComputeMeanFreePath;
199 
200 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ComputeMeanFreePath,
201  ComputeMeanFreePath, 4, 5)
202 
203 // FindCouple
204 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_FindCouple, FindCouple, 1, 2)
205 
206 }
207 
208 using namespace pyG4EmCalculator;
209 
210 // ====================================================================
211 // module definition
212 // ====================================================================
214 {
215  class_<G4EmCalculator, boost::noncopyable>
216  ("G4EmCalculator", "Provide access to dE/dx and cross section")
217  // ---
218  .def("GetDEDX", f1_GetDEDX, f_GetDEDX())
219  .def("GetDEDX", f2_GetDEDX, f_GetDEDX())
220  .def("GetRange", f1_GetRange, f_GetRange())
221  .def("GetRange", f2_GetDEDX, f_GetRange())
222  .def("GetKinEnergy", f1_GetKinEnergy, f_GetKinEnergy())
223  .def("GetKinEnergy", f2_GetKinEnergy, f_GetKinEnergy())
224  .def("GetCrossSectionPerVolume",
225  f1_GetCrossSectionPerVolume, f_GetCrossSectionPerVolume())
226  .def("GetCrossSectionPerVolume",
227  f2_GetCrossSectionPerVolume, f_GetCrossSectionPerVolume())
228  .def("GetMeanFreePath", f1_GetMeanFreePath, f_GetMeanFreePath())
229  .def("GetMeanFreePath", f2_GetMeanFreePath, f_GetMeanFreePath())
230  // ---
231  .def("PrintDEDXTable", &G4EmCalculator::PrintDEDXTable)
232  .def("PrintRangeTable", &G4EmCalculator::PrintRangeTable)
233  .def("PrintInverseRangeTable", &G4EmCalculator::PrintInverseRangeTable)
234  // ---
235  .def("ComputeDEDX", f1_ComputeDEDX, f_ComputeDEDX())
236  .def("ComputeDEDX", f2_ComputeDEDX, f_ComputeDEDX())
237  .def("ComputeNuclearDEDX", f1_ComputeNuclearDEDX)
238  .def("ComputeNuclearDEDX", f2_ComputeNuclearDEDX)
239  .def("ComputeElectronicDEDX", f1_ComputeElectronicDEDX,
240  f_ComputeElectronicDEDX())
241  .def("ComputeDEDX", f2_ComputeElectronicDEDX,
242  f_ComputeElectronicDEDX())
243  .def("ComputeTotalDEDX", f1_ComputeTotalDEDX, f_ComputeTotalDEDX())
244  .def("ComputeTotalDEDX", f2_ComputeTotalDEDX, f_ComputeTotalDEDX())
245  // ---
246  .def("ComputeCrossSectionPerVolume",
247  f1_ComputeCrossSectionPerVolume, f_ComputeCrossSectionPerVolume())
248  .def("ComputeCrossSectionPerVolume",
249  f2_ComputeCrossSectionPerVolume, f_ComputeCrossSectionPerVolume())
250  .def("ComputeCrossSectionPerAtom",
251  f1_ComputeCrossSectionPerAtom, f_ComputeCrossSectionPerAtom())
252  .def("ComputeCrossSectionPerAtom",
253  f2_ComputeCrossSectionPerAtom, g_ComputeCrossSectionPerAtom())
254  .def("ComputeEnergyCutFromRangeCut", f1_ComputeEnergyCutFromRangeCut)
255  .def("ComputeEnergyCutFromRangeCut", f2_ComputeEnergyCutFromRangeCut)
256  // ---
257  .def("ComputeMeanFreePath",
258  f1_ComputeMeanFreePath, f_ComputeMeanFreePath())
259  .def("ComputeMeanFreePath",
260  f2_ComputeMeanFreePath, f_ComputeMeanFreePath())
261  // ---
262  .def("FindParticle", &G4EmCalculator::FindParticle,
263  return_value_policy<reference_existing_object>())
264  .def("FindMaterial", &G4EmCalculator::FindMaterial,
265  return_value_policy<reference_existing_object>())
266  .def("FindRegion", &G4EmCalculator::FindRegion,
267  return_value_policy<reference_existing_object>())
268  .def("FindCouple", &G4EmCalculator::FindCouple,
269  f_FindCouple()[return_value_policy<reference_existing_object>()])
270  // ---
271  .def("SetVerbose", &G4EmCalculator::SetVerbose)
272  ;
273 }