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 #ifndef MOLECULAR_DNA_HIT_HH
0030 #define MOLECULAR_DNA_HIT_HH
0031
0032 #include "MoleculeList.hh"
0033
0034 #include "G4Allocator.hh"
0035 #include "G4THitsCollection.hh"
0036 #include "G4ThreeVector.hh"
0037 #include "G4VHit.hh"
0038 #include "globals.hh"
0039
0040 #include <utility>
0041
0042 class G4MolecularConfiguration;
0043
0044
0045
0046 class DNAHit : public G4VHit
0047 {
0048 public:
0049
0050 DNAHit() = default;
0051
0052 DNAHit(const molecule&, G4int, G4int, G4int, int64_t,
0053 const G4ThreeVector&,
0054 const G4ThreeVector&, const G4double&, const G4double&, const G4String&,
0055 const G4MolecularConfiguration*);
0056
0057
0058
0059 DNAHit(const molecule& mol, G4int placement_idx, G4int chain, G4int strand, int64_t bp,
0060 const G4ThreeVector& pos, const G4ThreeVector& localpos, G4double energy, G4double d,
0061 G4String chromo)
0062 : DNAHit(mol, placement_idx, chain, strand, bp, pos, localpos, energy, d, std::move(chromo),
0063 nullptr) {};
0064
0065
0066 DNAHit(const molecule& mol, G4int placement_idx, G4int chain, G4int strand, int64_t bp,
0067 const G4ThreeVector& pos, const G4ThreeVector& localpos, G4String chromo,
0068 const G4MolecularConfiguration* radical)
0069 : DNAHit(mol, placement_idx, chain, strand, bp, pos, localpos, 0, 0, std::move(chromo),
0070 radical) {};
0071
0072 DNAHit(const DNAHit&);
0073
0074 ~DNAHit() override = default;
0075
0076
0077 void AddHit(const DNAHit&);
0078
0079
0080 inline void* operator new(size_t);
0081
0082 inline void operator delete(void*);
0083
0084 const DNAHit& operator=(const DNAHit&);
0085
0086 G4int operator==(const DNAHit&) const;
0087
0088
0089
0090
0091 void SetMolecule(const molecule& mol) { fMoleculeEnum = mol; };
0092
0093 void SetPlacementIdx(G4int place_idx) { fPlacementIdx = place_idx; };
0094
0095 void SetChainIdx(G4int chainidx) { fChainIdx = chainidx; };
0096
0097 void SetStrandIdx(G4int strandidx) { fStrandIdx = strandidx; };
0098
0099 void SetBasePairIdx(int64_t bpidx) { fBasePairIdx = bpidx; };
0100
0101 void SetPosition(const G4ThreeVector& p) { fPosition = p; };
0102
0103 void SetLocalPosition(const G4ThreeVector& p) { fLocalPosition = p; };
0104
0105 void SetEnergy(const G4double& energy) { fEnergy = energy; };
0106
0107 void SetDistance(const G4double& dist) { fDistance = dist; };
0108
0109 void SetChromosome(const G4String& chrom) { fChromosome = chrom; };
0110
0111 void SetRadical(const G4MolecularConfiguration* r) { fRadical = r; };
0112
0113
0114 molecule GetMolecule() const { return fMoleculeEnum; };
0115
0116 G4int GetPlacementIdx() const { return fPlacementIdx; };
0117
0118 G4int GetChainIdx() const { return fChainIdx; };
0119
0120 G4int GetStrandIdx() const { return fStrandIdx; };
0121
0122 int64_t GetBasePairIdx() const { return fBasePairIdx; };
0123 G4ThreeVector GetPosition() const { return fPosition; };
0124
0125 G4ThreeVector GetLocalPosition() const { return fLocalPosition; };
0126
0127 G4double GetEnergy() const { return fEnergy; };
0128
0129 G4double GetDistance() const { return fDistance; };
0130
0131 G4String GetChromosome() const { return fChromosome; };
0132
0133 const G4MolecularConfiguration* GetRadical() const { return fRadical; };
0134
0135
0136 const G4MolecularConfiguration* GetStrand1Rad() const { return fStrand1Rad; };
0137
0138 const G4MolecularConfiguration* GetBase1Rad() const { return fBase1Rad; };
0139
0140 const G4MolecularConfiguration* GetStrand2Rad() const { return fStrand2Rad; };
0141
0142 const G4MolecularConfiguration* GetBase2Rad() const { return fBase2Rad; };
0143
0144 G4double GetStrand1Energy() const { return fStrand1Energy; };
0145
0146 G4double GetStrand2Energy() const { return fStrand2Energy; };
0147
0148 G4double GetBP1Energy() const { return fBP1Energy; };
0149
0150 G4double GetBP2Energy() const { return fBP2Energy; };
0151
0152 private:
0153 molecule fMoleculeEnum = UNSPECIFIED;
0154 G4int fPlacementIdx = -1;
0155 G4int fChainIdx = -1;
0156 G4int fStrandIdx = -1;
0157 int64_t fBasePairIdx = -1;
0158 G4ThreeVector fPosition = G4ThreeVector();
0159 G4ThreeVector fLocalPosition = G4ThreeVector();
0160 G4double fEnergy = 0.;
0161 G4double fDistance = 0.;
0162 G4String fChromosome = "";
0163 const G4MolecularConfiguration* fRadical = nullptr;
0164 const G4MolecularConfiguration* fStrand1Rad = nullptr;
0165 const G4MolecularConfiguration* fBase1Rad = nullptr;
0166 const G4MolecularConfiguration* fStrand2Rad = nullptr;
0167 const G4MolecularConfiguration* fBase2Rad = nullptr;
0168
0169 G4double fStrand1Energy = 0.;
0170 G4double fStrand2Energy = 0.;
0171 G4double fBP1Energy = 0.;
0172 G4double fBP2Energy = 0.;
0173 };
0174
0175
0176 using MolecularDNAHitsCollection = G4THitsCollection<DNAHit>;
0177
0178
0179 extern G4ThreadLocal G4Allocator<DNAHit>* MolecularDNAHitAllocator;
0180
0181
0182
0183 inline void* DNAHit::operator new(size_t)
0184 {
0185 if (MolecularDNAHitAllocator == nullptr) {
0186 MolecularDNAHitAllocator = new G4Allocator<DNAHit>;
0187 }
0188 return (void*)MolecularDNAHitAllocator->MallocSingle();
0189 }
0190
0191
0192
0193 inline void DNAHit::operator delete(void* hit)
0194 {
0195 MolecularDNAHitAllocator->FreeSingle((DNAHit*)hit);
0196 }
0197
0198
0199
0200 #endif