File indexing completed on 2025-12-17 09:26:02
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_CHROMOSOME_HIT_HH
0030 #define MOLECULAR_CHROMOSOME_HIT_HH
0031
0032 #include "G4Allocator.hh"
0033 #include "G4THitsCollection.hh"
0034 #include "G4ThreeVector.hh"
0035 #include "G4VHit.hh"
0036 #include "globals.hh"
0037
0038
0039
0040 class ChromosomeHit : public G4VHit
0041 {
0042 public:
0043 explicit ChromosomeHit(const G4String& key);
0044
0045 ChromosomeHit(const ChromosomeHit&);
0046
0047 ~ChromosomeHit() override = default;
0048
0049
0050 inline void* operator new(size_t);
0051
0052 inline void operator delete(void*);
0053
0054 const ChromosomeHit& operator=(const ChromosomeHit&);
0055
0056 G4int operator==(const ChromosomeHit&) const;
0057
0058
0059 void AddChromosomeEdep(G4double edep) { fEdepChromosome += edep; };
0060
0061 void AddDNAEdep(G4double edep) { fEdepDNA += edep; };
0062
0063
0064 G4double GetChromosomeEdep() const { return fEdepChromosome; };
0065
0066 G4double GetDNAEdep() const { return fEdepDNA; };
0067
0068 const G4String& GetName() const { return fName; };
0069
0070 private:
0071 G4String fName;
0072 G4double fEdepChromosome = 0.;
0073 G4double fEdepDNA = 0.;
0074 };
0075
0076 using MolecularChromosomeHitsCollection = G4THitsCollection<ChromosomeHit>;
0077
0078 extern G4ThreadLocal G4Allocator<ChromosomeHit>* MolecularChromosomeHitAllocator;
0079
0080 inline void* ChromosomeHit::operator new(size_t)
0081 {
0082 if (MolecularChromosomeHitAllocator == nullptr) {
0083 MolecularChromosomeHitAllocator = new G4Allocator<ChromosomeHit>;
0084 }
0085 return (void*)MolecularChromosomeHitAllocator->MallocSingle();
0086 }
0087
0088 inline void ChromosomeHit::operator delete(void* hit)
0089 {
0090 MolecularChromosomeHitAllocator->FreeSingle((ChromosomeHit*)hit);
0091 }
0092
0093 #endif