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