Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // This example is provided by the Geant4-DNA 27 // Any report or published results obtained us 28 // and the DNA geometry given in the Geom_DNA 29 // shall cite the following Geant4-DNA collabo 30 // [1] NIM B 298 (2013) 47-54 31 // [2] Med. Phys. 37 (2010) 4692-4708 32 // The Geant4-DNA web site is available at htt 33 // 34 //....oooOO0OOooo........oooOO0OOooo........oo 35 /// \file SteppingAction.cc 36 /// \brief Implementation of the SteppingActio 37 38 #include "SteppingAction.hh" 39 40 // G4 41 #include "CommandLineParser.hh" 42 43 #include "G4AnalysisManager.hh" 44 45 #include <G4SystemOfUnits.hh> 46 #include <G4Track.hh> 47 #include <G4VProcess.hh> 48 #include <globals.hh> 49 50 using namespace G4DNAPARSER; 51 52 //....oooOO0OOooo........oooOO0OOooo........oo 53 54 SteppingAction::SteppingAction() : G4UserStepp 55 56 //....oooOO0OOooo........oooOO0OOooo........oo 57 58 SteppingAction::~SteppingAction() {} 59 60 //....oooOO0OOooo........oooOO0OOooo........oo 61 62 void SteppingAction::UserSteppingAction(const 63 { 64 G4double flagParticle = 0.; 65 G4double flagProcess = 0.; 66 G4double flagVolume = 0.; 67 G4double x, y, z, xp, yp, zp; 68 G4double dE; 69 70 dE = step->GetTotalEnergyDeposit() / eV; 71 72 const G4String& particleName = 73 step->GetTrack()->GetDynamicParticle()->Ge 74 75 const G4String& processName = step->GetPostS 76 77 const G4String& volumeName = step->GetPreSte 78 79 if (particleName == "e-") 80 flagParticle = 10; 81 else if (particleName == "proton") 82 flagParticle = 20; 83 else if (particleName == "hydrogen") 84 flagParticle = 30; 85 else if (particleName == "alpha") 86 flagParticle = 40; 87 else if (particleName == "alpha+") 88 flagParticle = 50; 89 else if (particleName == "helium") 90 flagParticle = 60; 91 92 if (processName == "e-_G4DNAElastic") 93 flagProcess = 11; 94 else if (processName == "e-_G4DNAExcitation" 95 flagProcess = 12; 96 else if (processName == "e-_G4DNAIonisation" 97 flagProcess = 13; 98 else if (processName == "e-_G4DNAAttachment" 99 flagProcess = 14; 100 else if (processName == "e-_G4DNAVibExcitati 101 flagProcess = 15; 102 else if (processName == "eCapture") 103 flagProcess = 16; 104 // if (step->GetPostStepPoint()->GetProcess 105 // ->GetProcessName()=="msc") flagPro 106 107 else if (processName == "proton_G4DNAExcitat 108 flagProcess = 21; 109 else if (processName == "proton_G4DNAIonisat 110 flagProcess = 22; 111 else if (processName == "proton_G4DNAChargeD 112 flagProcess = 23; 113 114 else if (processName == "hydrogen_G4DNAExcit 115 flagProcess = 31; 116 else if (processName == "hydrogen_G4DNAIonis 117 flagProcess = 32; 118 else if (processName == "hydrogen_G4DNACharg 119 flagProcess = 33; 120 121 else if (processName == "alpha_G4DNAExcitati 122 flagProcess = 41; 123 else if (processName == "alpha_G4DNAIonisati 124 flagProcess = 42; 125 else if (processName == "alpha_G4DNAChargeDe 126 flagProcess = 43; 127 128 else if (processName == "alpha+_G4DNAExcitat 129 flagProcess = 51; 130 else if (processName == "alpha+_G4DNAIonisat 131 flagProcess = 52; 132 else if (processName == "alpha+_G4DNAChargeD 133 flagProcess = 53; 134 else if (processName == "alpha+_G4DNAChargeI 135 flagProcess = 54; 136 137 else if (processName == "helium_G4DNAExcitat 138 flagProcess = 61; 139 else if (processName == "helium_G4DNAIonisat 140 flagProcess = 62; 141 else if (processName == "helium_G4DNAChargeI 142 flagProcess = 63; 143 144 // if (step->GetPreStepPoint()->GetProcessDe 145 // GetProcessName()=="hIoni") flagPr 146 // if (step->GetPreStepPoint()->GetProcessDe 147 // GetProcessName()=="eIoni") flagPr 148 149 if (volumeName == "physi sugar 2") 150 flagVolume = 1; 151 else if (volumeName == "physi sugar 4") 152 flagVolume = 2; 153 154 if (flagVolume != 0 && dE != 0) { 155 x = step->GetPreStepPoint()->GetPosition() 156 y = step->GetPreStepPoint()->GetPosition() 157 z = step->GetPreStepPoint()->GetPosition() 158 xp = step->GetPostStepPoint()->GetPosition 159 yp = step->GetPostStepPoint()->GetPosition 160 zp = step->GetPostStepPoint()->GetPosition 161 162 // The lines below could be put upper to g 163 // Added here for testing that all the ret 164 // correctly working 165 CommandLineParser* parser = CommandLinePar 166 Command* command(0); 167 if ((command = parser->GetCommandIfActive( 168 169 // get analysis manager 170 G4AnalysisManager* analysisManager = G4Ana 171 172 analysisManager->FillNtupleDColumn(0, flag 173 analysisManager->FillNtupleDColumn(1, flag 174 analysisManager->FillNtupleDColumn(2, flag 175 analysisManager->FillNtupleDColumn(3, xp); 176 analysisManager->FillNtupleDColumn(4, yp); 177 analysisManager->FillNtupleDColumn(5, zp); 178 analysisManager->FillNtupleDColumn(6, dE); 179 analysisManager->FillNtupleDColumn( 180 7, std::sqrt((x - xp) * (x - xp) + (y - 181 182 analysisManager->AddNtupleRow(); 183 } 184 } 185