source: trunk/source/processes/hadronic/models/de_excitation/photon_evaporation/src/G4NuclearLevel.cc @ 1348

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

geant4 tag 9.4

File size: 9.8 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: G4NuclearLevel.cc,v 1.7 2010/11/17 16:50:53 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-04-ref-00 $
28//
29// -------------------------------------------------------------------
30//      GEANT 4 class file
31//
32//      For information related to this code contact:
33//      CERN, IT Division, ASD group
34//      CERN, Geneva, Switzerland
35//
36//      File name:     G4NuclearLevel
37//
38//      Author:        Maria Grazia Pia (pia@genova.infn.it)
39//
40//      Creation date: 24 October 1998
41//
42//      Modifications:
43//        06 Oct 2010, M. Kelsey (kelsey@slac.stanford.edu)
44//              Add friendship for G4NuclearLevelManager; define private
45//              constructors without vectors.
46//
47//        09 Sep. 2002, Fan Lei  (flei@space.qinetiq.com)
48//              Added IC probability when calculate the channel probabilities in
49//              MakeProbabilities().
50//
51//        21 Nov. 2001, Fan Lei (flei@space.qinetiq.com)
52//              Added K->N+ internal  conversion coefficiencies and their access
53//              functions.
54//     
55//        15 April 1999, Alessandro Brunengo (Alessandro.Brunengo@ge.infn.it)
56//              Added half-life, angular momentum, parity, emissioni type
57//              reading from experimental data.
58//     
59//        28 October 2010, V.Ivanchenko moved copy constructor to source, cleanup
60//
61// -------------------------------------------------------------------
62
63#include "G4NuclearLevel.hh"
64#include "globals.hh"
65
66G4int G4NuclearLevel::Increment(G4int aF)
67{
68  static G4int instanceCount = 0;
69  instanceCount+=aF;
70  return instanceCount;
71}
72
73G4NuclearLevel::G4NuclearLevel()
74  : _energy(0.), _halfLife(0.), _angularMomentum(0.), _nGammas(0) {
75  // G4cout << "####### Incrementing "<<Increment(1)<<G4endl;
76}
77
78G4NuclearLevel::G4NuclearLevel(G4double energy, G4double halfLife,
79                               G4double angularMomentum)
80  : _energy(energy), _halfLife(halfLife), _angularMomentum(angularMomentum),
81    _nGammas(0) {
82  // G4cout << "####### Incrementing "<<Increment(1)<<G4endl;
83}
84
85G4NuclearLevel::G4NuclearLevel(G4double energy, G4double halfLife,
86                               G4double angularMomentum,
87                               const std::vector<G4double>& eGamma,
88                               const std::vector<G4double>& wGamma,
89                               const std::vector<G4double>& polarities,
90                               const std::vector<G4double>& kCC, const std::vector<G4double>& l1CC,
91                               const std::vector<G4double>& l2CC, const std::vector<G4double>& l3CC,
92                               const std::vector<G4double>& m1CC, const std::vector<G4double>& m2CC,
93                               const std::vector<G4double>& m3CC, const std::vector<G4double>& m4CC,
94                               const std::vector<G4double>& m5CC, const std::vector<G4double>& nPlusCC,
95                               const std::vector<G4double>& totalCC)
96
97  : _energies(eGamma), _weights(wGamma), _polarities(polarities),
98     _kCC(kCC), _l1CC(l1CC), _l2CC(l2CC), _l3CC(l3CC),
99    _m1CC(m1CC), _m2CC(m2CC), _m3CC(m3CC), _m4CC(m4CC), _m5CC(m5CC),
100    _nPlusCC(nPlusCC), _totalCC(totalCC),
101    _energy(energy), _halfLife(halfLife), _angularMomentum(angularMomentum)
102{
103  Finalize();
104  // G4cout << "####### Incrementing "<<Increment(1)<<G4endl;
105}
106
107G4NuclearLevel::~G4NuclearLevel()
108{ 
109 // G4cout << "####### Decrementing "<<Increment(-1)<<G4endl;
110}
111
112G4bool G4NuclearLevel::operator==(const G4NuclearLevel &right) const
113{
114  return (this == (G4NuclearLevel *) &right);
115}
116
117
118G4bool G4NuclearLevel::operator!=(const G4NuclearLevel &right) const
119{
120  return (this != (G4NuclearLevel *) &right);
121}
122
123G4bool G4NuclearLevel::operator<(const G4NuclearLevel &right) const 
124{
125  if (_energy < right.Energy()) return true;
126  else return false;
127}
128
129const std::vector<G4double>& G4NuclearLevel::GammaEnergies() const
130{
131  return _energies;
132}
133 
134const std::vector<G4double>& G4NuclearLevel::GammaWeights() const
135{
136  return _weights;
137}
138 
139
140const std::vector<G4double>& G4NuclearLevel::GammaProbabilities() const
141{
142  return _prob;
143}
144 
145
146const std::vector<G4double>& G4NuclearLevel::GammaCumulativeProbabilities() const
147{
148  return _cumProb;
149}
150 
151
152const std::vector<G4double>& G4NuclearLevel::GammaPolarities() const
153{
154  return _polarities;
155}
156 
157const std::vector<G4double>& G4NuclearLevel::KConvertionProbabilities() const
158{
159  return _kCC;
160}
161 
162const std::vector<G4double>& G4NuclearLevel::L1ConvertionProbabilities() const
163{
164  return _l1CC;
165}
166 
167const std::vector<G4double>& G4NuclearLevel::L2ConvertionProbabilities() const
168{
169  return _l2CC;
170}
171 
172const std::vector<G4double>& G4NuclearLevel::L3ConvertionProbabilities() const
173{
174  return _l3CC;
175}
176 
177const std::vector<G4double>& G4NuclearLevel::M1ConvertionProbabilities() const
178{
179  return _m1CC;
180}
181 
182const std::vector<G4double>& G4NuclearLevel::M2ConvertionProbabilities() const
183{
184  return _m2CC;
185}
186 
187const std::vector<G4double>& G4NuclearLevel::M3ConvertionProbabilities() const
188{
189  return _m3CC;
190}
191 
192const std::vector<G4double>& G4NuclearLevel::M4ConvertionProbabilities() const
193{
194  return _m4CC;
195}
196 
197const std::vector<G4double>& G4NuclearLevel::M5ConvertionProbabilities() const
198{
199  return _m5CC;
200}
201 
202const std::vector<G4double>& G4NuclearLevel::NPlusConvertionProbabilities() const
203{
204  return _nPlusCC;
205}
206 
207const std::vector<G4double>& G4NuclearLevel::TotalConvertionProbabilities() const
208{
209  return _totalCC;
210}
211 
212G4double G4NuclearLevel::Energy() const
213{
214  return _energy;
215}
216 
217G4double G4NuclearLevel::AngularMomentum() const
218{
219  return _angularMomentum;
220}
221 
222G4double G4NuclearLevel::HalfLife() const
223{
224  return _halfLife;
225}
226 
227G4int G4NuclearLevel::NumberOfGammas() const
228{
229  return _nGammas;
230}
231 
232
233void G4NuclearLevel::PrintAll() const 
234{
235  G4cout << "---- Level energy = " << _energy << ", angular momentum = "
236         << _angularMomentum << ", half life " << _halfLife
237         << ", " << _nGammas << " photons" << G4endl;
238  G4int i;
239  G4cout << "     Gammas: ";
240  for (i=0; i<_nGammas; i++) { G4cout << _energies[i] << " "; }
241  G4cout << G4endl << "     Weights: ";
242  for (i=0; i<_nGammas; i++) { G4cout << _weights[i] << " "; }
243  G4cout << G4endl << "     Relative transition probabilities ";
244  for (i=0; i<_nGammas; i++) { G4cout << _prob[i] << " "; }
245  G4cout << G4endl << "     Cumulative probabilities: ";
246  for (i=0; i<_nGammas; i++) { G4cout << _cumProb[i] << " "; }
247  G4cout << G4endl << "     Polarities: ";
248  for (i=0; i<_nGammas; i++) { G4cout << _polarities[i] << " "; }
249  G4cout << G4endl;     
250
251  return;
252}
253
254
255void G4NuclearLevel::Finalize() {
256  _nGammas = _energies.size();
257  MakeProbabilities();
258  MakeCumProb();
259}
260
261
262void G4NuclearLevel::MakeProbabilities()
263{
264  G4double sum = 0.;
265  G4int i = 0;
266  for (i=0; i<_nGammas; i++) {
267    sum += _weights[i]*(1.+_totalCC[i]);
268  }
269
270  if (sum <= 0.) _prob.resize(_nGammas, 1./_nGammas);   // Fast fill
271  else {
272    _prob.reserve(_nGammas);
273    for (i=0; i<_nGammas; i++) {
274      _prob.push_back(_weights[i]*(1.+_totalCC[i])/sum);
275    }
276  }
277}
278
279
280void G4NuclearLevel::MakeCumProb()
281{
282  if (_nGammas <= 0) return;
283
284  _cumProb.reserve(_nGammas);
285
286  G4double sum = _prob[0];
287  _cumProb.push_back(sum);
288 
289  for (G4int i=1; i<_nGammas; i++) {
290    sum += _prob[i];
291    _cumProb.push_back(sum);
292  }
293}
294
295const G4NuclearLevel& G4NuclearLevel::operator=(const G4NuclearLevel &right)
296{
297  if(this != &right)
298    {
299      _energies = right._energies;
300      _weights =right._weights;
301      _prob =right._prob;
302      _cumProb =right._cumProb;
303      _polarities =right._polarities;
304      _kCC = right._kCC;
305      _l1CC =right._l1CC;
306      _l2CC =right._l2CC;
307      _l3CC =right._l3CC;
308      _m1CC = right._m1CC;
309      _m2CC = right._m2CC;
310      _m3CC = right._m3CC;
311      _m4CC = right._m4CC;
312      _m5CC = right._m5CC;
313      _nPlusCC = right._nPlusCC;
314      _totalCC = right._totalCC;
315      _energy = right._energy;
316      _halfLife = right._halfLife;
317      _angularMomentum = right._angularMomentum;
318      _nGammas = right._nGammas;
319    }
320  return *this;
321}
322
323G4NuclearLevel::G4NuclearLevel(const G4NuclearLevel &right)
324{
325  _energies = right._energies;
326  _weights =right._weights;
327  _prob =right._prob;
328  _cumProb =right._cumProb;
329  _polarities =right._polarities;
330  _kCC = right._kCC;
331  _l1CC =right._l1CC;
332  _l2CC =right._l2CC;
333  _l3CC =right._l3CC;
334  _m1CC = right._m1CC;
335  _m2CC = right._m2CC;
336  _m3CC = right._m3CC;
337  _m4CC = right._m4CC;
338  _m5CC = right._m5CC;
339  _nPlusCC = right._nPlusCC;
340  _totalCC = right._totalCC;
341  _energy = right._energy;
342  _halfLife = right._halfLife;
343  _angularMomentum = right._angularMomentum;
344  _nGammas = right._nGammas;
345}
346
347
348
Note: See TracBrowser for help on using the repository browser.