Geant4_10
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: G4DiscreteGammaDeexcitation.cc 69700 2013-05-13 08:56:05Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 // GEANT 4 class file
30 //
31 // CERN, Geneva, Switzerland
32 //
33 // File name: G4DiscreteGammaDeexcitation
34 //
35 // Author: Maria Grazia Pia (pia@genova.infn.it)
36 //
37 // Creation date: 23 October 1998
38 //
39 // Modifications:
40 // 8 March 2001, Fan Lei (flei@space.qinetiq.com)
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 
62 #include "G4NuclearLevelManager.hh"
63 #include "G4NuclearLevelStore.hh"
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;
73 }
74 
76 {}
77 
79 {
80  G4Fragment* nucleus = GetNucleus();
81  G4int A = nucleus->GetA_asInt();
82  G4int Z = nucleus->GetZ_asInt();
83  // _verbose =2;
84  // G4cout << "G4DiscreteGammaDeexcitation::CreateTransition: " << nucleus << G4endl;
85  if (_nucleusA != A || _nucleusZ != Z)
86  {
87  _nucleusA = A;
88  _nucleusZ = Z;
89  _levelManager = G4NuclearLevelStore::GetInstance()->GetManager(Z,A);
90  }
91 
92  if (_levelManager->IsValid())
93  {
94  if (_verbose > 1)
95  {
96  G4cout
97  << "G4DiscreteGammaDeexcitation::CreateTransition - (A,Z) is valid "
98  << G4endl;
99  }
100 
101  G4double excitation = nucleus->GetExcitationEnergy();
102  const G4NuclearLevel* level =_levelManager->NearestLevel(excitation);
103 
104  if (level != 0)
105  {
106  if (_verbose > 0) {
107  G4cout
108  << "G4DiscreteGammaDeexcitation::CreateTransition - Created from level energy "
109  << level->Energy() << ", excitation is "
110  << excitation << G4endl;
111  }
112  G4DiscreteGammaTransition* dtransit = new G4DiscreteGammaTransition(*level,Z,A);
113  dtransit->SetICM(_icm);
114  return dtransit;
115  }
116  else
117  {
118  if (_verbose > 0) {
119  G4cout
120  << "G4DiscreteGammaDeexcitation::CreateTransition - No transition created from "
121  << excitation << " within tolerance " << _tolerance << G4endl;
122  }
123  return 0;
124  }
125  }
126  return 0;
127 }
128 
129 
131 {
132 
133  G4bool canDo = true;
134 
135  if (_transition == 0) {
136  canDo = false;
137 
138  if (_verbose > 0)
139  G4cout
140  << "G4DiscreteGammaDeexcitation::CanDoTransition - Null transition "
141  << G4endl;
142  }
143  if (canDo) {
144  //remove the _nucleusZ>98 limit L. Desorgher Sept. 2011
145  //if (_nucleusZ<2 || _nucleusA<3 || _nucleusZ>98)
146  if (_nucleusZ<2 || _nucleusA<3 )
147  {
148  canDo = false;
149  if (_verbose > 0)
150  G4cout
151  << "G4DiscreteGammaDeexcitation::CanDoTransition - n/p/H/>Cf"
152  << G4endl;
153  }
154  }
155 
156  G4Fragment* nucleus = GetNucleus();
157  G4double excitation = nucleus->GetExcitationEnergy();
158  //G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition: " << nucleus << G4endl;
159 
160  if (canDo) {
161  if (excitation <= _tolerance) {
162  canDo = false;
163  if (_verbose > 0) {
164  G4cout
165  << "G4DiscreteGammaDeexcitation::CanDoTransition - Excitation <= 0"
166  << excitation << " " << excitation - _tolerance
167  << G4endl;
168  }
169  } else {
170  if (excitation > _levelManager->MaxLevelEnergy() + _tolerance) { canDo = false; }
171  //if (excitation < _levelManager->MinLevelEnergy() - _tolerance) canDo = false;
172  // The following is a protection to avoid looping in case of elements with very low
173  // ensdf levels
174  //if (excitation < _levelManager->MinLevelEnergy() * 0.9) canDo = false;
175 
176  if (_verbose > 0) {
177  G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition - Excitation "
178  << excitation << ", Min-Max are "
179  << _levelManager->MinLevelEnergy() << " "
180  << _levelManager->MaxLevelEnergy() << G4endl;
181  }
182  }
183  }
184 
185  if (canDo) {
186  const G4NuclearLevel* level = _levelManager->NearestLevel(excitation);
187  if (!level) {
188  canDo = false;
189 
190  } else {
191  if (level->HalfLife() > _max_hl && !_rdm ) { canDo = false; }
192 
193  if (_verbose > 0) {
194  G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition - Halflife "
195  << level->HalfLife() << ", Calling from RDM "
196  << (_rdm ? " True " : " False ") << ", Max-HL = " << _max_hl
197  << G4endl;
198  }
199  }
200  }
201  if (_verbose > 0) {
202  G4cout <<"G4DiscreteGammaDeexcitation::CanDoTransition - CanDo: "
203  << (canDo ? " True " : " False ") << G4endl;
204  }
205 
206  return canDo;
207 
208 }
209 
G4double HalfLife() const
G4double Energy() const
G4double MinLevelEnergy() const
virtual G4VGammaTransition * CreateTransition()
static G4NuclearLevelStore * GetInstance()
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4int GetA_asInt() const
Definition: G4Fragment.hh:218
Float_t Z
Definition: plot.C:39
bool G4bool
Definition: G4Types.hh:79
G4NuclearLevelManager * GetManager(G4int Z, G4int A)
G4VGammaTransition * _transition
G4int GetZ_asInt() const
Definition: G4Fragment.hh:223
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
const G4NuclearLevel * NearestLevel(G4double energy, G4double eDiffMax=9999.*CLHEP::GeV) const
G4double MaxLevelEnergy() const
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:235