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 // 34 // 34 /// \file TimeStepAction.hh 35 /// \file TimeStepAction.hh 35 /// \brief Implementation of the TimeStepActio 36 /// \brief Implementation of the TimeStepAction class 36 37 37 #include "TimeStepAction.hh" 38 #include "TimeStepAction.hh" 38 39 39 #include "G4MolecularConfiguration.hh" << 40 #include "G4Molecule.hh" << 41 #include "G4MoleculeTable.hh" << 42 #include "G4SystemOfUnits.hh" << 43 #include "G4UnitsTable.hh" << 44 << 45 #include <G4Scheduler.hh> 40 #include <G4Scheduler.hh> >> 41 #include "G4UnitsTable.hh" >> 42 #include "G4SystemOfUnits.hh" >> 43 //#include "G4Molecule.hh" 46 44 47 TimeStepAction::TimeStepAction() : G4UserTimeS 45 TimeStepAction::TimeStepAction() : G4UserTimeStepAction() 48 { 46 { 49 /** 47 /** 50 * Give to G4ITTimeStepper the user defined 48 * Give to G4ITTimeStepper the user defined time steps 51 * eg : from 1 picosecond to 10 picosecond, 49 * eg : from 1 picosecond to 10 picosecond, the minimum time 52 * step that the TimeStepper can returned is 50 * step that the TimeStepper can returned is 0.1 picosecond. 53 * Those time steps are used for the chemist 51 * Those time steps are used for the chemistry of G4DNA 54 */ 52 */ 55 53 56 AddTimeStep(1 * picosecond, 0.1 * picosecond << 54 AddTimeStep(1*picosecond, 0.1*picosecond); 57 AddTimeStep(10 * picosecond, 1 * picosecond) << 55 AddTimeStep(10*picosecond, 1*picosecond); 58 AddTimeStep(100 * picosecond, 3 * picosecond << 56 AddTimeStep(100*picosecond, 3*picosecond); 59 AddTimeStep(1000 * picosecond, 10 * picoseco << 57 AddTimeStep(1000*picosecond, 10*picosecond); 60 AddTimeStep(10000 * picosecond, 100 * picose << 58 AddTimeStep(10000*picosecond, 100*picosecond); 61 } 59 } 62 60 63 //....oooOO0OOooo........oooOO0OOooo........oo 61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 64 62 65 void TimeStepAction::UserPostTimeStepAction() << 63 TimeStepAction::~TimeStepAction() 66 { 64 { 67 if (G4Scheduler::Instance()->GetGlobalTime() << 65 //dtor 68 G4cout << "_________________" << G4endl; << 66 } 69 G4cout << "At : " << G4BestUnit(G4Schedule << 70 67 71 auto species = G4MoleculeTable::Instance() << 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 PrintSpecieInfo(species); << 69 73 } << 70 TimeStepAction::TimeStepAction(const TimeStepAction& other) : >> 71 G4UserTimeStepAction(other) >> 72 { >> 73 //copy ctor 74 } 74 } 75 75 76 //....oooOO0OOooo........oooOO0OOooo........oo 76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 77 78 void TimeStepAction::UserReactionAction(const << 78 TimeStepAction& 79 const << 79 TimeStepAction::operator=(const TimeStepAction& rhs) 80 { 80 { 81 // this function shows how to get species ID << 81 if (this == &rhs) return *this; // handle self assignment 82 G4cout << G4endl; << 82 //assignment operator >> 83 return *this; >> 84 } 83 85 84 G4cout << "At : " << G4Scheduler::Instance() << 86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 85 << " (ns) reactantA = " << GetMolecul << 87 86 << " (ID number = " << reactantA.GetT << 88 void TimeStepAction::UserPostTimeStepAction() 87 << " at position : " << reactantA.Get << 89 { 88 << " reacts with reactantB = " << Get << 90 // G4cout << "_________________" << G4endl; 89 << " (ID number = " << reactantB.GetT << 91 /* 90 << " at position : " << reactantA.Get << 92 G4cout << "Time Step : " 91 << 93 << G4BestUnit(G4ITScheduler::Instance()->GetTimeStep(), 92 if (products) { << 94 "Time") 93 auto nbProducts = (G4int)products->size(); << 95 << G4endl; 94 for (G4int i = 0; i < nbProducts; i++) { << 96 95 G4cout << " creating product " << i << 97 G4cout << "End of step: " 96 << " position : " << (*products)[ << 98 << G4BestUnit(G4ITScheduler::Instance()->GetGlobalTime(), 97 } << 99 "Time") 98 } << 100 << G4endl; 99 G4cout << G4endl; << 101 */ 100 } 102 } 101 103 102 void TimeStepAction::PrintSpecieInfo(G4Molecul << 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 105 >> 106 void TimeStepAction::UserReactionAction(const G4Track&, >> 107 const G4Track&, >> 108 const std::vector<G4Track*>* /*products*/) 103 { 109 { 104 // this function shows how to get a specific << 110 /* 105 auto moleculeID = molconf->GetMoleculeID(); << 111 for (int i = 0 ; i < nbProducts ; i ++) 106 const G4String& moleculeName = molconf->GetF << 112 { 107 G4cout << "Get inf of : " << moleculeName << << 113 G4cout << "Product[" << i << "] : " 108 auto trackList = G4ITTrackHolder::Instance() << 114 << GetMolecule(products[i])->GetName() 109 << 115 << G4endl ; 110 if (trackList == nullptr) { << 111 G4cout << "No species" << G4endl; << 112 return; << 113 } << 114 G4TrackList::iterator it = trackList->begin( << 115 G4TrackList::iterator end = trackList->end() << 116 for (; it != end; ++it) { << 117 auto track = *it; << 118 G4cout << "TrackID: " << track->GetTrackID << 119 << G4endl; << 120 } 116 } >> 117 */ 121 } 118 } 122 119