G4DiscreteGammaDeexcitation.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 //
00028 // -------------------------------------------------------------------
00029 //      GEANT 4 class file 
00030 //
00031 //      CERN, Geneva, Switzerland
00032 //
00033 //      File name:     G4DiscreteGammaDeexcitation
00034 //
00035 //      Author:        Maria Grazia Pia (pia@genova.infn.it)
00036 // 
00037 //      Creation date: 23 October 1998
00038 //
00039 //      Modifications: 
00040 //      8 March 2001, Fan Lei (flei@space.qinetiq.com)
00041 //         Added the following as part if the IC implementation
00042 //            void SetICM(G4bool hl) { _icm = hl; };
00043 //            void SetRDM(G4bool hl) { _rdm = hl; };
00044 //            void SetHL(G4double hl) { _max_hl = hl; };
00045 //         Changed in CreateTransition() from 
00046 //                     return new G4DiscreteGammaTransition(*level);  
00047 //                 To
00048 //                     return new G4DiscreteGammaTransition(*level,Z);
00049 //         Added in CanDoTransition
00050 //                if (level->HalfLife() > _max_hl && !_rdm ) canDo = false;
00051 //
00052 //              3 November 2011 L. Desorgher
00053 //                      remove the   Z<= 98  limit
00054 //      
00055 // -------------------------------------------------------------------
00056 
00057 #include <fstream>
00058 #include <sstream>
00059 
00060 #include "G4DiscreteGammaDeexcitation.hh"
00061 #include "G4DiscreteGammaTransition.hh"
00062 #include "G4NuclearLevelManager.hh"
00063 #include "G4NuclearLevelStore.hh"
00064 #include "G4SystemOfUnits.hh"
00065 #include "G4ios.hh"
00066 
00067 G4DiscreteGammaDeexcitation::G4DiscreteGammaDeexcitation(): 
00068   _nucleusZ(0), _nucleusA(0), _max_hl(1e-6*second), _icm(false),
00069   _rdm(false), _levelManager(0)
00070 {
00071   _tolerance = CLHEP::keV;
00072 }
00073 
00074 G4DiscreteGammaDeexcitation::~G4DiscreteGammaDeexcitation() 
00075 {}
00076 
00077 G4VGammaTransition* G4DiscreteGammaDeexcitation::CreateTransition()
00078 {
00079   G4Fragment* nucleus = GetNucleus();
00080   G4int A = nucleus->GetA_asInt();
00081   G4int Z = nucleus->GetZ_asInt();
00082   //  _verbose =2;
00083   //  G4cout << "G4DiscreteGammaDeexcitation::CreateTransition: " << nucleus << G4endl;
00084   if (_nucleusA != A || _nucleusZ != Z) 
00085     {
00086       _nucleusA = A;
00087       _nucleusZ = Z;
00088       _levelManager = G4NuclearLevelStore::GetInstance()->GetManager(Z,A);
00089     }
00090 
00091   if (_levelManager->IsValid()) 
00092     { 
00093       if (_verbose > 1)
00094         {
00095           G4cout 
00096             << "G4DiscreteGammaDeexcitation::CreateTransition - (A,Z) is valid " 
00097             << G4endl;
00098         }
00099         
00100       G4double excitation = nucleus->GetExcitationEnergy();
00101       const G4NuclearLevel* level =_levelManager->NearestLevel(excitation);
00102         
00103       if (level != 0)  
00104         { 
00105           if (_verbose > 0) {
00106             G4cout 
00107               << "G4DiscreteGammaDeexcitation::CreateTransition - Created from level energy " 
00108               << level->Energy() << ", excitation is " 
00109               << excitation << G4endl;
00110           }
00111           G4DiscreteGammaTransition* dtransit = new G4DiscreteGammaTransition(*level,Z,A);
00112           dtransit->SetICM(_icm);  
00113           return dtransit;
00114         }
00115       else 
00116         { 
00117           if (_verbose > 0) {
00118             G4cout 
00119               << "G4DiscreteGammaDeexcitation::CreateTransition - No transition created from "
00120               << excitation << " within tolerance " << _tolerance << G4endl;
00121           }
00122           return 0; 
00123         }
00124     }
00125   return 0;
00126 }
00127 
00128 
00129 G4bool G4DiscreteGammaDeexcitation::CanDoTransition() 
00130 {
00131 
00132   G4bool canDo = true;
00133     
00134   if (_transition == 0) {
00135     canDo = false;
00136     
00137     if (_verbose > 0)
00138       G4cout 
00139         << "G4DiscreteGammaDeexcitation::CanDoTransition - Null transition " 
00140         << G4endl;
00141   } 
00142   if (canDo)  {
00143         //remove the   _nucleusZ>98 limit L. Desorgher Sept. 2011
00144     //if (_nucleusZ<2 || _nucleusA<3 || _nucleusZ>98)
00145          if (_nucleusZ<2 || _nucleusA<3 )
00146       {
00147         canDo = false;
00148         if (_verbose > 0) 
00149           G4cout 
00150             << "G4DiscreteGammaDeexcitation::CanDoTransition - n/p/H/>Cf"
00151             << G4endl;
00152       }
00153   }
00154 
00155   G4Fragment* nucleus = GetNucleus();
00156   G4double excitation = nucleus->GetExcitationEnergy();
00157   //G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition: " << nucleus << G4endl;
00158 
00159   if (canDo) {
00160     if (excitation <= _tolerance) {
00161       canDo = false;
00162       if (_verbose > 0) {
00163         G4cout 
00164           << "G4DiscreteGammaDeexcitation::CanDoTransition -  Excitation <= 0" 
00165           << excitation << "  " << excitation - _tolerance
00166           << G4endl;
00167       }
00168     } else { 
00169       if (excitation > _levelManager->MaxLevelEnergy() + _tolerance) { canDo = false; }
00170       //if (excitation < _levelManager->MinLevelEnergy() - _tolerance) canDo = false;  
00171       // The following is a protection to avoid looping in case of elements with very low
00172       // ensdf levels
00173       //if (excitation < _levelManager->MinLevelEnergy() * 0.9) canDo = false;  
00174   
00175       if (_verbose > 0) {
00176         G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition -  Excitation " 
00177                << excitation << ", Min-Max are " 
00178                << _levelManager->MinLevelEnergy() << " "
00179                << _levelManager->MaxLevelEnergy() << G4endl;
00180       }
00181     }
00182   }
00183   
00184   if (canDo) {
00185     const G4NuclearLevel* level = _levelManager->NearestLevel(excitation);  
00186     if (!level) { 
00187       canDo = false; 
00188  
00189     } else {
00190       if (level->HalfLife() > _max_hl && !_rdm ) { canDo = false; }
00191       
00192       if (_verbose > 0) {
00193         G4cout << "G4DiscreteGammaDeexcitation::CanDoTransition -  Halflife " 
00194                << level->HalfLife() << ", Calling from RDM " 
00195                << (_rdm ? " True " : " False ")  << ", Max-HL = " <<  _max_hl 
00196                << G4endl;
00197       }
00198     }
00199   }
00200   if (_verbose > 0) {
00201     G4cout <<"G4DiscreteGammaDeexcitation::CanDoTransition - CanDo: " 
00202            <<  (canDo ? " True " : " False ")  << G4endl; 
00203   }
00204   
00205   return canDo;
00206       
00207 }
00208 

Generated on Mon May 27 17:48:01 2013 for Geant4 by  doxygen 1.4.7