Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VMscModel.hh
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.hh 66590 2012-12-23 09:31:50Z vnivanch $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class header file
31 //
32 //
33 // File name: G4VMscModel
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 07.03.2008
38 //
39 // Modifications:
40 // 07.04.2009 V.Ivanchenko moved msc methods from G4VEmModel to G4VMscModel
41 // 26.03.2012 V.Ivanchenko added transport x-section pointer and Get?Set methods
42 //
43 // Class Description:
44 //
45 // General interface to msc models
46 
47 // -------------------------------------------------------------------
48 //
49 #ifndef G4VMscModel_h
50 #define G4VMscModel_h 1
51 
53 
54 #include "G4VEmModel.hh"
55 #include "G4MscStepLimitType.hh"
56 #include "globals.hh"
57 #include "G4ThreeVector.hh"
58 #include "G4Track.hh"
59 #include "G4SafetyHelper.hh"
60 #include "G4VEnergyLossProcess.hh"
61 #include "G4LossTableManager.hh"
62 #include "G4PhysicsTable.hh"
63 #include "G4ThreeVector.hh"
64 #include <vector>
65 
67 
68 class G4VMscModel : public G4VEmModel
69 {
70 
71 public:
72 
73  G4VMscModel(const G4String& nam);
74 
75  virtual ~G4VMscModel();
76 
77  virtual G4double ComputeTruePathLengthLimit(const G4Track& track,
78  G4double& stepLimit);
79 
80  virtual G4double ComputeGeomPathLength(G4double truePathLength);
81 
82  virtual G4double ComputeTrueStepLength(G4double geomPathLength);
83 
85  G4double safety);
86 
87  // empty method
88  virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
89  const G4MaterialCutsCouple*,
90  const G4DynamicParticle*,
91  G4double tmin,
92  G4double tmax);
93 
94  //================================================================
95  // Set parameters of multiple scattering models
96  //================================================================
97 
99 
100  inline void SetLateralDisplasmentFlag(G4bool val);
101 
102  inline void SetRangeFactor(G4double);
103 
104  inline void SetGeomFactor(G4double);
105 
106  inline void SetSkin(G4double);
107 
108  inline void SetSampleZ(G4bool);
109 
110  //================================================================
111  // Get/Set access to Physics Tables
112  //================================================================
113 
114  inline G4VEnergyLossProcess* GetIonisation() const;
115 
116  inline void SetIonisation(G4VEnergyLossProcess*,
117  const G4ParticleDefinition* part);
118 
119  //================================================================
120  // Run time methods
121  //================================================================
122 
123 protected:
124 
125  // initialisation of the ParticleChange for the model
126  // initialisation of interface with geometry and ionisation
129 
130  // convert true length to geometry length
131  inline G4double ConvertTrueToGeom(G4double& tLength, G4double& gLength);
132 
133 public:
134 
135  // compute safety
136  inline G4double ComputeSafety(const G4ThreeVector& position, G4double limit);
137 
138  // compute linear distance to a geometry boundary
139  inline G4double ComputeGeomLimit(const G4Track&, G4double& presafety,
140  G4double limit);
141 
142  inline G4double GetDEDX(const G4ParticleDefinition* part,
143  G4double kineticEnergy,
144  const G4MaterialCutsCouple* couple);
145 
146  inline G4double GetRange(const G4ParticleDefinition* part,
147  G4double kineticEnergy,
148  const G4MaterialCutsCouple* couple);
149 
150  inline G4double GetEnergy(const G4ParticleDefinition* part,
151  G4double range,
152  const G4MaterialCutsCouple* couple);
153 
154  // G4MaterialCutsCouple should be defined before call to this method
155  inline
157  G4double kinEnergy);
158 
159 private:
160 
161  // hide assignment operator
162  G4VMscModel & operator=(const G4VMscModel &right);
163  G4VMscModel(const G4VMscModel&);
164 
165  G4SafetyHelper* safetyHelper;
166  G4VEnergyLossProcess* ionisation;
167  const G4ParticleDefinition* currentPart;
168  G4LossTableManager* man;
169 
170  G4double dedx;
171  G4double localtkin;
172  G4double localrange;
173 
174 protected:
175 
184 
187 
190 
191 };
192 
193 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
195 
197 {
198  latDisplasment = val;
199 }
200 
201 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
202 
204 {
205  skin = val;
206 }
207 
208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
209 
211 {
212  facrange = val;
213 }
214 
215 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
216 
218 {
219  facgeom = val;
220 }
221 
222 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
223 
225 {
226  steppingAlgorithm = val;
227 }
228 
229 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
230 
232 {
233  samplez = val;
234 }
235 
236 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
237 
239  G4double)
240 {
241  return safetyHelper->ComputeSafety(position);
242 }
243 
244 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
245 
247  G4double& glength)
248 {
249  glength = ComputeGeomPathLength(tlength);
250  // should return true length
251  return tlength;
252 }
253 
254 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
255 
257  G4double& presafety,
258  G4double limit)
259 {
260  G4double res = geomMax;
261  if(track.GetVolume() != safetyHelper->GetWorldVolume()) {
262  res = safetyHelper->CheckNextStep(
263  track.GetStep()->GetPreStepPoint()->GetPosition(),
264  track.GetMomentumDirection(),
265  limit, presafety);
266  }
267  return res;
268 }
269 
270 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
271 
272 inline G4double
274  G4double kinEnergy, const G4MaterialCutsCouple* couple)
275 {
276  G4double x;
277  if(ionisation) { x = ionisation->GetDEDX(kinEnergy, couple); }
278  else {
279  G4double q = part->GetPDGCharge()/CLHEP::eplus;
280  x = dedx*q*q;
281  }
282  return x;
283 }
284 
285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
286 
287 inline G4double
289  G4double kinEnergy, const G4MaterialCutsCouple* couple)
290 {
291  if(ionisation) {
292  localrange = ionisation->GetRangeForLoss(kinEnergy, couple);
293  } else {
294  G4double q = part->GetPDGCharge()/CLHEP::eplus;
295  localrange = kinEnergy/(dedx*q*q*couple->GetMaterial()->GetDensity());
296  localtkin = kinEnergy;
297  }
298  return localrange;
299 }
300 
301 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
302 
303 inline G4double
305  G4double range, const G4MaterialCutsCouple* couple)
306 {
307  G4double e;
308  if(ionisation) { e = ionisation->GetKineticEnergy(range, couple); }
309  else {
310  e = localtkin;
311  if(localrange > range) {
312  G4double q = part->GetPDGCharge()/CLHEP::eplus;
313  e -= (localrange - range)*dedx*q*q*couple->GetMaterial()->GetDensity();
314  }
315  }
316  return e;
317 }
318 
320 {
321  return ionisation;
322 }
323 
325  const G4ParticleDefinition* part)
326 {
327  ionisation = p;
328  currentPart = part;
329 }
330 
331 inline G4double
333  G4double ekin)
334 {
335  G4double x;
336  if(xSectionTable) {
337  G4int idx = CurrentCouple()->GetIndex();
338  x = (*xSectionTable)[(*theDensityIdx)[idx]]->Value(ekin)
339  *(*theDensityFactor)[idx]/(ekin*ekin);
340  } else {
341  x = CrossSectionPerVolume(CurrentCouple()->GetMaterial(), part, ekin,
342  0.0, DBL_MAX);
343  }
344  if(0.0 >= x) { x = DBL_MAX; }
345  else { x = 1.0/x; }
346  return x;
347 }
348 
349 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
350 
351 #endif
352