File indexing completed on 2025-01-31 09:22:01
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 #ifndef UserMoleculeGun_h
0031 #define UserMoleculeGun_h 1
0032
0033 #include "G4DNAChemistryManager.hh"
0034 #include "G4MoleculeGun.hh"
0035
0036 class UserMoleculeGun;
0037
0038 class UserMoleculeShoot : public G4enable_shared_from_this<UserMoleculeShoot>,
0039 public G4MoleculeShoot
0040 {
0041 public:
0042
0043 UserMoleculeShoot();
0044 ~UserMoleculeShoot() override;
0045 void Shoot(G4MoleculeGun*) override {};
0046 virtual void MyShoot(UserMoleculeGun*) = 0;
0047
0048 template<typename TYPE> G4shared_ptr<UserMoleculeShoot> ChangeType();
0049
0050 G4int fCopyNumber{-1};
0051 G4int fStrand{-1};
0052 };
0053
0054
0055
0056 template<typename TYPE>
0057 class TUserMoleculeShoot : public UserMoleculeShoot
0058 {
0059 public:
0060 TUserMoleculeShoot() : UserMoleculeShoot(){;}
0061 ~TUserMoleculeShoot() override {;}
0062 void MyShoot(UserMoleculeGun*) override;
0063 protected:
0064 void ShootAtRandomPosition(UserMoleculeGun*);
0065 void ShootAtFixedPosition(UserMoleculeGun*);
0066 };
0067
0068
0069
0070 template<typename TYPE>
0071 G4shared_ptr<UserMoleculeShoot> UserMoleculeShoot::ChangeType()
0072 {
0073 G4shared_ptr<UserMoleculeShoot> output(new TUserMoleculeShoot<TYPE>);
0074 output->fMoleculeName = fMoleculeName;
0075 output->fPosition = fPosition;
0076 output->fTime = fTime;
0077 output->fNumber = fNumber;
0078 output->fBoxSize = fBoxSize;
0079 output->fCopyNumber = fCopyNumber;
0080 output->fStrand = fStrand;
0081 return output;
0082 }
0083
0084
0085
0086 class UserMoleculeGun : public G4ITGun
0087 {
0088 public:
0089 UserMoleculeGun() = default;
0090 ~UserMoleculeGun() override = default;
0091
0092 void DefineTracks() override;
0093
0094 void AddMolecule(const G4String& name,
0095 const G4ThreeVector& position,
0096 G4double time,
0097 G4int copyNumber,
0098 G4int strand);
0099
0100 void AddWaterMolecule(const G4ThreeVector& position,
0101 G4int trackId,
0102 ElectronicModification elecModif,
0103 G4int electronicLevel);
0104
0105 protected:
0106 void BuildAndPushTrack(const G4String& name,
0107 const G4ThreeVector& position,
0108 G4double time = 0);
0109
0110 void BuildAndPushTrack(const G4String& name,
0111 const G4ThreeVector& position,
0112 G4double time,
0113 G4int copyNumber,
0114 G4int strand);
0115
0116 std::vector<G4shared_ptr<UserMoleculeShoot> > fShoots;
0117 friend class UserMoleculeShoot;
0118 template<class T> friend class TUserMoleculeShoot;
0119 };
0120
0121
0122
0123 #endif