ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ScreenedNuclearRecoil.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ScreenedNuclearRecoil.hh
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 //
28 //
29 //
30 //
31 // G4ScreenedNuclearRecoil.hh,v 1.24 2008/05/01 19:58:59 marcus Exp
32 // GEANT4 tag
33 //
34 //
35 //
36 // Class Description
37 // Process for screened electromagnetic nuclear elastic scattering;
38 // Physics comes from:
39 // Marcus H. Mendenhall and Robert A. Weller,
40 // "Algorithms for the rapid computation of classical cross sections
41 // for screened Coulomb collisions "
42 // Nuclear Instruments and Methods in Physics Research B58 (1991) 11-17
43 // The only input required is a screening function phi(r/a) which is the ratio
44 // of the actual interatomic potential for two atoms with atomic numbers Z1 and
45 // Z2,
46 // to the unscreened potential Z1*Z2*e^2/r where e^2 is elm_coupling in Geant4
47 // units
48 // the actual screening tables are computed externally in a python module
49 // "screened_scattering.py"
50 // to allow very specific screening functions to be added if desired, without
51 // messing with the insides of this code.
52 //
53 // First version, April 2004, Marcus H. Mendenhall, Vanderbilt University
54 // May 1, 2008 -- Added code to allow process to have zero cross section above
55 // max energy, to coordinate with G4MSC. -- mhm
56 //
57 // Class Description - End
58 
59 
60 #ifndef G4ScreenedNuclearRecoil_h
61 #define G4ScreenedNuclearRecoil_h 1
62 
63 #include "globals.hh"
64 #include "G4VDiscreteProcess.hh"
65 #include "G4ParticleChange.hh"
66 #include "c2_function.hh"
67 
68 #include "G4PhysicalConstants.hh"
69 #include "G4SystemOfUnits.hh"
70 
71 #include <map>
72 #include <vector>
73 
75 
79 
80 typedef struct G4ScreeningTables {
84 
85 // A class for loading ScreenedCoulombCrossSections
87 {
88 public:
91 
92  static const char* CVSHeaderVers() { return
93  "G4ScreenedNuclearRecoil.hh,v 1.24 2008/05/01 19:58:59 marcus Exp GEANT4 tag ";
94  }
95  static const char* CVSFileVers();
96 };
97 
98 // A class for loading ScreenedCoulombCrossSections
100 {
101 public:
102 
107 
108  typedef std::map<G4int, G4ScreeningTables> ScreeningMap;
109 
110  // a local, fast-access mapping of a particle's Z to its full definition
111  typedef std::map<G4int, class G4ParticleDefinition *> ParticleCache;
112 
113  // LoadData is called by G4ScreenedNuclearRecoil::GetMeanFreePath
114  // It loads the data tables, builds the elemental cross-section tables.
115  virtual void LoadData(G4String screeningKey, G4int z1, G4double m1,
116  G4double recoilCutoff) = 0;
117 
118  // BuildMFPTables is called by G4ScreenedNuclearRecoil::GetMeanFreePath
119  //to build the MFP tables for each material
120  void BuildMFPTables(void); // scan the MaterialsTable and construct MFP
121  //tables
122 
123  virtual G4ScreenedCoulombCrossSection *create() = 0;
124  // a 'virtual constructor' which clones the class
126  { return &(screeningData[Z]); }
128 
129  // this process needs element selection weighted only by number density
131  (const G4MaterialCutsCouple* couple);
132 
133  enum { nMassMapElements=116 };
134 
136  { return z1 <= nMassMapElements ? massmap[z1] : 2.5*z1; }
137 
138  // get the mean-free-path table for the indexed material
139  const G4_c2_function * operator [] (G4int materialIndex) {
140  return MFPTables.find(materialIndex)!=MFPTables.end() ?
141  &(MFPTables[materialIndex].get()) : (G4_c2_function *)0;
142  }
143 
144 protected:
145  ScreeningMap screeningData; // screening tables for each element
148  std::map<G4int, G4_c2_const_ptr > sigmaMap;
149  // total cross section for each element
150  std::map<G4int, G4_c2_const_ptr > MFPTables; // MFP for each material
151 
152 private:
154 
155 };
156 
157 typedef struct G4CoulombKinematicsInfo {
164 
166 public:
167  virtual void DoCollisionStep(class G4ScreenedNuclearRecoil *master,
168  const class G4Track& aTrack, const class G4Step& aStep)=0;
170 };
171 
174 
175 public:
177  virtual void DoCollisionStep(class G4ScreenedNuclearRecoil *master,
178  const class G4Track& aTrack, const class G4Step& aStep);
179 
181  const G4ScreeningTables *screen, G4double eps, G4double beta);
182 
184 
185 protected:
186  // the c2_functions we need to do the work.
190 };
191 
193  public G4ScreenedCollisionStage {
194 
195 public:
197  virtual void DoCollisionStep(class G4ScreenedNuclearRecoil *master,
198  const class G4Track& aTrack, const class G4Step& aStep);
199  virtual ~G4SingleScatter() {}
200 };
201 
208  public G4VDiscreteProcess
209 {
210 public:
211 
213 
233 
234  G4ScreenedNuclearRecoil(const G4String& processName = "ScreenedElastic",
235  const G4String &ScreeningKey="zbl", G4bool GenerateRecoils=1,
236  G4double RecoilCutoff=100.0*eV, G4double PhysicsCutoff=10.0*eV);
237 
239  virtual ~G4ScreenedNuclearRecoil();
240 
242  virtual G4double GetMeanFreePath(const G4Track&, G4double,
243  G4ForceCondition* );
244 
246  virtual G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
247  const G4Step& aStep);
250  virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
253  virtual void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
256  virtual void DumpPhysicsTable(const G4ParticleDefinition& aParticleType);
262 
264  G4double apsis); // return true if hard collision
265 
267 
269  G4double GetNIEL() const { return NIEL; }
270 
272  void ResetTables();
273  // clear all data tables to allow changing energy cutoff, materials, etc.
274 
285 
287 
289  std::string GetScreeningKey() const { return screeningKey; }
290 
294 
296 
299 
306 
307  void EnableRecoils(G4bool flag) { generateRecoils=flag; }
308 
311 
317 
319 
321  G4double GetMFPScaling() const { return MFPScale; }
322 
329 
331 
334 
339 
341 
344 
348 
350  ResetTables(); }
351 
354 
357 
359 
366 
367  void SetCrossSectionHardening(G4double fraction, G4double HardeningFactor){
368  hardeningFraction=fraction;
369  hardeningFactor=HardeningFactor;
370  }
371 
374 
377 
380  return currentInteractionLength; }
381 
385 
388  }
389 
391  G4int GetVerboseLevel() const { return verboseLevel; }
392 
393  std::map<G4int, G4ScreenedCoulombCrossSection*> &GetCrossSectionHandlers()
394  { return crossSectionHandlers; }
395 
396  void ClearStages(void);
397 
399  collisionStages.push_back(stage); }
400 
402 
404 
406 
410  { return static_cast<G4ParticleChange &>(*pParticleChange); }
411 
414 
416  G4double energy);
417 
418 protected:
421 
424 
435 
437  std::vector<G4ScreenedCollisionStage *> collisionStages;
438 
439  std::map<G4int, G4ScreenedCoulombCrossSection*> crossSectionHandlers;
440 
444 };
445 
446 // A customized G4CrossSectionHandler which gets its data from
447 // an external program
448 
450 {
451 public:
453 
457 
459  const G4ScreenedCoulombCrossSection &src)
461 
463 
464  virtual void LoadData(G4String screeningKey, G4int z1, G4double m1,
465  G4double recoilCutoff);
466 
468  { return new G4NativeScreenedCoulombCrossSection(*this); }
469 
470  // get a list of available keys
471  std::vector<G4String> GetScreeningKeys() const;
472 
473  typedef G4_c2_function &(*ScreeningFunc)(G4int z1, G4int z2,
474  size_t nPoints, G4double rMax, G4double *au);
475 
477  phiMap[name]=fn;
478  }
479 
480 private:
481  // this is a map used to look up screening function generators
482  std::map<std::string, ScreeningFunc> phiMap;
483 };
484 
485 G4_c2_function &ZBLScreening(G4int z1, G4int z2, size_t npoints,
486  G4double rMax, G4double *auval);
487 
488 G4_c2_function &MoliereScreening(G4int z1, G4int z2, size_t npoints,
489  G4double rMax, G4double *auval);
490 
491 G4_c2_function &LJScreening(G4int z1, G4int z2, size_t npoints,
492  G4double rMax, G4double *auval);
493 
494 G4_c2_function &LJZBLScreening(G4int z1, G4int z2, size_t npoints,
495  G4double rMax, G4double *auval);
496 
497 #endif