Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DNADamage.cc
Go to the documentation of this file.
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#include "G4DNADamage.hh"
28#include "G4UnitsTable.hh"
29
31
33 const G4Molecule* molecule,
35 G4double time) :
36 fpMolecule(molecule)
37{
38 fBaseName = baseName;
40 fTime = time;
41}
42
48
50{
51 G4cout << "Reaction : " << fpMolecule->GetName() << " + " << fBaseName
52 << " at position : " << G4BestUnit(fPosition, "Length")
53 << " and time : " << G4BestUnit(fTime, "Time") << G4endl;
54}
55
57{
58 if (fpInstance == nullptr) new G4DNADamage();
59
60 return fpInstance;
61}
62
69
71{
72 for (auto & fIndirectHit : fIndirectHits)
73 {
74 delete fIndirectHit;
75 }
76 fIndirectHits.clear();
77}
78
80{
81 delete fpInstance;
82 fpInstance = nullptr;
83}
84
86{
88 for (auto & fIndirectHit : fIndirectHits)
89 {
90 delete fIndirectHit;
91 }
92 fIndirectHits.clear();
93}
94
96 const G4Molecule* molecule,
98 G4double time)
99{
101 {
103 return;
104 }
105
106 G4DNAIndirectHit* indirectHit = nullptr;
107 auto it = fMolMap.find(*molecule);
108
109 if (it == fMolMap.cend())
110 {
111 G4Molecule* mol(nullptr);
112 fMolMap[*molecule] = (mol = new G4Molecule(*molecule));
113 indirectHit = new G4DNAIndirectHit(baseName, mol, position, time);
114 }
115 else
116 {
117 indirectHit = new G4DNAIndirectHit(baseName, it->second, position, time);
118 }
119 fIndirectHits.push_back(indirectHit);
120}
#define G4BestUnit(a, b)
double G4double
Definition G4Types.hh:83
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
virtual void Reset()
virtual ~G4DNADamage()
virtual void AddIndirectDamage(const G4String &baseName, const G4Molecule *molecule, const G4ThreeVector &position, G4double time)
std::map< G4Molecule, const G4Molecule * > fMolMap
G4int fNIndirectDamage
std::vector< G4DNAIndirectHit * > fIndirectHits
static G4DNADamage * Instance()
static void DeleteInstance()
G4bool fJustCountDamage
static G4ThreadLocal G4DNADamage * fpInstance
G4DNAIndirectHit(const G4String &baseName, const G4Molecule *molecule, const G4ThreeVector &position, G4double time)
~G4DNAIndirectHit() override
const G4Molecule * fpMolecule
G4ThreeVector fPosition
const G4String & GetName() const override
#define G4ThreadLocal
Definition tls.hh:77