File indexing completed on 2025-01-18 09:58:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #ifndef MOLECULEGUNMESSENGER_HH_
0046 #define MOLECULEGUNMESSENGER_HH_
0047
0048 #include "G4UImessenger.hh"
0049 #include "G4ThreeVector.hh"
0050 #include "G4memory.hh"
0051 #include "G4MoleculeGun.hh"
0052 #include <vector>
0053
0054 class G4UIcmdWithAString;
0055 class G4UIcmdWith3VectorAndUnit;
0056 class G4UIcmdWithADoubleAndUnit;
0057 class G4UIcmdWithAnInteger;
0058 class G4UIdirectory;
0059 class G4MoleculeGunMessenger;
0060 class G4MoleculeShoot;
0061
0062
0063
0064 class G4MoleculeShootMessenger : public G4UImessenger
0065 {
0066 public:
0067 G4MoleculeShootMessenger(const G4String& name,
0068 G4MoleculeGunMessenger*,
0069 G4shared_ptr<G4MoleculeShoot>);
0070 ~G4MoleculeShootMessenger() override;
0071 void SetNewValue(G4UIcommand * command, G4String newValue) override;
0072 G4String GetCurrentValue(G4UIcommand * command) override;
0073
0074 inline G4shared_ptr<G4MoleculeShoot>& GetShoot() {
0075 return fpShoot;
0076 }
0077
0078 protected:
0079 G4UIcmdWithAString* fpGunSpecies;
0080 G4UIcmdWith3VectorAndUnit* fpGunPosition;
0081 G4UIcmdWith3VectorAndUnit* fpGunRdnmPosition ;
0082 G4UIcmdWithADoubleAndUnit* fpGunTime;
0083 G4UIcmdWithAnInteger* fpGunN;
0084 G4UIcmdWithAString* fpGunType;
0085 G4shared_ptr<G4MoleculeShoot> fpShoot;
0086 };
0087
0088
0089
0090 class G4MoleculeGunMessenger : public G4UImessenger
0091 {
0092
0093 public:
0094 G4MoleculeGunMessenger(G4MoleculeGun*);
0095 ~G4MoleculeGunMessenger() override;
0096
0097 void SetNewValue(G4UIcommand * command, G4String newValue) override;
0098 G4String GetCurrentValue(G4UIcommand * command) override;
0099
0100 const std::vector<G4MoleculeShootMessenger*>&
0101 GetShootMessengers() const
0102 {
0103 return fMultipleGun;
0104 }
0105
0106 protected:
0107 G4MoleculeGun* fpMoleculeGun;
0108 G4UIcmdWithAString* fpGunNewGunType;
0109
0110 template<typename T>
0111 G4MoleculeShootMessenger* CreateNewType(const G4String& name)
0112 {
0113 G4shared_ptr<G4MoleculeShoot> moleculeShoot(new TG4MoleculeShoot<T>());
0114 auto shoot =
0115 new G4MoleculeShootMessenger(name,
0116 this,
0117 moleculeShoot);
0118 fMultipleGun.push_back(shoot);
0119 fpMoleculeGun->AddMoleculeShoot(shoot->GetShoot());
0120 return shoot;
0121 }
0122
0123 std::vector<G4MoleculeShootMessenger*> fMultipleGun;
0124 };
0125
0126 #endif