32 #include <boost/python.hpp> 33 #include "G4Version.hh" 34 #include "G4ParticleGun.hh" 35 #include "G4ParticleTable.hh" 40 #if G4VERSION_NUMBER < 910 47 G4ParticleGun::G4ParticleGun(
const G4ParticleGun &
right)
54 const G4ParticleGun& G4ParticleGun::operator=(
const G4ParticleGun &
right)
57 NumberOfParticlesToBeGenerated= right.NumberOfParticlesToBeGenerated;
58 particle_definition= right.particle_definition;
59 particle_momentum_direction= right.particle_momentum_direction;
60 particle_energy= right.particle_energy;
61 particle_charge= right.particle_charge;
62 particle_polarization= right.particle_polarization;
89 #if G4VERSION_NUMBER >= 910 91 void (G4ParticleGun::*f1_SetParticleMomentum)(G4double)
92 = &G4ParticleGun::SetParticleMomentum;
93 void (G4ParticleGun::*f2_SetParticleMomentum)(G4ParticleMomentum)
94 = &G4ParticleGun::SetParticleMomentum;
102 G4ParticleTable* particleTable= G4ParticleTable::GetParticleTable();
103 G4ParticleDefinition* pd= particleTable-> FindParticle(pname);
105 gun-> SetParticleDefinition(pd);
107 G4cout <<
"*** \"" << pname <<
"\" is not registered " 108 <<
"in available particle list" << G4endl;
116 const G4ParticleDefinition* pd= gun-> GetParticleDefinition();
117 return (pd-> GetParticleName()).c_str();
129 #if G4VERSION_NUMBER < 910 130 class_<G4ParticleGun>
132 class_<G4ParticleGun, boost::noncopyable>
134 (
"G4ParticleGun",
"particle gun")
137 .def(init<G4ParticleDefinition*>())
138 .def(init<G4ParticleDefinition*, G4int>())
140 .def(
"GeneratePrimaryVertex", &G4ParticleGun::GeneratePrimaryVertex)
141 .def(
"SetParticleDefinition", &G4ParticleGun::SetParticleDefinition)
142 .def(
"GetParticleDefinition", &G4ParticleGun::GetParticleDefinition,
143 return_value_policy<reference_existing_object>())
144 #if G4VERSION_NUMBER >= 910 145 .def(
"SetParticleMomentum", f1_SetParticleMomentum)
146 .def(
"SetParticleMomentum", f2_SetParticleMomentum)
148 .def(
"SetParticleMomentum", &G4ParticleGun::SetParticleMomentum)
150 .def(
"SetParticleMomentumDirection",
151 &G4ParticleGun::SetParticleMomentumDirection)
152 .def(
"GetParticleMomentumDirection",
153 &G4ParticleGun::GetParticleMomentumDirection)
154 .def(
"SetParticleEnergy", &G4ParticleGun::SetParticleEnergy)
155 .def(
"GetParticleEnergy", &G4ParticleGun::GetParticleEnergy)
156 .def(
"SetParticleCharge", &G4ParticleGun::SetParticleCharge)
157 .def(
"GetParticleCharge", &G4ParticleGun::GetParticleCharge)
158 .def(
"SetParticlePolarization", &G4ParticleGun::SetParticlePolarization)
159 .def(
"GetParticlePolarization", &G4ParticleGun::GetParticlePolarization)
160 .def(
"SetNumberOfParticles", &G4ParticleGun::SetNumberOfParticles)
161 .def(
"GetNumberOfParticles", &G4ParticleGun::GetNumberOfParticles)
162 .def(
"SetParticlePosition", &G4ParticleGun::SetParticlePosition)
163 .def(
"GetParticlePosition", &G4ParticleGun::GetParticlePosition)
164 .def(
"SetParticleTime", &G4ParticleGun::SetParticleTime)
165 .def(
"GetParticleTime", &G4ParticleGun::GetParticleTime)
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
void export_G4ParticleGun()
void SetParticleByName(G4ParticleGun *gun, const std::string &pname)
bool operator!=(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to different IDs.
bool operator==(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to the same ID.
std::string GetParticleByName(G4ParticleGun *gun)