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 // 26 // 27 // << 27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 28 // This example is provided by the Geant4-DNA << 28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 29 // Any report or published results obtained us << 29 30 // shall cite the following Geant4-DNA collabo << 31 // Med. Phys. 37 (2010) 4692-4708 << 32 // The Geant4-DNA web site is available at htt << 33 // << 34 // If you use this example, please cite the fo << 35 // Rad. Prot. Dos. 133 (2009) 2-11 << 36 // << 37 #include "StepMax.hh" 30 #include "StepMax.hh" 38 #include "PhysicsListMessenger.hh" 31 #include "PhysicsListMessenger.hh" 39 #include "G4VPhysicalVolume.hh" 32 #include "G4VPhysicalVolume.hh" 40 #include "G4TransportationProcessType.hh" 33 #include "G4TransportationProcessType.hh" 41 34 >> 35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 36 42 StepMax::StepMax(PhysicsListMessenger* mess) 37 StepMax::StepMax(PhysicsListMessenger* mess) 43 : G4VEmProcess("UserMaxStep", fGeneral),fMes 38 : G4VEmProcess("UserMaxStep", fGeneral),fMessenger(mess), 44 fMaxChargedStep(DBL_MAX),isInitialised(fal 39 fMaxChargedStep(DBL_MAX),isInitialised(false) 45 { 40 { 46 SetProcessSubType(static_cast<G4int>(STEP_LI 41 SetProcessSubType(static_cast<G4int>(STEP_LIMITER)); 47 } 42 } 48 43 >> 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 45 49 StepMax::~StepMax() 46 StepMax::~StepMax() 50 {} 47 {} 51 48 >> 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 50 52 G4bool StepMax::IsApplicable(const G4ParticleD 51 G4bool StepMax::IsApplicable(const G4ParticleDefinition& part) 53 { 52 { 54 return (part.GetPDGCharge() != 0. && !part.I 53 return (part.GetPDGCharge() != 0. && !part.IsShortLived()); 55 } 54 } 56 55 >> 56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 57 57 void StepMax::PreparePhysicsTable(const G4Part 58 void StepMax::PreparePhysicsTable(const G4ParticleDefinition&) 58 { 59 { 59 if(isInitialised) { 60 if(isInitialised) { 60 isInitialised = false; 61 isInitialised = false; 61 } 62 } 62 } 63 } 63 64 >> 65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 66 64 void StepMax::BuildPhysicsTable(const G4Partic 67 void StepMax::BuildPhysicsTable(const G4ParticleDefinition&) 65 { 68 { 66 if(!isInitialised) { 69 if(!isInitialised) { 67 fMaxChargedStep = fMessenger->GetMaxCharge 70 fMaxChargedStep = fMessenger->GetMaxChargedStep(); 68 isInitialised = true; 71 isInitialised = true; 69 if(fMaxChargedStep < DBL_MAX) { 72 if(fMaxChargedStep < DBL_MAX) { 70 G4cout << GetProcessName() << ": SubTyp 73 G4cout << GetProcessName() << ": SubType= " << GetProcessSubType() 71 << " Step limit(mm)= " << fMaxCh 74 << " Step limit(mm)= " << fMaxChargedStep << G4endl; 72 } 75 } 73 } 76 } 74 } 77 } 75 78 >> 79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 80 76 void StepMax::InitialiseProcess(const G4Partic 81 void StepMax::InitialiseProcess(const G4ParticleDefinition*) 77 {} 82 {} 78 83 >> 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 85 79 G4double 86 G4double 80 StepMax::PostStepGetPhysicalInteractionLength( 87 StepMax::PostStepGetPhysicalInteractionLength(const G4Track&, 81 88 G4double, 82 89 G4ForceCondition* condition) 83 { 90 { 84 // condition is set to "Not Forced" 91 // condition is set to "Not Forced" 85 *condition = NotForced; 92 *condition = NotForced; 86 return fMaxChargedStep; 93 return fMaxChargedStep; 87 } 94 } 88 95 >> 96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 97 89 G4VParticleChange* StepMax::PostStepDoIt(const 98 G4VParticleChange* StepMax::PostStepDoIt(const G4Track& aTrack, const G4Step&) 90 { 99 { 91 // do nothing 100 // do nothing 92 aParticleChange.Initialize(aTrack); 101 aParticleChange.Initialize(aTrack); 93 return &aParticleChange; 102 return &aParticleChange; 94 } 103 } 95 104 >> 105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 96 106 97 107