Geant4  10.02
G4GammaTransition.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 // $Id: G4GammaTransition.cc 85659 2014-11-03 10:59:10Z vnivanch $
27 //
28 // -------------------------------------------------------------------
29 // GEANT 4 class file
30 //
31 // CERN, Geneva, Switzerland
32 //
33 // File name: G4GammaTransition
34 //
35 // Author V.Ivanchenko 27 February 2015
36 //
37 // -------------------------------------------------------------------
38 
39 #include "G4GammaTransition.hh"
40 #include "G4AtomicShells.hh"
41 #include "Randomize.hh"
42 #include "G4Gamma.hh"
43 #include "G4Electron.hh"
44 #include "G4LorentzVector.hh"
45 #include "G4SystemOfUnits.hh"
46 #include "G4PhysicalConstants.hh"
47 
49 {}
50 
52 {}
53 
54 G4Fragment*
56  G4double newExcEnergy,
57  G4int, size_t shell,
58  G4bool isGamma,
59  G4bool isLongLived)
60 {
61  G4Fragment* result = 0;
62  G4double bond_energy = 0.;
63 
64  if (!isGamma) {
65  G4int Z = nucleus->GetZ_asInt();
66  if(Z <= 100) {
67  G4int idx = (G4int)shell;
69  bond_energy = G4AtomicShells::GetBindingEnergy(Z, idx);
70  }
71  }
72  G4double etrans = nucleus->GetExcitationEnergy() - newExcEnergy
73  - bond_energy;
74  //G4cout << "G4GammaTransition::GenerateGamma - Etrans(MeV)= "
75  // << etrans << " Eexnew= " << newExcEnergy
76  // << " Ebond= " << bond_energy << G4endl;
77  if(etrans <= 0.0) { return result; }
78 
79  // Do complete Lorentz computation
80  G4LorentzVector lv = nucleus->GetMomentum();
81  G4double mass = nucleus->GetGroundStateMass() + newExcEnergy;
82 
83  //G4double e0 = lv.e();
84 
85  // select secondary
87 
88  if(isGamma) { part = G4Gamma::Gamma(); }
89  else {
90  part = G4Electron::Electron();
91  G4int ne = nucleus->GetNumberOfElectrons() - 1;
92  if(ne < 0) { ne = 0; }
93  nucleus->SetNumberOfElectrons(ne);
94  lv += G4LorentzVector(0.0,0.0,0.0,
95  CLHEP::electron_mass_c2 - bond_energy);
96  }
97 
98  G4double cosTheta = 1. - 2. * G4UniformRand();
99  G4double sinTheta = std::sqrt(1. - cosTheta * cosTheta);
100  G4double phi = twopi * G4UniformRand();
101 
102  G4double emass = part->GetPDGMass();
103 
104  // 2-body decay in rest frame
105  G4double ecm = lv.mag();
106  G4ThreeVector bst = lv.boostVector();
107 
108  //G4cout << "Ecm= " << ecm << " mass= " << mass << " emass= " << emass
109  // << " isLongLived: " << isLongLived << G4endl;
110 
111  G4double energy = 0.5*((ecm - mass)*(ecm + mass) + emass*emass)/ecm;
112  energy = std::max(energy, emass);
113 
114  G4double mom = std::sqrt((energy - emass)*(energy + emass));
115 
116  G4LorentzVector res4mom(mom * sinTheta * std::cos(phi),
117  mom * sinTheta * std::sin(phi),
118  mom * cosTheta, energy);
119 
120  // Lab system transform for short lived level
121  if(!isLongLived) {
122  res4mom.boost(bst);
123  lv -= res4mom;
124  } else {
125  // In exceptional case sample decay at rest at not correct position
126  // of stopping ion, 4-momentum balance is breaked but gamma energy
127  // is correct
128  lv -= res4mom;
129  G4double E = lv.e();
130  G4double P2= (E - mass)*(E + mass);
131  G4ThreeVector v = lv.vect().unit();
132  G4double p = 0.0;
133  if(P2 > 0.0) { p = std::sqrt(P2); }
134  else { E = mass; }
135  lv.set(v.x()*p, v.y()*p, v.z()*p, E);
136  }
137 
138  // modified primary fragment
139  nucleus->SetMomentum(lv);
140 
141  // gamma or e- are produced
142  result = new G4Fragment(res4mom, part);
143 
144  // G4cout << " DeltaE= " << e0 - lv.e() - res4mom.e() << G4endl;
145  //G4cout << "G4GammaTransition::GenerateGamma : " << thePhoton << G4endl;
146  //G4cout << " Left nucleus: " << aNucleus << G4endl;
147  return result;
148 }
CLHEP::Hep3Vector G4ThreeVector
G4int GetNumberOfElectrons() const
Definition: G4Fragment.hh:374
void SetNumberOfElectrons(G4int value)
Definition: G4Fragment.hh:379
int G4int
Definition: G4Types.hh:78
virtual ~G4GammaTransition()
#define G4UniformRand()
Definition: Randomize.hh:97
bool G4bool
Definition: G4Types.hh:79
static G4double GetBindingEnergy(G4int Z, G4int SubshellNb)
const G4LorentzVector & GetMomentum() const
Definition: G4Fragment.hh:284
void SetMomentum(const G4LorentzVector &value)
Definition: G4Fragment.hh:289
static const double twopi
Definition: G4SIunits.hh:75
G4double GetGroundStateMass() const
Definition: G4Fragment.hh:273
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
G4double GetPDGMass() const
virtual G4Fragment * SampleTransition(G4Fragment *nucleus, G4double newExcEnergy, G4int deltaS, size_t shell, G4bool isGamma, G4bool isLongLived)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double energy(const ThreeVector &p, const G4double m)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4int GetZ_asInt() const
Definition: G4Fragment.hh:256
static const G4double * P2[nN]
static G4Electron * Electron()
Definition: G4Electron.cc:94
double G4double
Definition: G4Types.hh:76
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:268
CLHEP::HepLorentzVector G4LorentzVector
static G4int GetNumberOfShells(G4int Z)