31 #include <boost/python.hpp> 32 #include "G4Version.hh" 33 #include "G4ParticleGun.hh" 34 #include "G4ParticleTable.hh" 39 #if G4VERSION_NUMBER < 910 46 G4ParticleGun::G4ParticleGun(
const G4ParticleGun &
right)
53 const G4ParticleGun& G4ParticleGun::operator=(
const G4ParticleGun &
right)
56 NumberOfParticlesToBeGenerated= right.NumberOfParticlesToBeGenerated;
57 particle_definition= right.particle_definition;
58 particle_momentum_direction= right.particle_momentum_direction;
59 particle_energy= right.particle_energy;
60 particle_charge= right.particle_charge;
61 particle_polarization= right.particle_polarization;
88 #if G4VERSION_NUMBER >= 910 90 void (G4ParticleGun::*f1_SetParticleMomentum)(G4double)
91 = &G4ParticleGun::SetParticleMomentum;
92 void (G4ParticleGun::*f2_SetParticleMomentum)(G4ParticleMomentum)
93 = &G4ParticleGun::SetParticleMomentum;
101 G4ParticleTable* particleTable= G4ParticleTable::GetParticleTable();
102 G4ParticleDefinition* pd= particleTable-> FindParticle(pname);
104 gun-> SetParticleDefinition(pd);
106 G4cout <<
"*** \"" << pname <<
"\" is not registered " 107 <<
"in available particle list" << G4endl;
115 const G4ParticleDefinition* pd= gun-> GetParticleDefinition();
116 return (pd-> GetParticleName()).c_str();
128 #if G4VERSION_NUMBER < 910 129 class_<G4ParticleGun>
131 class_<G4ParticleGun, boost::noncopyable>
133 (
"G4ParticleGun",
"particle gun")
136 .def(init<G4ParticleDefinition*>())
137 .def(init<G4ParticleDefinition*, G4int>())
139 .def(
"GeneratePrimaryVertex", &G4ParticleGun::GeneratePrimaryVertex)
140 .def(
"SetParticleDefinition", &G4ParticleGun::SetParticleDefinition)
141 .def(
"GetParticleDefinition", &G4ParticleGun::GetParticleDefinition,
142 return_value_policy<reference_existing_object>())
143 #if G4VERSION_NUMBER >= 910 144 .def(
"SetParticleMomentum", f1_SetParticleMomentum)
145 .def(
"SetParticleMomentum", f2_SetParticleMomentum)
147 .def(
"SetParticleMomentum", &G4ParticleGun::SetParticleMomentum)
149 .def(
"SetParticleMomentumDirection",
150 &G4ParticleGun::SetParticleMomentumDirection)
151 .def(
"GetParticleMomentumDirection",
152 &G4ParticleGun::GetParticleMomentumDirection)
153 .def(
"SetParticleEnergy", &G4ParticleGun::SetParticleEnergy)
154 .def(
"GetParticleEnergy", &G4ParticleGun::GetParticleEnergy)
155 .def(
"SetParticleCharge", &G4ParticleGun::SetParticleCharge)
156 .def(
"GetParticleCharge", &G4ParticleGun::GetParticleCharge)
157 .def(
"SetParticlePolarization", &G4ParticleGun::SetParticlePolarization)
158 .def(
"GetParticlePolarization", &G4ParticleGun::GetParticlePolarization)
159 .def(
"SetNumberOfParticles", &G4ParticleGun::SetNumberOfParticles)
160 .def(
"GetNumberOfParticles", &G4ParticleGun::GetNumberOfParticles)
161 .def(
"SetParticlePosition", &G4ParticleGun::SetParticlePosition)
162 .def(
"GetParticlePosition", &G4ParticleGun::GetParticlePosition)
163 .def(
"SetParticleTime", &G4ParticleGun::SetParticleTime)
164 .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!=(infinite_endcount_iterator< T > const &, count_iterator< T > const &)
Never admit a infinite_endcount_iterator to be equal to anything else.
bool operator==(infinite_endcount_iterator< T > const &, count_iterator< T > const &)
std::string GetParticleByName(G4ParticleGun *gun)