Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // This example is provided by the Geant4-DNA 26 // This example is provided by the Geant4-DNA collaboration 27 // Any report or published results obtained us 27 // Any report or published results obtained using the Geant4-DNA software 28 // shall cite the following Geant4-DNA collabo 28 // shall cite the following Geant4-DNA collaboration publication: 29 // Med. Phys. 37 (2010) 4692-4708 29 // Med. Phys. 37 (2010) 4692-4708 30 // J. Comput. Phys. 274 (2014) 841-882 30 // J. Comput. Phys. 274 (2014) 841-882 31 // The Geant4-DNA web site is available at htt 31 // The Geant4-DNA web site is available at http://geant4-dna.org 32 // 32 // 33 // $Id$ 33 // $Id$ 34 // 34 // 35 /// \file TimeStepAction.hh 35 /// \file TimeStepAction.hh 36 /// \brief Implementation of the TimeStepActio 36 /// \brief Implementation of the TimeStepAction class 37 37 38 #include "TimeStepAction.hh" 38 #include "TimeStepAction.hh" 39 << 39 #include "G4UnitsTable.hh" 40 #include "DetectorConstruction.hh" << 40 #include "G4SystemOfUnits.hh" 41 << 42 #include "G4AnalysisManager.hh" << 43 #include "G4IT.hh" 41 #include "G4IT.hh" >> 42 44 #include "G4ITTrackHolder.hh" 43 #include "G4ITTrackHolder.hh" 45 #include "G4Molecule.hh" 44 #include "G4Molecule.hh" 46 #include "G4RunManager.hh" << 47 #include "G4Scheduler.hh" 45 #include "G4Scheduler.hh" 48 #include "G4SystemOfUnits.hh" << 46 #include "G4AnalysisManager.hh" 49 #include "G4UnitsTable.hh" << 50 // using namespace G4DNAPARSER; << 51 47 52 TimeStepAction::TimeStepAction() : G4UserTimeS << 48 #include "DetectorConstruction.hh" 53 { << 49 #include "G4RunManager.hh" 54 fpDetector = dynamic_cast<const DetectorCons << 50 //using namespace G4DNAPARSER; 55 G4RunManager::GetRunManager()->GetUserDete << 56 51 57 AddTimeStep(1 * picosecond, 0.1 * picosecond << 52 TimeStepAction::TimeStepAction() : 58 AddTimeStep(10 * picosecond, 1 * picosecond) << 53 G4UserTimeStepAction(), 59 AddTimeStep(100 * picosecond, 3 * picosecond << 54 fpDetector(0) 60 AddTimeStep(1000 * picosecond, 10 * picoseco << 55 { >> 56 fpDetector = >> 57 dynamic_cast<const DetectorConstruction*>(G4RunManager::GetRunManager() >> 58 ->GetUserDetectorConstruction()); >> 59 >> 60 AddTimeStep(1 * picosecond, 0.1 * picosecond); >> 61 AddTimeStep(10 * picosecond, 1 * picosecond); >> 62 AddTimeStep(100 * picosecond, 3 * picosecond); >> 63 AddTimeStep(1000 * picosecond, 10 * picosecond); 61 AddTimeStep(10000 * picosecond, 100 * picose 64 AddTimeStep(10000 * picosecond, 100 * picosecond); 62 } 65 } 63 66 64 //....oooOO0OOooo........oooOO0OOooo........oo 67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 68 66 TimeStepAction::~TimeStepAction() 69 TimeStepAction::~TimeStepAction() 67 { 70 { 68 // dtor << 71 //dtor 69 } 72 } 70 73 71 //....oooOO0OOooo........oooOO0OOooo........oo 74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 75 73 TimeStepAction::TimeStepAction(const TimeStepA << 76 TimeStepAction::TimeStepAction(const TimeStepAction& other) : >> 77 G4UserTimeStepAction(other) 74 { 78 { 75 // copy ctor << 79 //copy ctor 76 } 80 } 77 81 78 //....oooOO0OOooo........oooOO0OOooo........oo 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 79 83 80 TimeStepAction& TimeStepAction::operator=(cons << 84 TimeStepAction& >> 85 TimeStepAction::operator=(const TimeStepAction& rhs) 81 { 86 { 82 if (this == &rhs) return *this; << 87 if (this == &rhs) >> 88 return *this; 83 return *this; 89 return *this; 84 } 90 } 85 91 86 //....oooOO0OOooo........oooOO0OOooo........oo 92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 87 93 88 void TimeStepAction::Save(G4MolecularConfigura 94 void TimeStepAction::Save(G4MolecularConfiguration* molconf) 89 { 95 { 90 G4int moleculeID = molconf->GetMoleculeID(); 96 G4int moleculeID = molconf->GetMoleculeID(); 91 const G4String& moleculeName = molconf->GetF 97 const G4String& moleculeName = molconf->GetFormatedName(); 92 G4TrackList* trackList = G4ITTrackHolder::In 98 G4TrackList* trackList = G4ITTrackHolder::Instance()->GetMainList(moleculeID); 93 99 94 if (trackList == 0) return; << 100 if(trackList == 0) return; 95 101 96 G4TrackList::iterator it = trackList->begin( << 102 G4TrackList::iterator it = trackList->begin(); 97 G4TrackList::iterator end = trackList->end() 103 G4TrackList::iterator end = trackList->end(); 98 104 99 for (; it != end; ++it) { << 105 for (; it != end; ++it) >> 106 { 100 G4Track* track = *it; 107 G4Track* track = *it; 101 SaveMoleculeInfo(track, moleculeID, molecu 108 SaveMoleculeInfo(track, moleculeID, moleculeName); 102 } 109 } 103 } 110 } 104 111 105 //....oooOO0OOooo........oooOO0OOooo........oo 112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 106 113 107 void TimeStepAction::SaveMoleculeInfo(G4Track* << 114 void TimeStepAction::SaveMoleculeInfo( >> 115 G4Track* track, G4int molID, const G4String& /*moleculeName*/) 108 { 116 { 109 G4AnalysisManager* analysisManager = G4Analy 117 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 110 if (!analysisManager->IsActive()) { << 118 if(!analysisManager->IsActive()) {return; } 111 return; << 112 } << 113 119 114 const G4ThreeVector& position = track->GetPo 120 const G4ThreeVector& position = track->GetPosition(); 115 // H_{3}O^{1} ID = 0 << 121 //H_{3}O^{1} ID = 0 116 // OH^{-1} ID = 1 << 122 //OH^{-1} ID = 1 117 // OH^{0} ID = 2 << 123 //OH^{0} ID = 2 118 // e_{aq}^{1} ID = 3 << 124 //e_{aq}^{1} ID = 3 119 // H0 ID = 4 << 125 //H0 ID = 4 120 // H_{2}^{0} ID = 5 << 126 //H_{2}^{0} ID = 5 121 // H2O2 ID = 6 << 127 //H2O2 ID = 6 122 // H_{2}O^{0} or H_{2}O^{1} ID=7-17 << 128 //H_{2}O^{0} or H_{2}O^{1} ID=7-17 123 << 129 124 G4double xp = position.x(); << 130 G4double xp = position.x(); 125 G4double yp = position.y(); << 131 G4double yp = position.y(); 126 G4double zp = position.z(); << 132 G4double zp = position.z(); 127 G4double R = std::sqrt(xp * xp + yp * yp + z << 133 G4double R = std::sqrt(xp*xp+yp*yp+zp*zp) /CLHEP::nm; 128 // G4double RNP = fpDetector->GetNPRadius( << 134 //G4double RNP = fpDetector->GetNPRadius()/CLHEP::nm; 129 << 135 130 G4int offset = 10; << 136 G4int offset = 10; 131 << 137 132 if (molID < 7) { << 138 if(molID<7){ 133 analysisManager->FillH1(molID + offset, R) << 139 analysisManager->FillH1(molID+offset, R); 134 } << 140 }else{ 135 else { << 141 analysisManager->FillH1(17, R); 136 analysisManager->FillH1(17, R); << 142 } 137 } << 138 143 139 G4Scheduler::Instance()->Stop(); << 144 G4Scheduler::Instance()->Stop(); 140 } 145 } 141 //....oooOO0OOooo........oooOO0OOooo........oo 146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 142 147 143 void TimeStepAction::UserPreTimeStepAction() 148 void TimeStepAction::UserPreTimeStepAction() 144 { 149 { 145 // Loop over defined molecules 150 // Loop over defined molecules 146 G4ConfigurationIterator it = G4MoleculeTable << 151 G4ConfigurationIterator it >> 152 = G4MoleculeTable::Instance()->GetConfigurationIterator(); 147 153 148 G4double time = G4Scheduler::Instance()->Get 154 G4double time = G4Scheduler::Instance()->GetGlobalTime(); 149 << 155 150 if (time == 1. * picosecond) { << 156 if(time == 1.*picosecond){ 151 while (it()) { << 157 while(it()) >> 158 { 152 G4MolecularConfiguration* molconf = it.v 159 G4MolecularConfiguration* molconf = it.value(); 153 Save(molconf); 160 Save(molconf); 154 } 161 } 155 } 162 } 156 } 163 } 157 164 158 //....oooOO0OOooo........oooOO0OOooo........oo 165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 159 166 160 void TimeStepAction::UserReactionAction(const << 167 void TimeStepAction::UserReactionAction( 161 const << 168 const G4Track&, 162 {} << 169 const G4Track&, >> 170 const std::vector<G4Track*>* /*products*/) >> 171 { >> 172 } 163 173