Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: DMXMinEkineCuts.cc,v 1.4 2003/12/02 16:59:48 gcosmo Exp $ >> 25 // GEANT4 tag $Name: geant4-07-01 $ 27 // 26 // 28 // 27 // 29 // ------------------------------------------- 28 // -------------------------------------------------------------- 30 // GEANT 4 class implementation file 29 // GEANT 4 class implementation file 31 // 30 // 32 // History: first implementation, based on ob 31 // History: first implementation, based on object model of 33 // 2nd December 1995, G.Cosmo 32 // 2nd December 1995, G.Cosmo 34 // ------------------------------------------- 33 // -------------------------------------------------------------- 35 // 15 April 1998 M.Maire 34 // 15 April 1998 M.Maire 36 // ------------------------------------------- 35 // -------------------------------------------------------------- 37 36 38 #include "DMXMinEkineCuts.hh" 37 #include "DMXMinEkineCuts.hh" 39 38 40 #include "G4Step.hh" 39 #include "G4Step.hh" 41 #include "G4UserLimits.hh" 40 #include "G4UserLimits.hh" 42 #include "G4VParticleChange.hh" 41 #include "G4VParticleChange.hh" 43 #include "G4LossTableManager.hh" << 42 #include "G4EnergyLossTables.hh" 44 43 45 DMXMinEkineCuts::DMXMinEkineCuts(const G4Strin 44 DMXMinEkineCuts::DMXMinEkineCuts(const G4String& aName) 46 : DMXSpecialCuts(aName) 45 : DMXSpecialCuts(aName) 47 { 46 { 48 if (verboseLevel>1) { << 47 if (verboseLevel>1) { 49 G4cout << GetProcessName() << " is created << 48 G4cout << GetProcessName() << " is created "<< G4endl; 50 } 49 } 51 SetProcessType(fUserDefined); << 50 SetProcessType(fUserDefined); 52 } 51 } 53 52 54 DMXMinEkineCuts::~DMXMinEkineCuts() 53 DMXMinEkineCuts::~DMXMinEkineCuts() 55 {} 54 {} 56 55 57 DMXMinEkineCuts::DMXMinEkineCuts(DMXMinEkineCu 56 DMXMinEkineCuts::DMXMinEkineCuts(DMXMinEkineCuts&) 58 : DMXSpecialCuts() 57 : DMXSpecialCuts() 59 {} 58 {} 60 59 61 60 62 G4double DMXMinEkineCuts::PostStepGetPhysicalI 61 G4double DMXMinEkineCuts::PostStepGetPhysicalInteractionLength( 63 const G4Track& aT 62 const G4Track& aTrack, 64 G4double , 63 G4double , 65 G4ForceCondition* condition) << 64 G4ForceCondition* condition >> 65 ) 66 { 66 { 67 // condition is set to "Not Forced" 67 // condition is set to "Not Forced" 68 *condition = NotForced; 68 *condition = NotForced; >> 69 >> 70 G4double proposedStep = DBL_MAX; >> 71 // get the pointer to UserLimits >> 72 G4UserLimits* pUserLimits = aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits(); >> 73 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle(); >> 74 G4ParticleDefinition* aParticleDef = aTrack.GetDefinition(); 69 75 70 G4double proposedStep = DBL_MAX; << 76 if (pUserLimits && aParticleDef->GetPDGCharge() != 0.0) { 71 // get the pointer to UserLimits << 77 //min kinetic energy 72 G4UserLimits* pUserLimits = aTrack.GetVolume << 78 G4double temp = DBL_MAX; 73 const G4DynamicParticle* aParticle = aTrack. << 79 G4double eKine = aParticle->GetKineticEnergy(); 74 G4ParticleDefinition* aParticleDef = aTrack. << 80 const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple(); 75 << 81 G4double eMin = pUserLimits->GetUserMinEkine(aTrack); 76 if (pUserLimits && aParticleDef->GetPDGCharg << 82 77 //min kinetic energy << 83 G4double rangeNow = DBL_MAX; 78 G4double temp = DBL_MAX; << 84 79 G4double eKine = aParticle->GetKine << 85 rangeNow = G4EnergyLossTables::GetRange(aParticleDef,eKine,couple); 80 const G4MaterialCutsCouple* couple = aTrac << 86 81 G4double eMin = pUserLimits->GetUserMinEki << 87 if (eKine < eMin ) { 82 << 88 proposedStep = 0.; 83 if (eKine < eMin) << 89 } else { 84 return 0.; << 90 // charged particles only 85 << 91 G4double rangeMin = G4EnergyLossTables::GetRange(aParticleDef,eMin,couple); 86 G4double rangeNow = DBL_MAX; << 92 temp = rangeNow - rangeMin; 87 << 93 if (proposedStep > temp) proposedStep = temp; 88 G4LossTableManager* lossManager = G4LossTa << 94 } 89 rangeNow = lossManager->GetRange(aParticle << 95 } 90 << 96 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 } 97 } 98 98