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10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 //
 27 /// \file molecularDNAHit.hh
 28 /// \brief Hit class for an event that interacts with DNA
 29 #ifndef MOLECULAR_DNA_HIT_HH
 30 #define MOLECULAR_DNA_HIT_HH
 31 
 32 #include "MoleculeList.hh"
 33 
 34 #include "G4Allocator.hh"
 35 #include "G4THitsCollection.hh"
 36 #include "G4ThreeVector.hh"
 37 #include "G4VHit.hh"
 38 #include "globals.hh"
 39 
 40 #include <utility>
 41 
 42 class G4MolecularConfiguration;
 43 
 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 45 
 46 class DNAHit : public G4VHit
 47 {
 48   public:
 49     // Main constructors
 50     DNAHit() = default;
 51 
 52     DNAHit(const molecule&, G4int, G4int, G4int, int64_t,
 53            const G4ThreeVector&,  // dousatsu
 54            const G4ThreeVector&, const G4double&, const G4double&, const G4String&,  // dousatsu
 55            const G4MolecularConfiguration*);  // dousatsu
 56 
 57     // Constructor delegation
 58     // Physical Hit
 59     DNAHit(const molecule& mol, G4int placement_idx, G4int chain, G4int strand, int64_t bp,
 60            const G4ThreeVector& pos, const G4ThreeVector& localpos, G4double energy, G4double d,
 61            G4String chromo)
 62       : DNAHit(mol, placement_idx, chain, strand, bp, pos, localpos, energy, d, std::move(chromo),
 63                nullptr) {};
 64 
 65     // Chemical hit
 66     DNAHit(const molecule& mol, G4int placement_idx, G4int chain, G4int strand, int64_t bp,
 67            const G4ThreeVector& pos, const G4ThreeVector& localpos, G4String chromo,
 68            const G4MolecularConfiguration* radical)
 69       : DNAHit(mol, placement_idx, chain, strand, bp, pos, localpos, 0, 0, std::move(chromo),
 70                radical) {};
 71 
 72     DNAHit(const DNAHit&);
 73 
 74     ~DNAHit() override = default;
 75 
 76     // Add Method, not as an operator to prevent people making mistakes
 77     void AddHit(const DNAHit&);
 78 
 79     // operators
 80     inline void* operator new(size_t);
 81 
 82     inline void operator delete(void*);
 83 
 84     const DNAHit& operator=(const DNAHit&);
 85 
 86     G4int operator==(const DNAHit&) const;
 87 
 88     // setters
 89     // Avoid setters in general and use the constructor, as it also sets
 90     // the computed quantites
 91     void SetMolecule(const molecule& mol) { fMoleculeEnum = mol; };
 92 
 93     void SetPlacementIdx(G4int place_idx) { fPlacementIdx = place_idx; };
 94 
 95     void SetChainIdx(G4int chainidx) { fChainIdx = chainidx; };
 96 
 97     void SetStrandIdx(G4int strandidx) { fStrandIdx = strandidx; };
 98 
 99     void SetBasePairIdx(int64_t bpidx) { fBasePairIdx = bpidx; };  // dousatsu
100 
101     void SetPosition(const G4ThreeVector& p) { fPosition = p; };
102 
103     void SetLocalPosition(const G4ThreeVector& p) { fLocalPosition = p; };
104 
105     void SetEnergy(const G4double& energy) { fEnergy = energy; };
106 
107     void SetDistance(const G4double& dist) { fDistance = dist; };
108 
109     void SetChromosome(const G4String& chrom) { fChromosome = chrom; };
110 
111     void SetRadical(const G4MolecularConfiguration* r) { fRadical = r; };
112 
113     // getters
114     molecule GetMolecule() const { return fMoleculeEnum; };
115 
116     G4int GetPlacementIdx() const { return fPlacementIdx; };
117 
118     G4int GetChainIdx() const { return fChainIdx; };
119 
120     G4int GetStrandIdx() const { return fStrandIdx; };
121 
122     int64_t GetBasePairIdx() const { return fBasePairIdx; };  // dousatsu
123     G4ThreeVector GetPosition() const { return fPosition; };
124 
125     G4ThreeVector GetLocalPosition() const { return fLocalPosition; };
126 
127     G4double GetEnergy() const { return fEnergy; };
128 
129     G4double GetDistance() const { return fDistance; };
130 
131     G4String GetChromosome() const { return fChromosome; };
132 
133     const G4MolecularConfiguration* GetRadical() const { return fRadical; };
134 
135     // Get Computed Quantites
136     const G4MolecularConfiguration* GetStrand1Rad() const { return fStrand1Rad; };
137 
138     const G4MolecularConfiguration* GetBase1Rad() const { return fBase1Rad; };
139 
140     const G4MolecularConfiguration* GetStrand2Rad() const { return fStrand2Rad; };
141 
142     const G4MolecularConfiguration* GetBase2Rad() const { return fBase2Rad; };
143 
144     G4double GetStrand1Energy() const { return fStrand1Energy; };
145 
146     G4double GetStrand2Energy() const { return fStrand2Energy; };
147 
148     G4double GetBP1Energy() const { return fBP1Energy; };
149 
150     G4double GetBP2Energy() const { return fBP2Energy; };
151 
152   private:
153     molecule fMoleculeEnum = UNSPECIFIED;
154     G4int fPlacementIdx = -1;  // ORG
155     G4int fChainIdx = -1;  // ORG
156     G4int fStrandIdx = -1;  // ORG
157     int64_t fBasePairIdx = -1;  // dousatsu
158     G4ThreeVector fPosition = G4ThreeVector();
159     G4ThreeVector fLocalPosition = G4ThreeVector();
160     G4double fEnergy = 0.;
161     G4double fDistance = 0.;
162     G4String fChromosome = "";
163     const G4MolecularConfiguration* fRadical = nullptr;
164     const G4MolecularConfiguration* fStrand1Rad = nullptr;
165     const G4MolecularConfiguration* fBase1Rad = nullptr;
166     const G4MolecularConfiguration* fStrand2Rad = nullptr;
167     const G4MolecularConfiguration* fBase2Rad = nullptr;
168 
169     G4double fStrand1Energy = 0.;
170     G4double fStrand2Energy = 0.;
171     G4double fBP1Energy = 0.;
172     G4double fBP2Energy = 0.;
173 };
174 
175 // typedefs
176 using MolecularDNAHitsCollection = G4THitsCollection<DNAHit>;
177 
178 // memory management
179 extern G4ThreadLocal G4Allocator<DNAHit>* MolecularDNAHitAllocator;
180 
181 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
182 
183 inline void* DNAHit::operator new(size_t)
184 {
185   if (MolecularDNAHitAllocator == nullptr) {
186     MolecularDNAHitAllocator = new G4Allocator<DNAHit>;
187   }
188   return (void*)MolecularDNAHitAllocator->MallocSingle();
189 }
190 
191 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
192 
193 inline void DNAHit::operator delete(void* hit)
194 {
195   MolecularDNAHitAllocator->FreeSingle((DNAHit*)hit);
196 }
197 
198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
199 
200 #endif  // MOLECULAR_DNA_HIT_HH
201