This commit is contained in:
Jan Kieseler
2023-09-09 02:07:05 +02:00
parent ac07dc1c37
commit d3fa0d60cb
4 changed files with 13 additions and 9 deletions
+7 -3
View File
@@ -53,14 +53,18 @@ class ActionInitialization : public G4VUserActionInitialization
void Build() const override;
void setGeneratorProperties(G4double minEnergy, G4double maxEnergy, G4String partSpecies){
this->minEnergy = minEnergy;
this->maxEnergy = maxEnergy;
this->partSpecies = partSpecies;
if(gen==nullptr){
throw std::runtime_error("PrimaryGeneratorAction not found");
}
gen->setMinPartEnergy(minEnergy);
gen->setMaxPartEnergy(maxEnergy);
gen->setPartSpecies(partSpecies);
G4cout << "ActionInitialization: Setting particle species to " << partSpecies << G4endl;
}
private:
B4::DetectorConstruction* fDetConstruction = nullptr;
mutable B4::PrimaryGeneratorAction * gen = nullptr;
G4double minEnergy=1000;
G4double maxEnergy=1000;
G4String partSpecies="e-";
+3 -3
View File
@@ -90,9 +90,9 @@ public:
private:
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
G4double partEnergy;
G4double minPartEnergy; //MeV
G4double maxPartEnergy;
G4String partSpecies;
G4double minPartEnergy=100; //MeV
G4double maxPartEnergy=100;
G4String partSpecies="e-";
};