![]() |
|
|||
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.cc 0035 /// \brief Implementation of the TimeStepAction class 0036 0037 #include "TimeStepAction.hh" 0038 0039 #include "G4SystemOfUnits.hh" 0040 #include "G4UnitsTable.hh" 0041 // #include "G4ITScheduler.hh" 0042 // #include "G4Molecule.hh" 0043 0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0045 0046 TimeStepAction::TimeStepAction() : G4UserTimeStepAction() 0047 { 0048 /** 0049 * Inform G4ITTimeStepper of the selected minimum time steps 0050 * eg : from 1 picosecond to 10 picosecond, the minimum time 0051 * step that the TimeStepper can returned is 0.1 picosecond. 0052 * 0053 * Case 1) If the rection model calculates a minimum reaction time 0054 * bigger than the user defined time step, the reaction model wins 0055 * 0056 * Case 2) If an interaction process with the continuous medium 0057 * calculates a time step less than the selected minimum time step, 0058 * the interaction process wins 0059 */ 0060 0061 AddTimeStep(1 * picosecond, 0.1 * picosecond); 0062 AddTimeStep(10 * picosecond, 1 * picosecond); 0063 AddTimeStep(100 * picosecond, 10 * picosecond); 0064 AddTimeStep(1000 * picosecond, 100 * picosecond); 0065 AddTimeStep(10000 * picosecond, 1000 * picosecond); 0066 } 0067 0068 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0069 0070 TimeStepAction::~TimeStepAction() {} 0071 0072 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0073 0074 TimeStepAction::TimeStepAction(const TimeStepAction& other) : G4UserTimeStepAction(other) {} 0075 0076 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 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::StartProcessing() 0087 { 0088 // You want to know why the simulation stopped ? 0089 // G4ITScheduler::Instance()->WhyDoYouStop(); 0090 // At the end of the simulation, information will be printed 0091 // It is better to place this command before the simulation starts 0092 } 0093 0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0095 0096 void TimeStepAction::UserPreTimeStepAction() {} 0097 0098 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0099 0100 void TimeStepAction::UserPostTimeStepAction() {} 0101 0102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0103 0104 // Here you can retrieve information related to reactions 0105 void TimeStepAction::UserReactionAction(const G4Track& /*a*/, const G4Track& /*b*/, 0106 const std::vector<G4Track*>* /*products*/) 0107 { 0108 // Example to display reactions with product 0109 // S. Incerti, H. Tran 0110 // 2019/01/24 0111 0112 /* 0113 if (products) 0114 { 0115 G4cout << G4endl; 0116 G4int nbProducts = products->size(); 0117 for (int i = 0 ; i < nbProducts ; i ++) 0118 { 0119 G4cout << "-> A = " 0120 << GetMolecule(&a)->GetName() << " (TrackID=" << a.GetTrackID() << ")" 0121 << " reacts with B = " 0122 << GetMolecule(&b)->GetName() << " (TrackID=" << b.GetTrackID() << ")" 0123 << " creating product " << i+1 << " =" 0124 << GetMolecule((*products)[i])->GetName() 0125 << G4endl ; 0126 0127 G4cout 0128 <<" A position: x(nm)="<<a.GetPosition().getX()/nm 0129 <<" y(nm)="<<a.GetPosition().getY()/nm 0130 <<" z(nm)="<<a.GetPosition().getZ()/nm 0131 <<G4endl; 0132 0133 G4cout 0134 <<" B position: x(nm)="<<b.GetPosition().getX()/nm 0135 <<" y(nm)="<<b.GetPosition().getY()/nm 0136 <<" z(nm)="<<b.GetPosition().getZ()/nm 0137 <<G4endl; 0138 0139 G4cout 0140 <<" Product " << i+1 << "position: x(nm)="<<(*products)[i]->GetPosition().getX()/nm 0141 <<" y(nm)="<<a.GetPosition().getY()/nm 0142 <<" z(nm)="<<a.GetPosition().getZ()/nm 0143 <<G4endl; 0144 } 0145 } 0146 0147 else 0148 0149 { 0150 G4cout << G4endl; 0151 G4cout << "-> A = " 0152 << GetMolecule(&a)->GetName() << " (TrackID=" << a.GetTrackID() << ")" 0153 << " reacts with B = " 0154 << GetMolecule(&b)->GetName() << " (TrackID=" << b.GetTrackID() << ")" 0155 << G4endl ; 0156 0157 G4cout 0158 <<" A position: x(nm)="<<a.GetPosition().getX()/nm 0159 <<" y(nm)="<<a.GetPosition().getY()/nm 0160 <<" z(nm)="<<a.GetPosition().getZ()/nm 0161 <<G4endl; 0162 0163 G4cout 0164 <<" B position: x(nm)="<<b.GetPosition().getX()/nm 0165 <<" y(nm)="<<b.GetPosition().getY()/nm 0166 <<" z(nm)="<<b.GetPosition().getZ()/nm 0167 <<G4endl; 0168 0169 } 0170 */ 0171 } 0172 0173 void TimeStepAction::EndProcessing() {}
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |