Geant4.10
 All Data Structures 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: G4EmElementSelector.hh 71484 2013-06-17 08:12:51Z gcosmo $
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) const;
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 G4ElementVector* theElementVector;
91 
92  G4int nElmMinusOne;
93  G4int nbins;
94 
95  G4double cutEnergy;
96  G4double lowEnergy;
97  G4double highEnergy;
98 
99  std::vector<G4PhysicsLogVector*> xSections;
100 
101 };
102 
103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
105 
107 {
108  const G4Element* element = (*theElementVector)[nElmMinusOne];
109  if (nElmMinusOne > 0) {
111  for(G4int i=0; i<nElmMinusOne; ++i) {
112  if (x <= (xSections[i])->Value(e)) {
113  element = (*theElementVector)[i];
114  break;
115  }
116  }
117  }
118  return element;
119 }
120 
122 {
123  return material;
124 }
125 
126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
127 
128 #endif
129 
std::vector< G4Element * > G4ElementVector
const G4Material * GetMaterial() const
const char * p
Definition: xmltok.h:285
int G4int
Definition: G4Types.hh:78
#define G4UniformRand()
Definition: Randomize.hh:87
bool G4bool
Definition: G4Types.hh:79
const XML_Char XML_Content * model
const G4Element * SelectRandomAtom(G4double kineticEnergy) const
void Dump(const G4ParticleDefinition *p=0)
G4EmElementSelector(G4VEmModel *, const G4Material *, G4int bins, G4double emin, G4double emax, G4bool spline=true)
double G4double
Definition: G4Types.hh:76
void Initialise(const G4ParticleDefinition *, G4double cut=0.0)