File indexing completed on 2025-02-23 09:21:58
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 MOLECULAR_PRIMARY_GENERATORSOURCE_HH
0031 #define MOLECULAR_PRIMARY_GENERATORSOURCE_HH
0032
0033 #include "G4ParticleDefinition.hh"
0034 #include "G4ParticleTable.hh"
0035 #include "G4ThreeVector.hh"
0036
0037 #include <fstream>
0038 #include <list>
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 class Primary
0049 {
0050 public:
0051
0052 Primary() { ; }
0053
0054
0055 ~Primary() = default;
0056
0057 void SetName(const G4String& name) { fName = name; }
0058 void SetName(G4int PDGnum)
0059 {
0060 if (PDGnum != 0) {
0061 G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
0062 G4ParticleDefinition* particle = pTable->FindParticle(PDGnum);
0063 fName = particle->GetParticleName();
0064 }
0065 else {
0066 fName = "";
0067 }
0068 }
0069
0070 G4String GetName() const { return fName; }
0071
0072 void SetPosition(const G4ThreeVector& position) { fPosition = position; }
0073 G4ThreeVector GetPosition() const { return fPosition; }
0074
0075 void SetMomentum(const G4ThreeVector& momentum) { fMomentum = momentum; }
0076 G4ThreeVector GetMomentum() const { return fMomentum; }
0077
0078 void SetMomentumDirection(const G4ThreeVector& momentumDir) { fMomentumDir = momentumDir; }
0079 G4ThreeVector GetMomentumDirection() const { return fMomentumDir; }
0080
0081 void SetEnergy(const G4double& energy) { fEnergy = energy; }
0082 G4double GetEnergy() const { return fEnergy; }
0083
0084 G4ParticleDefinition* GetParticleDefinition()
0085 {
0086 G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
0087 G4ParticleDefinition* particle = pTable->FindParticle(fName.data());
0088 return particle;
0089 }
0090
0091 void Print()
0092 {
0093 G4cout << " *** " << fName << " *** " << G4endl;
0094 G4cout << " * Position: " << fPosition << G4endl;
0095 G4cout << " * Momentum Direction: " << fMomentumDir << G4endl;
0096 G4cout << " * Energy: " << fEnergy << G4endl;
0097 G4cout << " *** *** ***" << G4endl;
0098 }
0099
0100 private:
0101 G4String fName;
0102 G4ThreeVector fPosition;
0103 G4ThreeVector fMomentum;
0104 G4ThreeVector fMomentumDir;
0105 G4double fEnergy;
0106 };
0107
0108
0109
0110 class PrimaryGeneratorSource
0111 {
0112 public:
0113
0114 virtual ~PrimaryGeneratorSource() = default;
0115
0116
0117 virtual Primary* GetPrimary() = 0;
0118 virtual void SetBufferSize(G4int) = 0;
0119 virtual void SetnParticles(G4int) = 0;
0120 };
0121
0122
0123
0124 #endif