Geant4_10
G4DNADamages.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 // $Id: G4DNADamages.cc 66872 2013-01-15 01:25:57Z japost $
27 //
28 #include "G4DNADamages.hh"
29 #include "G4UnitsTable.hh"
30 
32 
34  const G4Molecule* molecule,
35  const G4ThreeVector& position,
36  G4double time) : G4VDNAHit(),
37  fpMolecule(molecule)
38 {
39  fBaseName = baseName;
41  fTime = time;
42 }
43 
44 
46 {
47  if(fpMolecule) delete fpMolecule;
48  fpMolecule = 0;
49 }
50 
52 {
53  G4cout << "Reaction : " << fpMolecule->GetName() << " + " << fBaseName
54  << " at position : " << G4BestUnit(fPosition,"Length")
55  << " and time : " << G4BestUnit(fTime,"Time") << G4endl;
56 }
57 
58 
60 {
61  if(!fpInstance) new G4DNADamages();
62 
63  return fpInstance;
64 }
65 
67 {
68  fJustCountDamage = false;
70  fpInstance = this;
71 }
72 
74 {
75  for(int i = 0 ; i <(int) fIndirectHits.size() ; i++)
76  {
77  if(fIndirectHits[i])
78  delete fIndirectHits[i];
79  }
80  fIndirectHits.clear();
81 }
82 
84 {
85  if(fpInstance) delete fpInstance;
86  fpInstance = 0;
87 }
88 
90 {
92  for(int i = 0 ; i <(int) fIndirectHits.size() ; i++)
93  {
94  if(fIndirectHits[i])
95  delete fIndirectHits[i];
96  }
97  fIndirectHits.clear();
98 }
99 
101  const G4Molecule* molecule,
102  const G4ThreeVector& position,
103  G4double time)
104 {
105  if(fJustCountDamage)
106  {
108  return;
109  }
110 
111  G4DNAIndirectHit* indirectHit = 0;
112  std::map<G4Molecule, const G4Molecule*>::iterator it = fMolMap.find(*molecule);
113 
114  if(it == fMolMap.end())
115  {
116  G4Molecule* mol(0);
117  fMolMap[*molecule] = (mol = new G4Molecule(*molecule));
118  indirectHit = new G4DNAIndirectHit(baseName, mol, position, time);
119  }
120  else
121  {
122  indirectHit = new G4DNAIndirectHit(baseName, it->second, position, time);
123  }
124  fIndirectHits.push_back(indirectHit);
125 }
static G4DNADamages * Instance()
Definition: G4DNADamages.cc:59
virtual ~G4DNADamages()
Definition: G4DNADamages.cc:73
std::map< G4Molecule, const G4Molecule * > fMolMap
G4ThreeVector fPosition
Definition: G4DNADamages.hh:56
virtual void Reset()
Definition: G4DNADamages.cc:89
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
std::vector< G4DNAIndirectHit * > fIndirectHits
Definition: G4DNADamages.hh:99
G4String fBaseName
Definition: G4DNADamages.hh:58
const G4Molecule * fpMolecule
Definition: G4DNADamages.hh:55
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
#define G4ThreadLocal
Definition: tls.hh:52
const G4String & GetName() const
Definition: G4Molecule.cc:243
G4GLOB_DLL std::ostream G4cout
static G4ThreadLocal G4DNADamages * fpInstance
Definition: G4DNADamages.hh:94
G4DNAIndirectHit(const G4String &baseName, const G4Molecule *molecule, const G4ThreeVector &position, G4double time)
Definition: G4DNADamages.cc:33
G4bool fJustCountDamage
Definition: G4DNADamages.hh:97
static void DeleteInstance()
Definition: G4DNADamages.cc:83
int position
Definition: filter.cc:7
G4int fNIndirectDamages
Definition: G4DNADamages.hh:98
virtual ~G4DNAIndirectHit()
Definition: G4DNADamages.cc:45
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual void AddIndirectDamage(const G4String &baseName, const G4Molecule *molecule, const G4ThreeVector &position, double time)