Geant4  10.01.p03
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 
62 #define nfissg 40
63 #define alphanegbin 26
64 
66 
67 /*
68  Description
69  Sample Number of Photons from neutron induced fission in
70  all isotopes using Tim Valentine's model (negative binomial
71  distribution, using nubar as a model parameter)
72 */
73 
74 /*
75  Input
76  iso - isotope
77  Output
78  G4SmpNugDist - sampled multiplicity
79 */
80 
81  static G4double logcoeff[nfissg+1] = {
82  0.00000000000000e+00,
83  3.25809653802149e+00,
84  5.86078622346587e+00,
85  8.09437844497297e+00,
86  1.00753799138395e+01,
87  1.18671393830676e+01,
88  1.35093671183247e+01,
89  1.50291928720691e+01,
90  1.64462588918558e+01,
91  1.77753948391357e+01,
92  1.90281578076311e+01,
93  2.02137814732888e+01,
94  2.13397927361450e+01,
95  2.24124295384099e+01,
96  2.34369338549243e+01,
97  2.44177631079360e+01,
98  2.53587464524005e+01,
99  2.62632027266277e+01,
100  2.71340310844251e+01,
101  2.79737817391769e+01,
102  2.87847119553932e+01,
103  2.95688309141589e+01,
104  3.03279360625106e+01,
105  3.10636428574894e+01,
106  3.17774093252521e+01,
107  3.24705565058120e+01,
108  3.31442856005149e+01,
109  3.37996924530920e+01,
110  3.44377798564689e+01,
111  3.50594680730467e+01,
112  3.56656038766170e+01,
113  3.62569683628670e+01,
114  3.68342837279018e+01,
115  3.73982191769817e+01,
116  3.79493960962713e+01,
117  3.84883925970040e+01,
118  3.90157475227212e+01,
119  3.95319639951220e+01,
120  4.00375125617872e+01,
121  4.05328339990172e+01,
122  4.10183418147990e+01
123  };
124  G4int i, A, Z;
125  G4double cpi[nfissg+1];
126  G4double p, q, nubarg;
127  G4double r;
128 
129 /*
130  No data is available for induced fission gamma number
131  distributions. Sample the negative binomial cumulative
132  probability distribution.
133 */
134  A = (G4int) (isotope-1000*((G4int)(isotope/1000)));
135  Z = (G4int) ((isotope-A)/1000);
136  nubarg = ((2.51-1.13e-5*std::pow(G4double(Z),2.)*std::sqrt(G4double(A)))*nubar+4.0)
137  /(-1.33+119.6*std::pow(G4double(Z),1./3.)/G4double(A));
138  p = 1.*alphanegbin/(alphanegbin+nubarg);
139  q = 1.-p;
140  cpi[0] = std::exp(logcoeff[0]+26.*std::log(p));
141  for (i=1; i<=nfissg; i++) cpi[i] = cpi[i-1] + std::exp(logcoeff[i]+26.*std::log(p)+i*std::log(q));
142  for (i=0; i<=nfissg; i++) cpi[i] = cpi[i]/cpi[nfissg-1];
143 
144  r=fisslibrng();
145 
146  for(i=0; i<=nfissg; i++) if (r <= cpi[i]) return i;
147 
148  //
149  // Fall through
150  //
151 
152  G4cout << " SmpNugDist: random number " << r << " out of range " << G4endl;
153  return -1;
154 
155 }
static G4double fisslibrng(void)
Definition: G4rngc.cc:65
int G4int
Definition: G4Types.hh:78
#define alphanegbin
Definition: G4SmpNugDist.cc:63
G4GLOB_DLL std::ostream G4cout
G4int G4SmpNugDist(G4int isotope, G4double nubar)
Definition: G4SmpNugDist.cc:65
static const G4double A[nN]
#define nfissg
Definition: G4SmpNugDist.cc:62
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76