Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DMXMinEkineCuts.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: DMXMinEkineCuts.cc 67055 2013-01-30 09:39:20Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------
31 // GEANT 4 class implementation file
32 //
33 // History: first implementation, based on object model of
34 // 2nd December 1995, G.Cosmo
35 // --------------------------------------------------------------
36 // 15 April 1998 M.Maire
37 // --------------------------------------------------------------
38 
39 #include "DMXMinEkineCuts.hh"
40 
41 #include "G4Step.hh"
42 #include "G4UserLimits.hh"
43 #include "G4VParticleChange.hh"
44 #include "G4EnergyLossTables.hh"
45 
47  : DMXSpecialCuts(aName)
48 {
49  if (verboseLevel>1) {
50  G4cout << GetProcessName() << " is created "<< G4endl;
51  }
53 }
54 
56 {}
57 
59  : DMXSpecialCuts()
60 {}
61 
62 
64  const G4Track& aTrack,
65  G4double ,
67  )
68 {
69  // condition is set to "Not Forced"
70  *condition = NotForced;
71 
72  G4double proposedStep = DBL_MAX;
73  // get the pointer to UserLimits
74  G4UserLimits* pUserLimits = aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits();
75  const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
76  G4ParticleDefinition* aParticleDef = aTrack.GetDefinition();
77 
78  if (pUserLimits && aParticleDef->GetPDGCharge() != 0.0) {
79  //min kinetic energy
80  G4double temp = DBL_MAX;
81  G4double eKine = aParticle->GetKineticEnergy();
82  const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
83  G4double eMin = pUserLimits->GetUserMinEkine(aTrack);
84 
85  G4double rangeNow = DBL_MAX;
86 
87  rangeNow = G4EnergyLossTables::GetRange(aParticleDef,eKine,couple);
88 
89  if (eKine < eMin ) {
90  proposedStep = 0.;
91  } else {
92  // charged particles only
93  G4double rangeMin = G4EnergyLossTables::GetRange(aParticleDef,eMin,couple);
94  temp = rangeNow - rangeMin;
95  if (proposedStep > temp) proposedStep = temp;
96  }
97  }
98  return proposedStep;
99 }