Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DiscreteGammaDeexcitation.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$
27//
28// -------------------------------------------------------------------
29// GEANT 4 class file
30//
31// CERN, Geneva, Switzerland
32//
33// File name: G4DiscreteGammaDeexcitation
34//
35// Author: Maria Grazia Pia ([email protected])
36//
37// Creation date: 23 October 1998
38//
39// Modifications:
40// 8 March 2001, Fan Lei ([email protected])
41// Added the following as part if the IC implementation
42// void SetICM(G4bool hl) { _icm = hl; };
43// void SetRDM(G4bool hl) { _rdm = hl; };
44// void SetHL(G4double hl) { _max_hl = hl; };
45// Changed in CreateTransition() from
46// return new G4DiscreteGammaTransition(*level);
47// To
48// return new G4DiscreteGammaTransition(*level,Z);
49// Added in CanDoTransition
50// if (level->HalfLife() > _max_hl && !_rdm ) canDo = false;
51//
52// 3 November 2011 L. Desorgher
53// remove the Z<= 98 limit
54//
55// -------------------------------------------------------------------
56
57#include <fstream>
58#include <sstream>
59
64#include "G4SystemOfUnits.hh"
65#include "G4ios.hh"
66
68 _nucleusZ(0), _nucleusA(0), _max_hl(1e-6*second), _icm(false),
69 _rdm(false), _levelManager(0)
70{
71 _tolerance = CLHEP::keV;
72}
73
75{}
76
78{
79 G4Fragment* nucleus = GetNucleus();
80 G4int A = nucleus->GetA_asInt();
81 G4int Z = nucleus->GetZ_asInt();
82 // _verbose =2;
83 // G4cout << "G4DiscreteGammaDeexcitation::CreateTransition: " << nucleus << G4endl;
84 if (_nucleusA != A || _nucleusZ != Z)
85 {
86 _nucleusA = A;
87 _nucleusZ = Z;
88 _levelManager = G4NuclearLevelStore::GetInstance()->GetManager(Z,A);
89 }
90
91 if (_levelManager->IsValid())
92 {
93 if (_verbose > 1)
94 {
95 G4cout
96 << "G4DiscreteGammaDeexcitation::CreateTransition - (A,Z) is valid "
97 << G4endl;
98 }
99
100 G4double excitation = nucleus->GetExcitationEnergy();
101 const G4NuclearLevel* level =_levelManager->NearestLevel(excitation);
102
103 if (level != 0)
104 {
105 if (_verbose > 0) {
106 G4cout
107 << "G4DiscreteGammaDeexcitation::CreateTransition - Created from level energy "
108 << level->Energy() << ", excitation is "
109 << excitation << G4endl;
110 }
111 G4DiscreteGammaTransition* dtransit = new G4DiscreteGammaTransition(*level,Z,A);
112 dtransit->SetICM(_icm);
113 return dtransit;
114 }
115 else
116 {
117 if (_verbose > 0) {
118 G4cout
119 << "G4DiscreteGammaDeexcitation::CreateTransition - No transition created from "
120 << excitation << " within tolerance " << _tolerance << G4endl;
121 }
122 return 0;
123 }
124 }
125 return 0;
126}
127
128
130{
131
132 G4bool canDo = true;
133
134 if (_transition == 0) {
135 canDo = false;
136
137 if (_verbose > 0)
138 G4cout
139 << "G4DiscreteGammaDeexcitation::CanDoTransition - Null transition "
140 << G4endl;
141 }
142 if (canDo) {
143 //remove the _nucleusZ>98 limit L. Desorgher Sept. 2011
144 //if (_nucleusZ<2 || _nucleusA<3 || _nucleusZ>98)
145 if (_nucleusZ<2 || _nucleusA<3 )
146 {
147 canDo = false;
148 if (_verbose > 0)
149 G4cout
150 << "G4DiscreteGammaDeexcitation::CanDoTransition - n/p/H/>Cf"
151 << G4endl;
152 }
153 }
154
155 G4Fragment* nucleus = GetNucleus();
156 G4double excitation = nucleus->GetExcitationEnergy();
157 //G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition: " << nucleus << G4endl;
158
159 if (canDo) {
160 if (excitation <= _tolerance) {
161 canDo = false;
162 if (_verbose > 0) {
163 G4cout
164 << "G4DiscreteGammaDeexcitation::CanDoTransition - Excitation <= 0"
165 << excitation << " " << excitation - _tolerance
166 << G4endl;
167 }
168 } else {
169 if (excitation > _levelManager->MaxLevelEnergy() + _tolerance) { canDo = false; }
170 //if (excitation < _levelManager->MinLevelEnergy() - _tolerance) canDo = false;
171 // The following is a protection to avoid looping in case of elements with very low
172 // ensdf levels
173 //if (excitation < _levelManager->MinLevelEnergy() * 0.9) canDo = false;
174
175 if (_verbose > 0) {
176 G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition - Excitation "
177 << excitation << ", Min-Max are "
178 << _levelManager->MinLevelEnergy() << " "
179 << _levelManager->MaxLevelEnergy() << G4endl;
180 }
181 }
182 }
183
184 if (canDo) {
185 const G4NuclearLevel* level = _levelManager->NearestLevel(excitation);
186 if (!level) {
187 canDo = false;
188
189 } else {
190 if (level->HalfLife() > _max_hl && !_rdm ) { canDo = false; }
191
192 if (_verbose > 0) {
193 G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition - Halflife "
194 << level->HalfLife() << ", Calling from RDM "
195 << (_rdm ? " True " : " False ") << ", Max-HL = " << _max_hl
196 << G4endl;
197 }
198 }
199 }
200 if (_verbose > 0) {
201 G4cout <<"G4DiscreteGammaDeexcitation::CanDoTransition - CanDo: "
202 << (canDo ? " True " : " False ") << G4endl;
203 }
204
205 return canDo;
206
207}
208
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
virtual G4VGammaTransition * CreateTransition()
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:235
G4int GetZ_asInt() const
Definition: G4Fragment.hh:223
G4int GetA_asInt() const
Definition: G4Fragment.hh:218
const G4NuclearLevel * NearestLevel(G4double energy, G4double eDiffMax=9999.*CLHEP::GeV) const
G4NuclearLevelManager * GetManager(G4int Z, G4int A)
static G4NuclearLevelStore * GetInstance()
G4double HalfLife() const
G4double Energy() const
G4VGammaTransition * _transition