Geant4  10.02
G4VMscModel.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 // $Id: G4VMscModel.cc 92921 2015-09-21 15:06:51Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4VMscModel
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 07.03.2008
38 //
39 // Modifications:
40 //
41 //
42 // Class Description:
43 //
44 // General interface to msc models
45 
46 // -------------------------------------------------------------------
47 //
48 
49 #include "G4VMscModel.hh"
50 #include "G4SystemOfUnits.hh"
53 #include "G4LossTableBuilder.hh"
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59  G4VEmModel(nam),
60  safetyHelper(nullptr),
61  ionisation(nullptr),
62  facrange(0.04),
63  facgeom(2.5),
64  facsafety(0.3),
65  skin(1.0),
66  dtrl(0.05),
67  lambdalimit(mm),
68  geomMin(1.e-6*CLHEP::mm),
69  geomMax(1.e50*CLHEP::mm),
70  fDisplacement(0.,0.,0.),
71  steppingAlgorithm(fUseSafety),
72  samplez(false),
73  latDisplasment(true)
74 {
77  localtkin = 0.0;
79  currentPart = 0;
80 }
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85 {}
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88 
91 {
92  // recomputed for each new run
93  if(!safetyHelper) {
95  ->GetSafetyHelper();
97  }
98  G4ParticleChangeForMSC* change = nullptr;
99  if (pParticleChange) {
100  change = static_cast<G4ParticleChangeForMSC*>(pParticleChange);
101  } else {
102  change = new G4ParticleChangeForMSC();
103  }
104  if(p) {
105 
106  // table is never built for GenericIon
107  if(p->GetParticleName() == "GenericIon") {
108  if(xSectionTable) {
110  delete xSectionTable;
111  xSectionTable = nullptr;
112  }
113 
114  // table is always built for low mass particles
115  } else if(p->GetPDGMass() < 4.5*GeV || ForceBuildTableFlag()) {
116 
117  idxTable = 0;
118  G4LossTableBuilder* builder = man->GetTableBuilder();
119  if(IsMaster()) {
122  emin = std::max(emin, man->MinKinEnergy());
123  emax = std::min(emax, man->MaxKinEnergy());
124  if(emin < emax) {
125  xSectionTable = builder->BuildTableForModel(xSectionTable, this, p,
126  emin, emax, true);
127  }
128  }
129  theDensityFactor = builder->GetDensityFactors();
130  theDensityIdx = builder->GetCoupleIndexes();
131  }
132  }
133  return change;
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137 
140 {
141  return fDisplacement;
142 }
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145 
147 {
148  return DBL_MAX;
149 }
150 
151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
152 
154 {
155  return truePathLength;
156 }
157 
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
159 
161 {
162  return geomPathLength;
163 }
164 
165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
166 
167 void G4VMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
168  const G4MaterialCutsCouple*,
169  const G4DynamicParticle*,
171 {}
172 
173 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double LowEnergyActivationLimit() const
Definition: G4VEmModel.hh:655
G4double HighEnergyActivationLimit() const
Definition: G4VEmModel.hh:648
size_t idxTable
Definition: G4VEmModel.hh:426
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:641
static const G4double geomMin
static const double MeV
Definition: G4SIunits.hh:211
G4SafetyHelper * GetSafetyHelper() const
const std::vector< G4double > * GetDensityFactors()
void InitialiseHelper()
static G4LossTableManager * Instance()
static const double cm2
Definition: G4SIunits.hh:119
G4bool ForceBuildTableFlag() const
Definition: G4VEmModel.hh:690
CLHEP::Hep3Vector G4ThreeVector
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:634
G4PhysicsTable * BuildTableForModel(G4PhysicsTable *table, G4VEmModel *model, const G4ParticleDefinition *, G4double emin, G4double emax, G4bool spline)
G4double dedx
Definition: G4VMscModel.hh:171
G4bool IsMaster() const
Definition: G4VEmModel.hh:718
G4double localtkin
Definition: G4VMscModel.hh:172
const G4String & GetParticleName() const
G4LossTableBuilder * GetTableBuilder()
const std::vector< G4int > * theDensityIdx
Definition: G4VEmModel.hh:425
virtual G4double ComputeTrueStepLength(G4double geomPathLength)
Definition: G4VMscModel.cc:160
virtual G4double ComputeTruePathLengthLimit(const G4Track &track, G4double &stepLimit)
Definition: G4VMscModel.cc:146
G4double MinKinEnergy() const
G4ParticleChangeForMSC * GetParticleChangeForMSC(const G4ParticleDefinition *p=0)
Definition: G4VMscModel.cc:90
static const double GeV
Definition: G4SIunits.hh:214
G4ThreeVector fDisplacement
Definition: G4VMscModel.hh:186
const std::vector< G4double > * theDensityFactor
Definition: G4VEmModel.hh:424
G4double localrange
Definition: G4VMscModel.hh:173
static G4TransportationManager * GetTransportationManager()
static const G4double emax
const G4ParticleDefinition * currentPart
Definition: G4VMscModel.hh:168
G4double GetPDGMass() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double tmax)
Definition: G4VMscModel.cc:167
static const double g
Definition: G4SIunits.hh:180
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4VParticleChange * pParticleChange
Definition: G4VEmModel.hh:422
G4PhysicsTable * xSectionTable
Definition: G4VEmModel.hh:423
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83
G4VMscModel(const G4String &nam)
Definition: G4VMscModel.cc:58
G4double MaxKinEnergy() const
G4SafetyHelper * safetyHelper
Definition: G4VMscModel.hh:166
static const double mm
Definition: G4SIunits.hh:114
virtual G4double ComputeGeomPathLength(G4double truePathLength)
Definition: G4VMscModel.cc:153
void clearAndDestroy()
virtual ~G4VMscModel()
Definition: G4VMscModel.cc:84
G4LossTableManager * man
Definition: G4VMscModel.hh:169
const std::vector< G4int > * GetCoupleIndexes()
virtual G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety)
Definition: G4VMscModel.cc:139