File indexing completed on 2025-01-31 09:22:00
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 ChemGeoImport_HH
0031 #define ChemGeoImport_HH
0032
0033 #include <map>
0034 #include <fstream>
0035 #include <algorithm>
0036 #include <set>
0037
0038 #include "G4String.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4Orb.hh"
0041 #include "G4VSolid.hh"
0042 #include "G4Box.hh"
0043 #include "G4SystemOfUnits.hh"
0044 #include "G4SubtractionSolid.hh"
0045 #include "G4LogicalVolume.hh"
0046 #include "G4PVPlacement.hh"
0047 #include "G4NistManager.hh"
0048 #include "G4VisAttributes.hh"
0049 #include "G4H2O.hh"
0050 #include "G4Electron_aq.hh"
0051 #include "G4Scheduler.hh"
0052
0053 #include "UserMoleculeGun.hh"
0054
0055
0056
0057 struct ChemMolecule
0058 {
0059 ChemMolecule(G4String name, G4int copyNumber, G4ThreeVector position,
0060 G4int strand, G4int state, G4int electronicLevel, G4int trackId)
0061 {
0062 fName = name;
0063 fCopyNumber = copyNumber;
0064 fPosition = position;
0065 fStrand = strand;
0066 fState = state;
0067 fElectronicLevel = electronicLevel;
0068 fTrackId = trackId;
0069 }
0070
0071 ~ChemMolecule() {}
0072
0073 G4String fName{""};
0074
0075 G4int fCopyNumber{-1};
0076 G4int fStrand{-1};
0077 G4int fState{-99};
0078 G4int fElectronicLevel{-99};
0079 G4int fTrackId{-1};
0080
0081 G4ThreeVector fPosition{0};
0082
0083 friend G4bool operator==(const ChemMolecule& lhs, const ChemMolecule& rhs)
0084 {
0085 return (lhs.fName == rhs.fName
0086 && lhs.fCopyNumber == rhs.fCopyNumber
0087 && lhs.fStrand == rhs.fStrand
0088 && lhs.fState == rhs.fState
0089 && lhs.fElectronicLevel == rhs.fElectronicLevel
0090 && lhs.fTrackId == rhs.fTrackId);
0091 }
0092 };
0093
0094
0095
0096 class ChemGeoImport
0097 {
0098 public:
0099 ChemGeoImport();
0100 ~ChemGeoImport();
0101
0102 void SetFactor(double factor){fFactor=factor;}
0103 G4double GetFactor() const {return fFactor;}
0104
0105 G4double GetSize() const {return fSize;}
0106
0107 void ParseFiles(const G4String& chemInputFile);
0108
0109
0110 void InsertMoleculeInWorld();
0111
0112 void Reset();
0113 G4String GetVoxelDefFilePath(G4String bareName);
0114 G4bool IsFileParsed() {return fIsParsed;}
0115 private:
0116 G4bool fIsParsed{false};
0117
0118
0119 G4double fFactor{1};
0120
0121 G4double fSize{0};
0122
0123 G4String fGeoNameFromChemInput{""};
0124
0125
0126 std::vector<ChemMolecule> fMolecules;
0127
0128 std::vector<ChemMolecule> fToBeRemovedMol;
0129
0130 UserMoleculeGun* fpGun{nullptr};
0131
0132 void ParseChemInputFile(const G4String& fileName);
0133 void ParseGeoFile(const G4String& fileName);
0134 G4bool IsMoleculeInTheRemoveTable(const ChemMolecule& molecule);
0135
0136 void GetVoxelDefFilePathList();
0137 std::set<G4String> fVoxelDefFilesList;
0138 };
0139
0140
0141
0142 #endif