00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id: G4StepLimiter.cc 69887 2013-05-17 08:17:02Z gcosmo $ 00028 // 00029 // -------------------------------------------------------------- 00030 // History 00031 // 00032 // 23-01-04 first implementation (H.Kurashige) 00033 // -------------------------------------------------------------- 00034 00035 #include "G4StepLimiter.hh" 00036 #include "G4TransportationProcessType.hh" 00037 00038 #include "G4Step.hh" 00039 #include "G4UserLimits.hh" 00040 #include "G4VParticleChange.hh" 00041 00042 00044 G4StepLimiter::G4StepLimiter(const G4String& aName) 00045 : G4VProcess(aName, fGeneral ) 00046 { 00047 // set Process Sub Type 00048 SetProcessSubType(static_cast<int>(STEP_LIMITER)); 00049 00050 if (verboseLevel>1) { 00051 G4cout << GetProcessName() << " is created "<< G4endl; 00052 } 00053 } 00054 00055 00057 G4StepLimiter::~G4StepLimiter() 00058 { 00059 } 00060 00061 00063 G4StepLimiter::G4StepLimiter(G4StepLimiter& right) 00064 : G4VProcess(right) 00065 { 00066 } 00067 00068 00070 G4double 00071 G4StepLimiter::PostStepGetPhysicalInteractionLength( 00072 const G4Track& aTrack, 00073 G4double, // previousStepSize 00074 G4ForceCondition* condition ) 00075 { 00076 // condition is set to "Not Forced" 00077 *condition = NotForced; 00078 00079 G4double proposedStep = DBL_MAX; 00080 G4UserLimits* pUserLimits = 00081 aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits(); 00082 if (pUserLimits) { 00083 // max allowed step length 00084 // 00085 proposedStep = pUserLimits->GetMaxAllowedStep(aTrack); 00086 if (proposedStep < 0.) proposedStep =0.; 00087 } 00088 return proposedStep; 00089 } 00090 00092 G4VParticleChange* 00093 G4StepLimiter::PostStepDoIt( const G4Track& aTrack, 00094 const G4Step& ) 00095 // Do Nothing 00096 // 00097 { 00098 aParticleChange.Initialize(aTrack); 00099 return &aParticleChange; 00100 } 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113