Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4SmpNugDist.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 // This software was developed by Lawrence Livermore National Laboratory.
28 //
29 // Redistribution and use in source and binary forms, with or without
30 // modification, are permitted provided that the following conditions are met:
31 //
32 // 1. Redistributions of source code must retain the above copyright notice,
33 // this list of conditions and the following disclaimer.
34 // 2. Redistributions in binary form must reproduce the above copyright notice,
35 // this list of conditions and the following disclaimer in the documentation
36 // and/or other materials provided with the distribution.
37 // 3. The name of the author may not be used to endorse or promote products
38 // derived from this software without specific prior written permission.
39 //
40 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
41 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
42 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
43 // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
45 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
46 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
47 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
48 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
49 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 //
51 // Copyright (c) 2006 The Regents of the University of California.
52 // All rights reserved.
53 // UCRL-CODE-224807
54 //
55 //
56 // $Id: G4SmpNugDist.cc 68799 2013-04-05 13:29:46Z gcosmo $
57 //
58 
59 #include <cmath>
60 #include "G4fissionEvent.hh"
61 #include "G4Exp.hh"
62 #include "G4Log.hh"
63 #include "G4Pow.hh"
64 
65 #define nfissg 40
66 #define alphanegbin 26
67 
68 G4int G4fissionEvent::G4SmpNugDist(G4int isotope, G4double nubar) {
69 
70 /*
71  Description
72  Sample Number of Photons from neutron induced fission in
73  all isotopes using Tim Valentine's model (negative binomial
74  distribution, using nubar as a model parameter)
75 */
76 
77 /*
78  Input
79  iso - isotope
80  Output
81  G4SmpNugDist - sampled multiplicity
82 */
83 
84  static G4double logcoeff[nfissg+1] = {
85  0.00000000000000e+00,
86  3.25809653802149e+00,
87  5.86078622346587e+00,
88  8.09437844497297e+00,
89  1.00753799138395e+01,
90  1.18671393830676e+01,
91  1.35093671183247e+01,
92  1.50291928720691e+01,
93  1.64462588918558e+01,
94  1.77753948391357e+01,
95  1.90281578076311e+01,
96  2.02137814732888e+01,
97  2.13397927361450e+01,
98  2.24124295384099e+01,
99  2.34369338549243e+01,
100  2.44177631079360e+01,
101  2.53587464524005e+01,
102  2.62632027266277e+01,
103  2.71340310844251e+01,
104  2.79737817391769e+01,
105  2.87847119553932e+01,
106  2.95688309141589e+01,
107  3.03279360625106e+01,
108  3.10636428574894e+01,
109  3.17774093252521e+01,
110  3.24705565058120e+01,
111  3.31442856005149e+01,
112  3.37996924530920e+01,
113  3.44377798564689e+01,
114  3.50594680730467e+01,
115  3.56656038766170e+01,
116  3.62569683628670e+01,
117  3.68342837279018e+01,
118  3.73982191769817e+01,
119  3.79493960962713e+01,
120  3.84883925970040e+01,
121  3.90157475227212e+01,
122  3.95319639951220e+01,
123  4.00375125617872e+01,
124  4.05328339990172e+01,
125  4.10183418147990e+01
126  };
127  G4int i, A, Z;
128  G4double cpi[nfissg+1];
129  G4double p, q, nubarg;
130  G4double r;
131 
132 /*
133  No data is available for induced fission gamma number
134  distributions. Sample the negative binomial cumulative
135  probability distribution.
136 */
137  A = (G4int) (isotope-1000*((G4int)(isotope/1000)));
138  Z = (G4int) ((isotope-A)/1000);
139  G4Pow* Pow = G4Pow::GetInstance();
140  nubarg = ((2.51-1.13e-5*Pow->powA(G4double(Z),2.)*std::sqrt(G4double(A)))*nubar+4.0)
141  /(-1.33+119.6*Pow->A13(G4double(Z))/G4double(A));
142  p = 1.*alphanegbin/(alphanegbin+nubarg);
143  q = 1.-p;
144  cpi[0] = G4Exp(logcoeff[0]+26.*G4Log(p));
145  for (i=1; i<=nfissg; i++) cpi[i] = cpi[i-1] + G4Exp(logcoeff[i]+26.*G4Log(p)+i*G4Log(q));
146  for (i=0; i<=nfissg; i++) cpi[i] = cpi[i]/cpi[nfissg-1];
147 
148  r=fisslibrng();
149 
150  for(i=0; i<=nfissg; i++) if (r <= cpi[i]) return i;
151 
152  //
153  // Fall through
154  //
155 
156  G4cout << " SmpNugDist: random number " << r << " out of range " << G4endl;
157  return -1;
158 
159 }
static G4Pow * GetInstance()
Definition: G4Pow.cc:55
G4double powA(G4double A, G4double y) const
Definition: G4Pow.hh:259
Definition: G4Pow.hh:56
const char * p
Definition: xmltok.h:285
int G4int
Definition: G4Types.hh:78
#define alphanegbin
Definition: G4SmpNugDist.cc:66
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
#define nfissg
Definition: G4SmpNugDist.cc:65
G4double G4Log(G4double x)
Definition: G4Log.hh:230
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:183
G4double A13(G4double A) const
Definition: G4Pow.hh:132
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76