G4NuclearLevel.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 //      For information related to this code contact:
00032 //      CERN, IT Division, ASD group
00033 //      CERN, Geneva, Switzerland
00034 //
00035 //      File name:     G4NuclearLevel
00036 //
00037 //      Author:        Maria Grazia Pia (pia@genova.infn.it)
00038 // 
00039 //      Creation date: 24 October 1998
00040 //
00041 //      Modifications: 
00042 //        06 Oct 2010, M. Kelsey (kelsey@slac.stanford.edu)
00043 //              Add friendship for G4NuclearLevelManager; define private
00044 //              constructors without vectors.
00045 //
00046 //        09 Sep. 2002, Fan Lei  (flei@space.qinetiq.com)
00047 //              Added IC probability when calculate the channel probabilities in 
00048 //              MakeProbabilities().
00049 //
00050 //        21 Nov. 2001, Fan Lei (flei@space.qinetiq.com)
00051 //              Added K->N+ internal  conversion coefficiencies and their access
00052 //              functions.
00053 //      
00054 //        15 April 1999, Alessandro Brunengo (Alessandro.Brunengo@ge.infn.it)
00055 //              Added half-life, angular momentum, parity, emissioni type
00056 //              reading from experimental data. 
00057 //      
00058 //        28 October 2010, V.Ivanchenko moved copy constructor to source, cleanup
00059 //
00060 // -------------------------------------------------------------------
00061 
00062 #include "G4NuclearLevel.hh"
00063 #include "globals.hh"
00064 
00065 G4int G4NuclearLevel::Increment(G4int aF)
00066 {
00067   static G4int instanceCount = 0;
00068   instanceCount+=aF;
00069   return instanceCount;
00070 }
00071 
00072 G4NuclearLevel::G4NuclearLevel()
00073   : _energy(0.), _halfLife(0.), _angularMomentum(0.), _nGammas(0) {
00074   // G4cout << "####### Incrementing "<<Increment(1)<<G4endl;
00075 }
00076 
00077 G4NuclearLevel::G4NuclearLevel(G4double energy, G4double halfLife,
00078                                G4double angularMomentum)
00079   : _energy(energy), _halfLife(halfLife), _angularMomentum(angularMomentum),
00080     _nGammas(0) {
00081   // G4cout << "####### Incrementing "<<Increment(1)<<G4endl;
00082 }
00083 
00084 G4NuclearLevel::G4NuclearLevel(G4double energy, G4double halfLife,
00085                                G4double angularMomentum,
00086                                const std::vector<G4double>& eGamma,
00087                                const std::vector<G4double>& wGamma,
00088                                const std::vector<G4double>& polarities,
00089                                const std::vector<G4double>& kCC, const std::vector<G4double>& l1CC,
00090                                const std::vector<G4double>& l2CC, const std::vector<G4double>& l3CC,
00091                                const std::vector<G4double>& m1CC, const std::vector<G4double>& m2CC,
00092                                const std::vector<G4double>& m3CC, const std::vector<G4double>& m4CC,
00093                                const std::vector<G4double>& m5CC, const std::vector<G4double>& nPlusCC,
00094                                const std::vector<G4double>& totalCC)
00095 
00096   : _energies(eGamma), _weights(wGamma), _polarities(polarities),
00097      _kCC(kCC), _l1CC(l1CC), _l2CC(l2CC), _l3CC(l3CC),
00098     _m1CC(m1CC), _m2CC(m2CC), _m3CC(m3CC), _m4CC(m4CC), _m5CC(m5CC),
00099     _nPlusCC(nPlusCC), _totalCC(totalCC),
00100     _energy(energy), _halfLife(halfLife), _angularMomentum(angularMomentum)
00101 {
00102   Finalize();
00103   // G4cout << "####### Incrementing "<<Increment(1)<<G4endl;
00104 }
00105 
00106 G4NuclearLevel::~G4NuclearLevel()
00107 { 
00108  // G4cout << "####### Decrementing "<<Increment(-1)<<G4endl;
00109 }
00110 
00111 G4bool G4NuclearLevel::operator==(const G4NuclearLevel &right) const
00112 {
00113   return (this == (G4NuclearLevel *) &right);
00114 }
00115 
00116 
00117 G4bool G4NuclearLevel::operator!=(const G4NuclearLevel &right) const
00118 {
00119   return (this != (G4NuclearLevel *) &right);
00120 }
00121 
00122 G4bool G4NuclearLevel::operator<(const G4NuclearLevel &right) const  
00123 {
00124   if (_energy < right.Energy()) return true;
00125   else return false;
00126 }
00127 
00128 const std::vector<G4double>& G4NuclearLevel::GammaEnergies() const
00129 {
00130   return _energies;
00131 }
00132  
00133 const std::vector<G4double>& G4NuclearLevel::GammaWeights() const
00134 {
00135   return _weights;
00136 }
00137  
00138 
00139 const std::vector<G4double>& G4NuclearLevel::GammaProbabilities() const
00140 {
00141   return _prob;
00142 }
00143  
00144 
00145 const std::vector<G4double>& G4NuclearLevel::GammaCumulativeProbabilities() const
00146 {
00147   return _cumProb;
00148 }
00149  
00150 
00151 const std::vector<G4double>& G4NuclearLevel::GammaPolarities() const
00152 {
00153   return _polarities;
00154 }
00155  
00156 const std::vector<G4double>& G4NuclearLevel::KConvertionProbabilities() const
00157 {
00158   return _kCC;
00159 }
00160  
00161 const std::vector<G4double>& G4NuclearLevel::L1ConvertionProbabilities() const
00162 {
00163   return _l1CC;
00164 }
00165  
00166 const std::vector<G4double>& G4NuclearLevel::L2ConvertionProbabilities() const
00167 {
00168   return _l2CC;
00169 }
00170  
00171 const std::vector<G4double>& G4NuclearLevel::L3ConvertionProbabilities() const
00172 {
00173   return _l3CC;
00174 }
00175  
00176 const std::vector<G4double>& G4NuclearLevel::M1ConvertionProbabilities() const
00177 {
00178   return _m1CC;
00179 }
00180  
00181 const std::vector<G4double>& G4NuclearLevel::M2ConvertionProbabilities() const
00182 {
00183   return _m2CC;
00184 }
00185  
00186 const std::vector<G4double>& G4NuclearLevel::M3ConvertionProbabilities() const
00187 {
00188   return _m3CC;
00189 }
00190  
00191 const std::vector<G4double>& G4NuclearLevel::M4ConvertionProbabilities() const
00192 {
00193   return _m4CC;
00194 }
00195  
00196 const std::vector<G4double>& G4NuclearLevel::M5ConvertionProbabilities() const
00197 {
00198   return _m5CC;
00199 }
00200  
00201 const std::vector<G4double>& G4NuclearLevel::NPlusConvertionProbabilities() const
00202 {
00203   return _nPlusCC;
00204 }
00205  
00206 const std::vector<G4double>& G4NuclearLevel::TotalConvertionProbabilities() const
00207 {
00208   return _totalCC;
00209 }
00210  
00211 G4double G4NuclearLevel::Energy() const
00212 {
00213   return _energy;
00214 }
00215  
00216 G4double G4NuclearLevel::AngularMomentum() const
00217 {
00218   return _angularMomentum;
00219 }
00220  
00221 G4double G4NuclearLevel::HalfLife() const
00222 {
00223   return _halfLife;
00224 }
00225  
00226 G4int G4NuclearLevel::NumberOfGammas() const
00227 {
00228   return _nGammas;
00229 }
00230  
00231 
00232 void G4NuclearLevel::PrintAll() const 
00233 {
00234   G4cout << "---- Level energy = " << _energy << ", angular momentum = "
00235          << _angularMomentum << ", half life " << _halfLife
00236          << ", " << _nGammas << " photons" << G4endl;
00237   G4int i;
00238   G4cout << "     Gammas: ";
00239   for (i=0; i<_nGammas; i++) { G4cout << _energies[i] << " "; }
00240   G4cout << G4endl << "     Weights: ";
00241   for (i=0; i<_nGammas; i++) { G4cout << _weights[i] << " "; }
00242   G4cout << G4endl << "     Relative transition probabilities ";
00243   for (i=0; i<_nGammas; i++) { G4cout << _prob[i] << " "; }
00244   G4cout << G4endl << "     Cumulative probabilities: ";
00245   for (i=0; i<_nGammas; i++) { G4cout << _cumProb[i] << " "; }
00246   G4cout << G4endl << "     Polarities: ";
00247   for (i=0; i<_nGammas; i++) { G4cout << _polarities[i] << " "; }
00248   G4cout << G4endl;      
00249 
00250   return;
00251 }
00252 
00253 
00254 void G4NuclearLevel::Finalize() {
00255   _nGammas = _energies.size();
00256   MakeProbabilities();
00257   MakeCumProb();
00258 }
00259 
00260 
00261 void G4NuclearLevel::MakeProbabilities()
00262 {
00263   G4double sum = 0.;
00264   G4int i = 0;
00265   for (i=0; i<_nGammas; i++) {
00266     sum += _weights[i]*(1.+_totalCC[i]);
00267   }
00268 
00269   if (sum <= 0.) _prob.resize(_nGammas, 1./_nGammas);   // Fast fill
00270   else {
00271     _prob.reserve(_nGammas);
00272     for (i=0; i<_nGammas; i++) {
00273       _prob.push_back(_weights[i]*(1.+_totalCC[i])/sum);
00274     }
00275   }
00276 }
00277 
00278 
00279 void G4NuclearLevel::MakeCumProb()
00280 {
00281   if (_nGammas <= 0) return;
00282 
00283   _cumProb.reserve(_nGammas);
00284 
00285   G4double sum = _prob[0];
00286   _cumProb.push_back(sum);
00287   
00288   for (G4int i=1; i<_nGammas; i++) {
00289     sum += _prob[i];
00290     _cumProb.push_back(sum);
00291   }
00292 }
00293 
00294 G4NuclearLevel& G4NuclearLevel::operator=(const G4NuclearLevel &right)
00295 {
00296   if(this != &right)
00297     {
00298       _energies = right._energies;
00299       _weights =right._weights;
00300       _prob =right._prob;
00301       _cumProb =right._cumProb;
00302       _polarities =right._polarities;
00303       _kCC = right._kCC;
00304       _l1CC =right._l1CC;
00305       _l2CC =right._l2CC;
00306       _l3CC =right._l3CC;
00307       _m1CC = right._m1CC;
00308       _m2CC = right._m2CC;
00309       _m3CC = right._m3CC;
00310       _m4CC = right._m4CC;
00311       _m5CC = right._m5CC;
00312       _nPlusCC = right._nPlusCC;
00313       _totalCC = right._totalCC;
00314       _energy = right._energy;
00315       _halfLife = right._halfLife;
00316       _angularMomentum = right._angularMomentum;
00317       _nGammas = right._nGammas;
00318     }
00319   return *this;
00320 }
00321 
00322 G4NuclearLevel::G4NuclearLevel(const G4NuclearLevel &right)
00323 {
00324   _energies = right._energies;
00325   _weights =right._weights;
00326   _prob =right._prob;
00327   _cumProb =right._cumProb;
00328   _polarities =right._polarities;
00329   _kCC = right._kCC;
00330   _l1CC =right._l1CC;
00331   _l2CC =right._l2CC;
00332   _l3CC =right._l3CC;
00333   _m1CC = right._m1CC;
00334   _m2CC = right._m2CC;
00335   _m3CC = right._m3CC;
00336   _m4CC = right._m4CC;
00337   _m5CC = right._m5CC;
00338   _nPlusCC = right._nPlusCC;
00339   _totalCC = right._totalCC;
00340   _energy = right._energy;
00341   _halfLife = right._halfLife;
00342   _angularMomentum = right._angularMomentum;
00343   _nGammas = right._nGammas;
00344 }
00345 
00346 
00347 

Generated on Mon May 27 17:49:06 2013 for Geant4 by  doxygen 1.4.7