Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 // ------------------------------------------- 28 // 29 // GEANT4 Class header file 30 // 31 // 32 // File name: G4EmElementSelector 33 // 34 // Author: Vladimir Ivanchenko 35 // 36 // Creation date: 29.05.2008 37 // 38 // Modifications: 39 // 40 // 41 // Class Description: 42 // 43 // Generic helper class for the random selecti 44 45 // ------------------------------------------- 46 // 47 48 #ifndef G4EmElementSelector_h 49 #define G4EmElementSelector_h 1 50 51 #include "globals.hh" 52 #include "G4ParticleDefinition.hh" 53 #include "G4Material.hh" 54 #include "G4Element.hh" 55 #include "G4ElementVector.hh" 56 #include "G4PhysicsLogVector.hh" 57 #include "Randomize.hh" 58 #include <vector> 59 60 class G4VEmModel; 61 62 class G4EmElementSelector 63 { 64 65 public: 66 67 G4EmElementSelector(G4VEmModel*, const G4Mat 68 G4double emin, G4double 69 G4bool spline = true); 70 71 ~G4EmElementSelector(); 72 73 void Initialise(const G4ParticleDefinition*, 74 75 void Dump(const G4ParticleDefinition* p = nu 76 77 const G4Element* SelectRandomAtom(const G4do 78 const G4do 79 80 inline const G4Element* SelectRandomAtom(G4d 81 82 inline const G4Material* GetMaterial() const 83 84 // hide assignment operator 85 G4EmElementSelector & operator=(const G4EmE 86 G4EmElementSelector(const G4EmElementSelect 87 88 private: 89 90 G4VEmModel* model; 91 const G4Material* material; 92 const G4ElementVector* theElementVector; 93 94 G4int nElmMinusOne; 95 G4int nbins; 96 97 G4double cutEnergy; 98 G4double lowEnergy; 99 G4double highEnergy; 100 101 std::vector<G4PhysicsLogVector*> xSections; 102 103 }; 104 105 //....oooOO0OOooo........oooOO0OOooo........oo 106 //....oooOO0OOooo........oooOO0OOooo........oo 107 108 inline const G4Element* G4EmElementSelector::S 109 { 110 const G4Element* element = (*theElementVecto 111 if (nElmMinusOne > 0) { 112 G4double x = G4UniformRand(); 113 size_t idx(0); 114 for(G4int i=0; i<nElmMinusOne; ++i) { 115 if (x <= (xSections[i])->Value(e, idx)) 116 element = (*theElementVector)[i]; 117 break; 118 } 119 } 120 } 121 return element; 122 } 123 124 //....oooOO0OOooo........oooOO0OOooo........oo 125 126 inline const G4Material* G4EmElementSelector:: 127 { 128 return material; 129 } 130 131 //....oooOO0OOooo........oooOO0OOooo........oo 132 133 #endif 134 135