Warning, file /geant4/examples/advanced/underground_physics/src/DMXMinEkineCuts.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 
0017 
0018 
0019 
0020 
0021 
0022 
0023 
0024 
0025 
0026 
0027 
0028 
0029 
0030 
0031 
0032 
0033 
0034 
0035 
0036 
0037 
0038 #include "DMXMinEkineCuts.hh"
0039 
0040 #include "G4Step.hh"
0041 #include "G4UserLimits.hh"
0042 #include "G4VParticleChange.hh"
0043 #include "G4LossTableManager.hh"
0044 
0045 DMXMinEkineCuts::DMXMinEkineCuts(const G4String& aName)
0046   : DMXSpecialCuts(aName)
0047 {
0048     if (verboseLevel>1) {
0049     G4cout << GetProcessName() << " is created "<< G4endl;
0050    }
0051   SetProcessType(fUserDefined);
0052 }
0053 
0054 DMXMinEkineCuts::~DMXMinEkineCuts()
0055 {}
0056 
0057 DMXMinEkineCuts::DMXMinEkineCuts(DMXMinEkineCuts&)
0058   : DMXSpecialCuts()
0059 {}
0060 
0061 
0062 G4double DMXMinEkineCuts::PostStepGetPhysicalInteractionLength(
0063                              const G4Track& aTrack,
0064                  G4double ,
0065                  G4ForceCondition* condition)
0066 {
0067   
0068   *condition = NotForced;
0069   
0070   G4double     proposedStep = DBL_MAX;
0071   
0072   G4UserLimits* pUserLimits = aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits();
0073   const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
0074   G4ParticleDefinition* aParticleDef = aTrack.GetDefinition();
0075   
0076   if (pUserLimits && aParticleDef->GetPDGCharge() != 0.0) {
0077     
0078     G4double temp = DBL_MAX;
0079     G4double    eKine     = aParticle->GetKineticEnergy();
0080     const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
0081     G4double eMin = pUserLimits->GetUserMinEkine(aTrack);
0082 
0083     if (eKine < eMin)
0084       return 0.;
0085 
0086     G4double    rangeNow = DBL_MAX;
0087       
0088     G4LossTableManager* lossManager = G4LossTableManager::Instance();
0089     rangeNow = lossManager->GetRange(aParticleDef,eKine,couple);
0090 
0091     
0092     G4double rangeMin = lossManager->GetRange(aParticleDef,eMin,couple); 
0093     temp = rangeNow - rangeMin;
0094     if (proposedStep > temp) proposedStep = temp;  
0095   }
0096   return proposedStep;
0097 }