Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4BEGammaDeexcitation.cc
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 //
27 // Implementation of the HETC88 code into Geant4.
28 // Evaporation and De-excitation parts
29 // T. Lampen, Helsinki Institute of Physics, May-2000
30 
31 #include "globals.hh"
32 #include "G4ios.hh"
33 #include "Randomize.hh"
34 #include "G4PhysicalConstants.hh"
35 #include "G4Neutron.hh"
36 #include "G4Proton.hh"
37 #include "G4Deuteron.hh"
38 #include "G4Triton.hh"
39 #include "G4Alpha.hh"
40 #include "G4Nucleus.hh"
41 #include "G4BEGammaDeexcitation.hh"
42 
43 
45 {
46 }
47 
48 
50 {
51 }
52 
53 
55 {
56  verboseLevel = level ;
57 }
58 
59 
61 {
62  nucleusA = a;
63 }
64 
65 
67 {
68  nucleusZ = z;
69 }
70 
71 
73 {
74  excitationEnergy = energy;
75 }
76 
77 
78 G4double G4BEGammaDeexcitation::sampleKineticEnergy()
79 {
80  return excitationEnergy * G4UniformRand();
81 }
82 
83 
85 {
86  // Isotropic distribution assumed to gammas
87  G4double u, v, w;
88  G4DynamicParticle * pParticle = new G4DynamicParticle;
89  pParticle -> SetDefinition( G4Gamma::Gamma() );
90  pParticle -> SetKineticEnergy( sampleKineticEnergy() );
91  isotropicCosines( u, v, w );
92  pParticle -> SetMomentumDirection( u, v, w );
93  return pParticle;
94 }
95 
96 
97 void G4BEGammaDeexcitation::isotropicCosines( G4double & u,
98  G4double & v,
99  G4double & w )
100 {
101  // Samples isotropic random direction cosines.
102  G4double CosTheta = 1.0 - 2.0 * G4UniformRand();
103  G4double SinTheta = std::sqrt( 1.0 - CosTheta * CosTheta );
104  G4double Phi = twopi * G4UniformRand();
105 
106  u = std::cos( Phi ) * SinTheta;
107  v = std::cos( Phi ) * CosTheta,
108  w = std::sin( Phi );
109 
110  return;
111 }