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

Last change on this file since 1337 was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 6.7 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// $Id: G4DiscreteGammaDeexcitation.cc,v 1.15 2010/05/10 07:20:40 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-01 $
28//
29// -------------------------------------------------------------------
30//      GEANT 4 class file
31//
32//      CERN, Geneva, Switzerland
33//
34//      File name:     G4DiscreteGammaDeexcitation
35//
36//      Author:        Maria Grazia Pia (pia@genova.infn.it)
37//
38//      Creation date: 23 October 1998
39//
40//      Modifications:
41//      8 March 2001, Fan Lei (flei@space.qinetiq.com)
42//         Added the following as part if the IC implementation
43//            void SetICM(G4bool hl) { _icm = hl; };
44//            void SetRDM(G4bool hl) { _rdm = hl; };
45//            void SetHL(G4double hl) { _max_hl = hl; };
46//         Changed in CreateTransition() from
47//                     return new G4DiscreteGammaTransition(*level); 
48//                 To
49//                     return new G4DiscreteGammaTransition(*level,Z);
50//         Added in CanDoTransition
51//                if (level->HalfLife() > _max_hl && !_rdm ) canDo = false;
52//     
53// -------------------------------------------------------------------
54
55#include "G4DiscreteGammaDeexcitation.hh"
56#include "G4DiscreteGammaTransition.hh"
57#include "G4NuclearLevelManager.hh"
58#include "G4NuclearLevelStore.hh"
59
60#include "G4ios.hh"
61#include <fstream>
62#include <sstream>
63
64
65G4DiscreteGammaDeexcitation::G4DiscreteGammaDeexcitation(): 
66  _nucleusZ(0), _nucleusA(0), _max_hl(1e-6*second), _icm(false),
67  _rdm(false), _levelManager(0)
68{
69  _tolerance = CLHEP::keV;
70}
71
72G4DiscreteGammaDeexcitation::~G4DiscreteGammaDeexcitation() 
73{}
74
75G4VGammaTransition* G4DiscreteGammaDeexcitation::CreateTransition()
76{
77  G4Fragment* nucleus = GetNucleus();
78  G4int A = static_cast<G4int>(nucleus->GetA());
79  G4int Z = static_cast<G4int>(nucleus->GetZ());
80  //  _verbose =2;
81  //  G4cout << "G4DiscreteGammaDeexcitation::CreateTransition: " << nucleus << G4endl;
82  if (_nucleusA != A || _nucleusZ != Z) 
83    {
84      _nucleusA = A;
85      _nucleusZ = Z;
86      _levelManager = G4NuclearLevelStore::GetInstance()->GetManager(Z,A);
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);
100       
101      if (level != 0) 
102        { 
103          if (_verbose > 0) {
104            G4cout
105              << "G4DiscreteGammaDeexcitation::CreateTransition - Created from level energy " 
106              << level->Energy() << ", excitation is " 
107              << excitation << G4endl;
108          }
109          G4DiscreteGammaTransition* dtransit = new G4DiscreteGammaTransition(*level,Z,A);
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  return 0;
124}
125
126
127G4bool G4DiscreteGammaDeexcitation::CanDoTransition() 
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  if (canDo)  {
141    if (_nucleusZ<2 || _nucleusA<3 || _nucleusZ>98)
142      {
143        canDo = false;
144        if (_verbose > 0) 
145          G4cout
146            << "G4DiscreteGammaDeexcitation::CanDoTransition - n/p/H/>Cf"
147            << G4endl;
148      }
149  }
150
151  G4Fragment* nucleus = GetNucleus();
152  G4double excitation = nucleus->GetExcitationEnergy();
153  //G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition: " << nucleus << G4endl;
154
155  if (canDo) {
156    if (excitation <= _tolerance) {
157      canDo = false;
158      if (_verbose > 0) {
159        G4cout
160          << "G4DiscreteGammaDeexcitation::CanDoTransition -  Excitation <= 0" 
161          << excitation << "  " << excitation - _tolerance
162          << G4endl;
163      }
164    } else { 
165      if (excitation > _levelManager->MaxLevelEnergy() + _tolerance) canDo = false;
166      //if (excitation < _levelManager->MinLevelEnergy() - _tolerance) canDo = false; 
167      // The following is a protection to avoid looping in case of elements with very low
168      // ensdf levels
169      //if (excitation < _levelManager->MinLevelEnergy() * 0.9) canDo = false; 
170 
171      if (_verbose > 0) {
172        G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition -  Excitation " 
173               << excitation << ", Min-Max are " 
174               << _levelManager->MinLevelEnergy() << " "
175               << _levelManager->MaxLevelEnergy() << G4endl;
176      }
177    }
178  }
179 
180  if (canDo) {
181    const G4NuclearLevel* level = _levelManager->NearestLevel(excitation); 
182    if (level != 0) { 
183      if (level->HalfLife() > _max_hl && !_rdm ) canDo = false;
184    } else {
185      canDo = false;
186    }
187    if (_verbose > 0) {
188      G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition -  Halflife " 
189             << level->HalfLife() << ", Calling from RDM " 
190             << (_rdm ? " True " : " False ")  << ", Max-HL = " <<  _max_hl << G4endl;
191    }
192  }
193  if (_verbose > 0) {
194    G4cout <<"G4DiscreteGammaDeexcitation::CanDoTransition - CanDo:" 
195           <<  (canDo ? " True " : " False ")  << G4endl; 
196  }
197 
198  return canDo;
199     
200}
201
Note: See TracBrowser for help on using the repository browser.