LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
pyG4ParticleGun Namespace Reference

Functions

void SetParticleByName (G4ParticleGun *gun, const std::string &pname)
 
std::string GetParticleByName (G4ParticleGun *gun)
 

Function Documentation

std::string pyG4ParticleGun::GetParticleByName ( G4ParticleGun *  gun)

Definition at line 112 of file pyG4ParticleGun.cc.

Referenced by export_G4ParticleGun().

114 {
115  const G4ParticleDefinition* pd= gun-> GetParticleDefinition();
116  return (pd-> GetParticleName()).c_str();
117 }
void pyG4ParticleGun::SetParticleByName ( G4ParticleGun *  gun,
const std::string &  pname 
)

Definition at line 98 of file pyG4ParticleGun.cc.

Referenced by export_G4ParticleGun().

100 {
101  G4ParticleTable* particleTable= G4ParticleTable::GetParticleTable();
102  G4ParticleDefinition* pd= particleTable-> FindParticle(pname);
103  if (pd != 0) {
104  gun-> SetParticleDefinition(pd);
105  } else {
106  G4cout << "*** \"" << pname << "\" is not registered "
107  << "in available particle list" << G4endl;
108  }
109 }