source: trunk/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4DiscreteGammaDeexcitation.cc @ 1196

Last change on this file since 1196 was 962, checked in by garnier, 15 years ago

update processes

File size: 6.5 KB
Line 
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// -------------------------------------------------------------------
28//      GEANT 4 class file
29//
30//      CERN, Geneva, Switzerland
31//
32//      File name:     G4DiscreteGammaDeexcitation
33//
34//      Author:        Maria Grazia Pia (pia@genova.infn.it)
35//
36//      Creation date: 23 October 1998
37//
38//      Modifications:
39//      8 March 2001, Fan Lei (flei@space.qinetiq.com)
40//         Added the following as part if the IC implementation
41//            void SetICM(G4bool hl) { _icm = hl; };
42//            void SetRDM(G4bool hl) { _rdm = hl; };
43//            void SetHL(G4double hl) { _max_hl = hl; };
44//         Changed in CreateTransition() from
45//                     return new G4DiscreteGammaTransition(*level); 
46//                 To
47//                     return new G4DiscreteGammaTransition(*level,Z);
48//         Added in CanDoTransition
49//                if (level->HalfLife() > _max_hl && !_rdm ) canDo = false;
50//     
51// -------------------------------------------------------------------
52
53#include "G4DiscreteGammaDeexcitation.hh"
54#include "G4DiscreteGammaTransition.hh"
55#include "G4NuclearLevelManager.hh"
56#include "G4NuclearLevelStore.hh"
57
58#include "G4ios.hh"
59#include <fstream>
60#include <sstream>
61
62
63G4DiscreteGammaDeexcitation::G4DiscreteGammaDeexcitation(): 
64  _nucleusZ(0), _nucleusA(0), _max_hl(1e-6*second), _icm(false),
65  _rdm(false), _levelManager(0)
66{
67  _tolerance = 0.1 * MeV;
68}
69
70
71G4DiscreteGammaDeexcitation::~G4DiscreteGammaDeexcitation() {}
72
73
74G4VGammaTransition* G4DiscreteGammaDeexcitation::CreateTransition()
75{
76  G4Fragment nucleus = GetNucleus();
77  G4int A = static_cast<G4int>(nucleus.GetA());
78  G4int Z = static_cast<G4int>(nucleus.GetZ());
79
80  if (_nucleusA != A || _nucleusZ != Z) 
81    {
82      _nucleusA = A;
83      _nucleusZ = Z;
84      _levelManager = G4NuclearLevelStore::GetInstance()->GetManager(Z,A);
85    }
86
87
88
89  if (_levelManager->IsValid()) 
90    { 
91      if (_verbose > 1)
92        {
93          G4cout
94            << "G4DiscreteGammaDeexcitation::CreateTransition - (A,Z) is valid " 
95            << G4endl;
96        }
97       
98      G4double excitation = nucleus.GetExcitationEnergy();
99      //      const G4NuclearLevel* level =_levelManager.NearestLevel(excitation, _tolerance);
100      const G4NuclearLevel* level =_levelManager->NearestLevel(excitation);
101       
102      if (level != 0) 
103        { 
104          if (_verbose > 0)
105            G4cout
106              << "G4DiscreteGammaDeexcitation::CreateTransition - Created from level energy " 
107              << level->Energy() << ", excitation is " 
108              << excitation << G4endl;
109          G4DiscreteGammaTransition* dtransit = new G4DiscreteGammaTransition(*level,Z);
110          dtransit->SetICM(_icm); 
111          return dtransit;
112        }
113      else 
114        { 
115          if (_verbose > 0)
116            G4cout
117              << "G4DiscreteGammaDeexcitation::CreateTransition - No transition created from "
118              << excitation << " within tolerance " << _tolerance << G4endl;
119           
120          return 0; 
121        }
122    }
123  else return 0;
124}
125
126
127G4bool G4DiscreteGammaDeexcitation::CanDoTransition() const
128{
129
130  G4bool canDo = true;
131   
132  if (_transition == 0) {
133    canDo = false;
134   
135    if (_verbose > 0)
136      G4cout
137        << "G4DiscreteGammaDeexcitation::CanDoTransition - Null transition " 
138        << G4endl;
139  } 
140  G4Fragment nucleus = GetNucleus();
141  if (canDo)  {
142    G4double A = nucleus.GetA();
143    G4double Z = nucleus.GetZ();
144    if (Z<2 || A<3 || Z>98)
145      {
146        canDo = false;
147        if (_verbose > 0) 
148          G4cout
149            << "G4DiscreteGammaDeexcitation::CanDoTransition - n/p/H/>Cf"
150            << G4endl;
151      }
152  }
153
154  G4double excitation = nucleus.GetExcitationEnergy();
155
156  if (canDo) {
157    if (excitation <= 0.) {
158      canDo = false;
159      if (_verbose > 0) 
160        G4cout
161          << "G4DiscreteGammaDeexcitation::CanDoTransition -  Excitation <= 0" 
162          << G4endl;
163    } else { 
164      if (excitation > _levelManager->MaxLevelEnergy() + _tolerance) canDo = false;
165      if (excitation < _levelManager->MinLevelEnergy() - _tolerance) canDo = false; 
166      // The following is a protection to avoid looping in case of elements with very low
167      // ensdf levels
168      if (excitation < _levelManager->MinLevelEnergy() * 0.9) canDo = false; 
169 
170      if (_verbose > 0) {
171        G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition -  Excitation " 
172               << excitation << ", Min-Max are " 
173               << _levelManager->MinLevelEnergy() << " "
174               << _levelManager->MaxLevelEnergy() << G4endl;
175      }
176    }
177  }
178 
179  if (canDo) {
180    const G4NuclearLevel* level = _levelManager->NearestLevel(excitation); 
181    if (level != 0) { 
182      if (level->HalfLife() > _max_hl && !_rdm ) canDo = false;
183    } else {
184      canDo = false;
185    }
186    if (_verbose > 0) {
187      G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition -  Halflife " 
188             << level->HalfLife() << ", Calling from RDM " 
189             << (_rdm ? " True " : " False ")  << ", Max-HL = " <<  _max_hl << G4endl;
190    }
191  }
192  if (_verbose > 0) {
193    G4cout <<"G4DiscreteGammaDeexcitation::CanDoTransition - CanDo:" 
194           <<  (canDo ? " True " : " False ")  << G4endl; 
195  }
196 
197  return canDo;
198     
199}
200
Note: See TracBrowser for help on using the repository browser.