|
|
|||
File indexing completed on 2026-04-06 16:43:20
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 /// \file ActionInitialization.cc 0027 /// \brief Implementation of the ActionInitialization class 0028 0029 // This example is provided by the Geant4-DNA collaboration 0030 // Any report or published results obtained using the Geant4-DNA software 0031 // shall cite the following Geant4-DNA collaboration publication: 0032 // Med. Phys. 37 (2010) 4692-4708 0033 // and papers 0034 // M. Batmunkh et al. J Radiat Res Appl Sci 8 (2015) 498-507 0035 // O. Belov et al. Physica Medica 32 (2016) 1510-1520 0036 // The Geant4-DNA web site is available at http://geant4-dna.org 0037 // 0038 // ------------------------------------------------------------------- 0039 // November 2016 0040 // ------------------------------------------------------------------- 0041 // 0042 0043 #include "ActionInitialization.hh" 0044 0045 #include "DetectorConstruction.hh" 0046 #include "EventAction.hh" 0047 #include "PrimaryGeneratorAction.hh" 0048 #include "RunAction.hh" 0049 #include "SteppingAction.hh" 0050 #include "TrackingAction.hh" 0051 0052 #include "G4RunManager.hh" 0053 // added for chemistry 0054 #include "DetectorConstruction.hh" 0055 #include "ITSteppingAction.hh" 0056 #include "ITTrackingAction.hh" 0057 #include "ITTrackingInteractivity.hh" 0058 #include "StackingAction.hh" 0059 #include "TimeStepAction.hh" 0060 0061 #include "G4DNAChemistryManager.hh" 0062 #include "G4Scheduler.hh" 0063 #include "G4SystemOfUnits.hh" 0064 #include "G4Threading.hh" 0065 #include "G4UnitsTable.hh" 0066 0067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0068 0069 ActionInitialization::ActionInitialization(DetectorConstruction* detector) 0070 : G4VUserActionInitialization(), fDetector(detector) 0071 {} 0072 0073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0074 0075 ActionInitialization::~ActionInitialization() {} 0076 0077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0078 0079 void ActionInitialization::BuildForMaster() const 0080 { 0081 // In MT mode, to be clearer, the RunAction class for the master thread might 0082 // be different than the one used for the workers. 0083 // This RunAction will be called before and after starting the 0084 // workers. 0085 // For more details, please refer to : 0086 // https://twiki.cern.ch/twiki/bin/view/Geant4/Geant4MTForApplicationDevelopers 0087 // 0088 0089 SetUserAction(new RunAction(fDetector, 0)); 0090 } 0091 0092 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0093 0094 void ActionInitialization::Build() const 0095 { 0096 // G4cout << "Build for = " 0097 // << G4RunManager::GetRunManager()->GetRunManagerType() 0098 // << G4endl; 0099 0100 PrimaryGeneratorAction* kinematics = new PrimaryGeneratorAction(); 0101 SetUserAction(kinematics); 0102 0103 TrackingAction* trackingAction = new TrackingAction(); 0104 SetUserAction(trackingAction); 0105 0106 RunAction* runAction = new RunAction(fDetector, kinematics); 0107 SetUserAction(runAction); 0108 0109 SetUserAction(new SteppingAction(runAction)); 0110 SetUserAction(new EventAction(runAction)); 0111 // added 0112 SetUserAction(new StackingAction()); 0113 0114 // chemistry part 0115 if (G4DNAChemistryManager::IsActivated()) { 0116 G4Scheduler::Instance()->SetUserAction(new TimeStepAction()); 0117 0118 // Uncomment and set to stop chemistry stage after: 0119 // ...given number of time steps 0120 // G4Scheduler::Instance()->SetMaxNbSteps(1000); 0121 0122 // ...OR reaching this time 0123 G4Scheduler::Instance()->SetEndTime(0.01 * nanosecond); // default: 10 ps 0124 0125 G4Scheduler::Instance()->SetVerbose(1); // default: 1-print reactions; 0126 0127 ITTrackingInteractivity* itInteractivity = new ITTrackingInteractivity(); 0128 itInteractivity->SetUserAction(new ITSteppingAction); 0129 itInteractivity->SetUserAction(new ITTrackingAction); 0130 G4Scheduler::Instance()->SetInteractivity(itInteractivity); 0131 } 0132 /* 0133 // To output the pre-chemical stage 0134 // 0135 G4String fileName ("output"); 0136 0137 if(G4RunManager::GetRunManager()->GetRunManagerType() == 0138 G4RunManager::sequentialRM) 0139 { 0140 // write initial situation at 1 picosecond 0141 G4DNAChemistryManager::Instance()->WriteInto(fileName + ".txt"); 0142 } 0143 else 0144 { 0145 G4int id = G4Threading::G4GetThreadId(); 0146 0147 G4String fileName_mt = fileName; 0148 fileName_mt += G4UIcommand::ConvertToString(id); 0149 fileName_mt += ".txt"; 0150 0151 G4cout << "chosen file name : " << fileName_mt << G4endl; 0152 0153 G4DNAChemistryManager::Instance()->WriteInto(fileName_mt); 0154 } 0155 */ 0156 } 0157 0158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|