This commit is contained in:
Jan Kieseler
2023-09-09 01:32:53 +02:00
parent a03b3d780a
commit 1602992cee
2 changed files with 29 additions and 1 deletions
+1
View File
@@ -56,6 +56,7 @@ class ActionInitialization : public G4VUserActionInitialization
this->minEnergy = minEnergy;
this->maxEnergy = maxEnergy;
this->partSpecies = partSpecies;
}
private:
+28 -1
View File
@@ -59,7 +59,34 @@ public:
G4double getPartEnergy() const{return partEnergy;}
void setMinPartEnergy(G4double value){minPartEnergy = value;}
void setMaxPartEnergy(G4double value){maxPartEnergy = value;}
void setPartSpecies(G4String value){partSpecies = value;}
void setPartSpecies(G4String value){
partSpecies = value;
if(partSpecies == "e-"){
G4cout << "Particle species set to electron" << G4endl;
}
if(partSpecies == "e+"){
G4cout << "Particle species set to positron" << G4endl;
}
else if(partSpecies == "gamma"){
G4cout << "Particle species set to gamma" << G4endl;
}
else if(partSpecies == "proton"){
G4cout << "Particle species set to proton" << G4endl;
}
else if(partSpecies == "neutron"){
G4cout << "Particle species set to neutron" << G4endl;
}
else if(partSpecies == "pi+"){
G4cout << "Particle species set to charged pion" << G4endl;
}
else if(partSpecies == "pi-"){
G4cout << "Particle species set to charged pion" << G4endl;
}
else{
G4cout << "Particle species "<< partSpecies << " not recognized" << G4endl;
throw std::invalid_argument("Particle species not recognized");
}
}
private:
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
G4double partEnergy;