From 1602992cee4cb7b589e1440baa386c6364f641c4 Mon Sep 17 00:00:00 2001 From: Jan Kieseler Date: Sat, 9 Sep 2023 01:32:53 +0200 Subject: [PATCH] checks --- include/ActionInitialization.hh | 1 + include/PrimaryGeneratorAction.hh | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/include/ActionInitialization.hh b/include/ActionInitialization.hh index 87d8257..4f05e33 100644 --- a/include/ActionInitialization.hh +++ b/include/ActionInitialization.hh @@ -56,6 +56,7 @@ class ActionInitialization : public G4VUserActionInitialization this->minEnergy = minEnergy; this->maxEnergy = maxEnergy; this->partSpecies = partSpecies; + } private: diff --git a/include/PrimaryGeneratorAction.hh b/include/PrimaryGeneratorAction.hh index 1b84a98..851b651 100644 --- a/include/PrimaryGeneratorAction.hh +++ b/include/PrimaryGeneratorAction.hh @@ -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;