![]() |
|
|||
File indexing completed on 2025-02-23 09:21:48
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // This example is provided by the Geant4-DNA collaboration 0027 // Any report or published results obtained using the Geant4-DNA software 0028 // shall cite the following Geant4-DNA collaboration publication: 0029 // Med. Phys. 37 (2010) 4692-4708 0030 // J. Comput. Phys. 274 (2014) 841-882 0031 // The Geant4-DNA web site is available at http://geant4-dna.org 0032 // 0033 // 0034 /// \file TimeStepAction.hh 0035 /// \brief Implementation of the TimeStepAction class 0036 0037 #include "TimeStepAction.hh" 0038 0039 #include "G4SystemOfUnits.hh" 0040 #include "G4UnitsTable.hh" 0041 0042 #include <G4Scheduler.hh> 0043 // #include "G4Molecule.hh" 0044 0045 TimeStepAction::TimeStepAction() : G4UserTimeStepAction() 0046 { 0047 /** 0048 * Give to G4ITTimeStepper the user defined time steps 0049 * eg : from 1 picosecond to 10 picosecond, the minimum time 0050 * step that the TimeStepper can returned is 0.1 picosecond. 0051 * Those time steps are used for the chemistry of G4DNA 0052 */ 0053 0054 AddTimeStep(1 * picosecond, 0.1 * picosecond); 0055 AddTimeStep(10 * picosecond, 1 * picosecond); 0056 AddTimeStep(100 * picosecond, 3 * picosecond); 0057 AddTimeStep(1000 * picosecond, 10 * picosecond); 0058 AddTimeStep(10000 * picosecond, 100 * picosecond); 0059 } 0060 0061 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0062 0063 TimeStepAction::~TimeStepAction() 0064 { 0065 // dtor 0066 } 0067 0068 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0069 0070 TimeStepAction::TimeStepAction(const TimeStepAction& other) : G4UserTimeStepAction(other) 0071 { 0072 // copy ctor 0073 } 0074 0075 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0076 0077 TimeStepAction& TimeStepAction::operator=(const TimeStepAction& rhs) 0078 { 0079 if (this == &rhs) return *this; // handle self assignment 0080 // assignment operator 0081 return *this; 0082 } 0083 0084 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0085 0086 void TimeStepAction::UserPostTimeStepAction() 0087 { 0088 // G4cout << "_________________" << G4endl; 0089 /* 0090 G4cout << "Time Step : " 0091 << G4BestUnit(G4ITScheduler::Instance()->GetTimeStep(), 0092 "Time") 0093 << G4endl; 0094 0095 G4cout << "End of step: " 0096 << G4BestUnit(G4ITScheduler::Instance()->GetGlobalTime(), 0097 "Time") 0098 << G4endl; 0099 */ 0100 } 0101 0102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0103 0104 void TimeStepAction::UserReactionAction(const G4Track& /*a*/, const G4Track& /*b*/, 0105 const std::vector<G4Track*>* /*products*/) 0106 { 0107 // Example to display reactions with product 0108 // S. Incerti, H. Tran 0109 // 2019/01/24 0110 0111 /* 0112 if (products) 0113 { 0114 G4cout << G4endl; 0115 G4int nbProducts = products->size(); 0116 for (int i = 0 ; i < nbProducts ; i ++) 0117 { 0118 G4cout << "-> A = " 0119 << GetMolecule(&a)->GetName() << " (TrackID=" << a.GetTrackID() << ")" 0120 << " reacts with B = " 0121 << GetMolecule(&b)->GetName() << " (TrackID=" << b.GetTrackID() << ")" 0122 << " creating product " << i+1 << " =" 0123 << GetMolecule((*products)[i])->GetName() 0124 << G4endl ; 0125 0126 G4cout 0127 <<" A position: x(nm)="<<a.GetPosition().getX()/nm 0128 <<" y(nm)="<<a.GetPosition().getY()/nm 0129 <<" z(nm)="<<a.GetPosition().getZ()/nm 0130 <<G4endl; 0131 0132 G4cout 0133 <<" B position: x(nm)="<<b.GetPosition().getX()/nm 0134 <<" y(nm)="<<b.GetPosition().getY()/nm 0135 <<" z(nm)="<<b.GetPosition().getZ()/nm 0136 <<G4endl; 0137 0138 G4cout 0139 <<" Product " << i+1 << "position: x(nm)="<<(*products)[i]->GetPosition().getX()/nm 0140 <<" y(nm)="<<a.GetPosition().getY()/nm 0141 <<" z(nm)="<<a.GetPosition().getZ()/nm 0142 <<G4endl; 0143 } 0144 } 0145 0146 else 0147 0148 { 0149 G4cout << G4endl; 0150 G4cout << "-> A = " 0151 << GetMolecule(&a)->GetName() << " (TrackID=" << a.GetTrackID() << ")" 0152 << " reacts with B = " 0153 << GetMolecule(&b)->GetName() << " (TrackID=" << b.GetTrackID() << ")" 0154 << G4endl ; 0155 0156 G4cout 0157 <<" A position: x(nm)="<<a.GetPosition().getX()/nm 0158 <<" y(nm)="<<a.GetPosition().getY()/nm 0159 <<" z(nm)="<<a.GetPosition().getZ()/nm 0160 <<G4endl; 0161 0162 G4cout 0163 <<" B position: x(nm)="<<b.GetPosition().getX()/nm 0164 <<" y(nm)="<<b.GetPosition().getY()/nm 0165 <<" z(nm)="<<b.GetPosition().getZ()/nm 0166 <<G4endl; 0167 0168 } 0169 */ 0170 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |