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

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

update ti head

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