ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyG4NistManager.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyG4NistManager.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 // pyG4NistManager.cc
28 //
29 // 2005 Q
30 // ===================================================================
31 #include <boost/python.hpp>
32 #include "G4Version.hh"
33 #if G4VERSION_NUMBER >= 710
34 #include "G4NistManager.hh"
35 
36 using namespace boost::python;
37 
38 // ====================================================================
39 // thin wrappers
40 // ====================================================================
41 namespace pyG4NistManager {
42 
43 // FindOrBuildElement
44 G4Element*(G4NistManager::*f1_FindOrBuildElement)(G4int, G4bool)
46 
47 G4Element*(G4NistManager::*f2_FindOrBuildElement)(const G4String&, G4bool)
49 
50 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_FindOrBuildElement,
51  FindOrBuildElement, 1, 2)
52 
53 // PrintElement
54 void(G4NistManager::*f1_PrintElement)(const G4String&) const
55  = &G4NistManager::PrintElement;
56 void(G4NistManager::*f2_PrintElement)(G4int) const
57  = &G4NistManager::PrintElement;
58 
59 // FindOrBuildMaterial
60 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_FindOrBuildMaterial,
61  FindOrBuildMaterial, 1, 2)
62 
63 // ConstructNewMaterial
64 G4Material*(G4NistManager::*f1_ConstructNewMaterial)
65  (const G4String&, const std::vector<G4String>&,
66  const std::vector<G4int>&, G4double, G4bool,
67  G4State, G4double, G4double)
68  = &G4NistManager::ConstructNewMaterial;
69 
70 G4Material*(G4NistManager::*f2_ConstructNewMaterial)
71  (const G4String&, const std::vector<G4String>&,
72  const std::vector<G4double>&, G4double, G4bool,
73  G4State, G4double, G4double)
74  = &G4NistManager::ConstructNewMaterial;
75 
76 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ConstructNewMaterial,
77  ConstructNewMaterial, 4, 8)
78 
79 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ConstructNewGasMaterial,
80  ConstructNewGasMaterial, 4, 5)
81 
82 }
83 
84 using namespace pyG4NistManager;
85 
86 #endif
87 
88 // ====================================================================
89 // module definition
90 // ====================================================================
92 {
93 #if G4VERSION_NUMBER >= 710
94 
95  class_<G4NistManager, boost::noncopyable>
96  ("G4NistManager", "manager class for NIST materials", no_init)
97  // ---
98  .def("Instance", &G4NistManager::Instance,
99  return_value_policy<reference_existing_object>())
100  .staticmethod("Instance")
101  // ---
102  .def("SetVerbose", &G4NistManager::SetVerbose)
103  .def("GetVerbose", &G4NistManager::GetVerbose)
104  // ---
105 #if G4VERSION_NUMBER < 910
106  .def("RegisterElement", &G4NistManager::RegisterElement)
107  .def("DeRegisterElement", &G4NistManager::DeRegisterElement)
108 #endif
109  .def("GetElement", &G4NistManager::GetElement,
110  return_internal_reference<>())
111  .def("FindOrBuildElement", f1_FindOrBuildElement,
112  f_FindOrBuildElement()
113  [return_value_policy<reference_existing_object>()])
114  .def("FindOrBuildElement", f2_FindOrBuildElement,
115  f_FindOrBuildElement()
116  [return_value_policy<reference_existing_object>()])
117  .def("GetNumberOfElements", &G4NistManager::GetNumberOfElements)
118  .def("GetZ", &G4NistManager::GetZ)
119  .def("GetIsotopeMass", &G4NistManager::GetIsotopeMass)
120  .def("PrintElement", f1_PrintElement)
121  .def("PrintElement", f2_PrintElement)
122  .def("PrintG4Element", &G4NistManager::PrintG4Element)
123  // ---
124 #if G4VERSION_NUMBER < 910
125  .def("RegisterMaterial", &G4NistManager::RegisterMaterial)
126  .def("DeRegisterMaterial", &G4NistManager::DeRegisterMaterial)
127 #endif
128  .def("GetMaterial", &G4NistManager::GetMaterial,
129  return_value_policy<reference_existing_object>())
130  .def("FindOrBuildMaterial", &G4NistManager::FindOrBuildMaterial,
131  f_FindOrBuildMaterial()
132  [return_value_policy<reference_existing_object>()])
133  .def("ConstructNewMaterial", f1_ConstructNewMaterial,
134  f_ConstructNewMaterial()
135  [return_value_policy<reference_existing_object>()])
136  .def("ConstructNewMaterial", f2_ConstructNewMaterial,
137  f_ConstructNewMaterial()
138  [return_value_policy<reference_existing_object>()])
139 #if G4VERSION_NUMBER >= 910
140  .def("ConstructNewGasMaterial", &G4NistManager::ConstructNewGasMaterial,
141  f_ConstructNewGasMaterial()
142  [return_value_policy<reference_existing_object>()])
143 #endif
144  .def("GetNumberOfMaterials", &G4NistManager::GetNumberOfMaterials)
145  .def("ListMaterials", &G4NistManager::ListMaterials)
146  .def("PrintG4Material", &G4NistManager::PrintG4Material)
147  ;
148 #endif
149 }