Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FissionStore.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//
27// 20100728 Move ::addConfig() implementation to .cc file
28// 20110801 Make configuration probs a data member array, reduce memory churn
29// 20110922 Replace config::print() with stream output.
30// 20150608 M. Kelsey -- Label all while loops as terminating.
31// 20150619 M. Kelsey -- Replace std::exp with G4Exp
32
33#include "G4FissionStore.hh"
35#include "G4Exp.hh"
36
37
38G4FissionStore::G4FissionStore() : verboseLevel(0) {
39 if (verboseLevel > 1)
40 G4cout << " >>> G4FissionStore::G4FissionStore" << G4endl;
41}
42
44 G4double ek, G4double ev) {
45 G4FissionConfiguration config(a, z, ez, ek, ev);
46 configurations.push_back(config);
47 if (verboseLevel > 2) G4cout << config << G4endl;
48}
49
51 G4double rand) const {
52 if (verboseLevel > 1)
53 G4cout << " >>> G4FissionStore::generateConfiguration" << G4endl;
54
55 const G4double small = -30.0;
56
57 G4double totProb = 0.0;
58 configProbs.resize(size(),0.);
59
60 if (verboseLevel > 3)
61 G4cout << " amax " << amax << " ic " << size() << G4endl;
62
63 for (size_t i = 0; i < size(); i++) {
64 G4double ez = configurations[i].ezet;
65 G4double pr = ez - amax;
66
67 if (pr < small) pr = small;
68 pr = G4Exp(pr);
69 if (verboseLevel > 2) {
70 G4cout << configurations[i] << "\n probability " << pr << G4endl;
71 }
72 totProb += pr;
73 configProbs[i] = totProb;
74 };
75
76 G4double st = totProb * rand;
77
78 size_t igen = 0;
79 /* Loop checking 08.06.2015 MHK */
80 while (configProbs[igen] <= st && igen < size()) igen++;
81
82 if (verboseLevel > 3) G4cout << " igen " << igen << G4endl;
83
84 return configurations[igen];
85}
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition G4Exp.hh:180
double G4double
Definition G4Types.hh:83
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
size_t size() const
void addConfig(G4double a, G4double z, G4double ez, G4double ek, G4double ev)
G4FissionConfiguration generateConfiguration(G4double amax, G4double rand) const
struct config_s config