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 // $Id: DMXMinEkineCuts.cc,v 1.6 2006/06/29 16:26:39 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-09-03-patch-02 $ 27 // 29 // 28 // 30 // 29 // ------------------------------------------- 31 // -------------------------------------------------------------- 30 // GEANT 4 class implementation file 32 // GEANT 4 class implementation file 31 // 33 // 32 // History: first implementation, based on ob 34 // History: first implementation, based on object model of 33 // 2nd December 1995, G.Cosmo 35 // 2nd December 1995, G.Cosmo 34 // ------------------------------------------- 36 // -------------------------------------------------------------- 35 // 15 April 1998 M.Maire 37 // 15 April 1998 M.Maire 36 // ------------------------------------------- 38 // -------------------------------------------------------------- 37 39 38 #include "DMXMinEkineCuts.hh" 40 #include "DMXMinEkineCuts.hh" 39 41 40 #include "G4Step.hh" 42 #include "G4Step.hh" 41 #include "G4UserLimits.hh" 43 #include "G4UserLimits.hh" 42 #include "G4VParticleChange.hh" 44 #include "G4VParticleChange.hh" 43 #include "G4LossTableManager.hh" << 45 #include "G4EnergyLossTables.hh" 44 46 45 DMXMinEkineCuts::DMXMinEkineCuts(const G4Strin 47 DMXMinEkineCuts::DMXMinEkineCuts(const G4String& aName) 46 : DMXSpecialCuts(aName) 48 : DMXSpecialCuts(aName) 47 { 49 { 48 if (verboseLevel>1) { << 50 if (verboseLevel>1) { 49 G4cout << GetProcessName() << " is created << 51 G4cout << GetProcessName() << " is created "<< G4endl; 50 } 52 } 51 SetProcessType(fUserDefined); << 53 SetProcessType(fUserDefined); 52 } 54 } 53 55 54 DMXMinEkineCuts::~DMXMinEkineCuts() 56 DMXMinEkineCuts::~DMXMinEkineCuts() 55 {} 57 {} 56 58 57 DMXMinEkineCuts::DMXMinEkineCuts(DMXMinEkineCu 59 DMXMinEkineCuts::DMXMinEkineCuts(DMXMinEkineCuts&) 58 : DMXSpecialCuts() 60 : DMXSpecialCuts() 59 {} 61 {} 60 62 61 63 62 G4double DMXMinEkineCuts::PostStepGetPhysicalI 64 G4double DMXMinEkineCuts::PostStepGetPhysicalInteractionLength( 63 const G4Track& aT 65 const G4Track& aTrack, 64 G4double , 66 G4double , 65 G4ForceCondition* condition) << 67 G4ForceCondition* condition >> 68 ) 66 { 69 { 67 // condition is set to "Not Forced" 70 // condition is set to "Not Forced" 68 *condition = NotForced; 71 *condition = NotForced; >> 72 >> 73 G4double proposedStep = DBL_MAX; >> 74 // get the pointer to UserLimits >> 75 G4UserLimits* pUserLimits = aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits(); >> 76 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle(); >> 77 G4ParticleDefinition* aParticleDef = aTrack.GetDefinition(); 69 78 70 G4double proposedStep = DBL_MAX; << 79 if (pUserLimits && aParticleDef->GetPDGCharge() != 0.0) { 71 // get the pointer to UserLimits << 80 //min kinetic energy 72 G4UserLimits* pUserLimits = aTrack.GetVolume << 81 G4double temp = DBL_MAX; 73 const G4DynamicParticle* aParticle = aTrack. << 82 G4double eKine = aParticle->GetKineticEnergy(); 74 G4ParticleDefinition* aParticleDef = aTrack. << 83 const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple(); 75 << 84 G4double eMin = pUserLimits->GetUserMinEkine(aTrack); 76 if (pUserLimits && aParticleDef->GetPDGCharg << 85 77 //min kinetic energy << 86 G4double rangeNow = DBL_MAX; 78 G4double temp = DBL_MAX; << 87 79 G4double eKine = aParticle->GetKine << 88 rangeNow = G4EnergyLossTables::GetRange(aParticleDef,eKine,couple); 80 const G4MaterialCutsCouple* couple = aTrac << 89 81 G4double eMin = pUserLimits->GetUserMinEki << 90 if (eKine < eMin ) { 82 << 91 proposedStep = 0.; 83 if (eKine < eMin) << 92 } else { 84 return 0.; << 93 // charged particles only 85 << 94 G4double rangeMin = G4EnergyLossTables::GetRange(aParticleDef,eMin,couple); 86 G4double rangeNow = DBL_MAX; << 95 temp = rangeNow - rangeMin; 87 << 96 if (proposedStep > temp) proposedStep = temp; 88 G4LossTableManager* lossManager = G4LossTa << 97 } 89 rangeNow = lossManager->GetRange(aParticle << 98 } 90 << 99 return proposedStep; 91 // charged particles only << 92 G4double rangeMin = lossManager->GetRange( << 93 temp = rangeNow - rangeMin; << 94 if (proposedStep > temp) proposedStep = te << 95 } << 96 return proposedStep; << 97 } 100 } 98 101