Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EmElementSelector.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$
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class header file
31 //
32 //
33 // File name: G4EmElementSelector
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 29.05.2008
38 //
39 // Modifications:
40 //
41 //
42 // Class Description:
43 //
44 // Generic helper class for the random selection of an element
45 
46 // -------------------------------------------------------------------
47 //
48 
49 #ifndef G4EmElementSelector_h
50 #define G4EmElementSelector_h 1
51 
52 #include "globals.hh"
53 #include "G4ParticleDefinition.hh"
54 #include "G4Material.hh"
55 #include "G4Element.hh"
56 #include "G4ElementVector.hh"
57 #include "G4PhysicsLogVector.hh"
58 #include "Randomize.hh"
59 #include <vector>
60 
61 class G4VEmModel;
62 
64 {
65 
66 public:
67 
69  G4double emin, G4double emax,
70  G4bool spline = true);
71 
73 
74  void Initialise(const G4ParticleDefinition*, G4double cut = 0.0);
75 
76  void Dump(const G4ParticleDefinition* p = 0);
77 
78  inline const G4Element* SelectRandomAtom(G4double kineticEnergy);
79 
80  inline const G4Material* GetMaterial() const;
81 
82 private:
83 
84  // hide assignment operator
85  G4EmElementSelector & operator=(const G4EmElementSelector &right);
87 
89  const G4Material* material;
90  const G4Element* element;
91  const G4ElementVector* theElementVector;
92 
93  G4int nElmMinusOne;
94  G4int nbins;
95 
96  G4double cutEnergy;
97  G4double lowEnergy;
98  G4double highEnergy;
99 
100  std::vector<G4PhysicsLogVector*> xSections;
101 
102 };
103 
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
106 
108 {
109  if (nElmMinusOne > 0) {
111  element = (*theElementVector)[nElmMinusOne];
112  for(G4int i=0; i<nElmMinusOne; ++i) {
113  if (x <= (xSections[i])->Value(e)) {
114  element = (*theElementVector)[i];
115  break;
116  }
117  }
118  }
119  return element;
120 }
121 
123 {
124  return material;
125 }
126 
127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
128 
129 #endif
130