additions
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
|
||||
from bindings import ConstructionWrapper, SystemBuilder
|
||||
|
||||
cw = ConstructionWrapper()
|
||||
cw.addLayer(10,"G4_Si",True)
|
||||
cw.addLayer(1,"G4_Pb",False)
|
||||
cw.addLayer(10,"G4_Si",False)
|
||||
|
||||
sb = SystemBuilder()
|
||||
sb.init(cw)
|
||||
sb.run_batch(100, "e-", 1000, 5000)
|
||||
@@ -83,6 +83,11 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
|
||||
auto particleDefinition
|
||||
= G4ParticleTable::GetParticleTable()->FindParticle(partSpecies);
|
||||
if(particleDefinition == nullptr){
|
||||
G4cout << "Particle " << partSpecies << " not found" << G4endl;
|
||||
throw std::runtime_error("Particle not found");
|
||||
return;
|
||||
}
|
||||
fParticleGun->SetParticleDefinition(particleDefinition);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
fParticleGun->SetParticleEnergy(partEnergy*MeV);
|
||||
|
||||
@@ -60,7 +60,7 @@ void SystemBuilder::run_gui(){
|
||||
}
|
||||
|
||||
void SystemBuilder::run_batch(int nEvents, std::string partSpecies, double minEnergy, double maxEnergy){
|
||||
actionInitialization->setGeneratorProperties(minEnergy, maxEnergy, partSpecies);
|
||||
actionInitialization->setGeneratorProperties(minEnergy, maxEnergy, (G4String)partSpecies);
|
||||
UImanager->ApplyCommand("/run/initialize");
|
||||
runManager->BeamOn(nEvents);
|
||||
}
|
||||
Reference in New Issue
Block a user