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 /// \file medical/dna/range/src/SteppingAction 26 /// \file medical/dna/range/src/SteppingAction.cc 27 /// \brief Implementation of the SteppingActio 27 /// \brief Implementation of the SteppingAction class 28 // 28 // 29 // $Id: SteppingAction.cc 78723 2014-01-20 10: 29 // $Id: SteppingAction.cc 78723 2014-01-20 10:32:17Z gcosmo $ 30 // 30 // 31 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 33 34 #include "SteppingAction.hh" 34 #include "SteppingAction.hh" 35 << 36 #include "DetectorConstruction.hh" 35 #include "DetectorConstruction.hh" 37 #include "HistoManager.hh" 36 #include "HistoManager.hh" 38 #include "Run.hh" 37 #include "Run.hh" 39 38 40 #include "G4Electron.hh" << 41 #include "G4RunManager.hh" 39 #include "G4RunManager.hh" >> 40 #include "G4Electron.hh" 42 41 43 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 43 45 SteppingAction::SteppingAction() : G4UserStepp << 44 SteppingAction::SteppingAction() >> 45 :G4UserSteppingAction(), >> 46 fpDetector(0), >> 47 fRNP(0),fRAbs(0) 46 { 48 { 47 fpDetector = dynamic_cast<const DetectorCons << 49 48 G4RunManager::GetRunManager()->GetUserDete << 50 fpDetector = 49 fRNP = fpDetector->GetNPRadius() / CLHEP::nm << 51 dynamic_cast<const DetectorConstruction*>(G4RunManager::GetRunManager() 50 fRAbs = fpDetector->GetAbsRadius() / CLHEP:: << 52 ->GetUserDetectorConstruction()); 51 fTrackCut = fpDetector->GetTrackingCut() / C << 53 fRNP = fpDetector->GetNPRadius() /CLHEP::nm; >> 54 fRAbs = fpDetector->GetAbsRadius() /CLHEP::nm; >> 55 fTrackCut = fpDetector->GetTrackingCut()/CLHEP::eV; >> 56 52 } 57 } 53 58 54 //....oooOO0OOooo........oooOO0OOooo........oo 59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 55 60 56 SteppingAction::~SteppingAction() {} << 61 SteppingAction::~SteppingAction() >> 62 { } 57 63 58 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 59 65 60 void SteppingAction::UserSteppingAction(const 66 void SteppingAction::UserSteppingAction(const G4Step* aStep) 61 { 67 { 62 fpDetector = dynamic_cast<const DetectorCons << 63 G4RunManager::GetRunManager()->GetUserDete << 64 fRNP = fpDetector->GetNPRadius() / CLHEP::nm << 65 fRAbs = fpDetector->GetAbsRadius() / CLHEP:: << 66 fTrackCut = fpDetector->GetTrackingCut() / C << 67 << 68 G4ThreeVector pos = aStep->GetPreStepPoint() << 69 G4ThreeVector postpos = aStep->GetPostStepPo << 70 << 71 G4double R = pos.mag() / CLHEP::nm; << 72 << 73 if (fRNP < R) { << 74 G4AnalysisManager* analysisManager = G4Ana << 75 G4double energy = aStep->GetTotalEnergyDep << 76 analysisManager->FillH1(1, R, energy); << 77 } << 78 << 79 R = pos.mag() / CLHEP::nm; << 80 if (fRNP < R) { << 81 if (std::abs(pos.z()) < 10 * CLHEP::nm) { << 82 G4AnalysisManager* analysisManager = G4A << 83 G4double energy = aStep->GetTotalEnergyD << 84 G4double theta = std::atan2(pos.y(), pos << 85 if (0 <= theta) { << 86 analysisManager->FillH2(0, theta, R, e << 87 } << 88 else { << 89 analysisManager->FillH2(0, theta + 360 << 90 } << 91 } << 92 } << 93 68 94 if (aStep->GetPreStepPoint()->GetPhysicalVol << 69 fpDetector = 95 if (aStep->GetPostStepPoint()->GetStepStat << 70 dynamic_cast<const DetectorConstruction*>(G4RunManager::GetRunManager() 96 //*** WARNING: this line will kill all i << 71 ->GetUserDetectorConstruction()); 97 //*** at the end NP surface*** << 72 fRNP = fpDetector->GetNPRadius() /CLHEP::nm; 98 G4AnalysisManager* analysisManager = G4A << 73 fRAbs = fpDetector->GetAbsRadius() /CLHEP::nm; 99 G4Track* track = aStep->GetTrack(); << 74 fTrackCut = fpDetector->GetTrackingCut()/CLHEP::eV; 100 G4double trackE = track->GetKineticEnerg << 75 101 << 76 G4ThreeVector pos = aStep->GetPreStepPoint() ->GetPosition(); 102 if (aStep->GetTrack()->GetTrackID() == 1 << 77 G4ThreeVector postpos = aStep->GetPostStepPoint()->GetPosition(); 103 if (pos.x() < 0) { << 78 104 analysisManager->FillH1(8, trackE); << 79 G4double R = pos.mag ()/CLHEP::nm; 105 } << 80 106 else { << 81 if(fRNP<R){ 107 analysisManager->FillH1(9, trackE); << 82 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 108 } << 83 G4double energy = aStep->GetTotalEnergyDeposit()/CLHEP::joule; 109 aStep->GetTrack()->SetTrackStatus(fSto << 84 analysisManager->FillH1(1,R,energy); 110 } << 85 } 111 else { << 86 112 G4ThreeVector dir = aStep->GetPostStep << 87 R = pos.mag()/CLHEP::nm; 113 G4double dot = dir.dot(postpos); << 88 if(fRNP<R){ 114 if (dot < 0.0) { << 89 if(std::abs(pos.z())<10*CLHEP::nm){ 115 return; << 90 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 116 } << 91 G4double energy = aStep->GetTotalEnergyDeposit()/CLHEP::joule; 117 << 92 G4double theta = std::atan2(pos.y(),pos.x())/CLHEP::deg; 118 if (trackE < fTrackCut) { << 93 if(0<=theta){ >> 94 analysisManager->FillH2(0,theta,R,energy); >> 95 }else{ >> 96 analysisManager->FillH2(0,theta+360,R,energy); >> 97 } >> 98 } >> 99 } >> 100 >> 101 if( aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() >> 102 =="NanoParticle"){ >> 103 if( aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary){ >> 104 //*** WARNING: this line will kill all incident electrons >> 105 //*** at the end NP surface*** >> 106 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); >> 107 G4Track *track = aStep->GetTrack(); >> 108 G4double trackE = track->GetKineticEnergy()/CLHEP::eV; >> 109 >> 110 if(aStep->GetTrack()->GetTrackID() == 1 ){ >> 111 if(pos.x()<0){ >> 112 analysisManager->FillH1(8,trackE); >> 113 }else{ >> 114 analysisManager->FillH1(9,trackE); >> 115 } 119 aStep->GetTrack()->SetTrackStatus(fS 116 aStep->GetTrack()->SetTrackStatus(fStopAndKill); 120 return; << 121 } << 122 << 123 if (track->GetDefinition()->GetPDGChar << 124 analysisManager->FillH1(4, trackE); << 125 } 117 } 126 else { << 118 else{ 127 analysisManager->FillH1(5, trackE); << 119 G4ThreeVector dir = aStep->GetPostStepPoint()->GetMomentumDirection(); >> 120 G4double dot = dir.dot(postpos); >> 121 if(dot<0.0){return;} >> 122 >> 123 if(trackE<fTrackCut){ >> 124 aStep->GetTrack()->SetTrackStatus(fStopAndKill); >> 125 return; >> 126 } >> 127 >> 128 if(track->GetDefinition()->GetPDGCharge() != 0){ >> 129 analysisManager->FillH1(4,trackE); >> 130 }else { >> 131 analysisManager->FillH1(5,trackE); >> 132 } 128 } 133 } 129 } 134 } 130 } << 135 } 131 } << 132 } 136 } 133 137 134 //....oooOO0OOooo........oooOO0OOooo........oo 138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 135 139