[819] | 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 | // neutron_hp -- source file |
---|
| 27 | // J.P. Wellisch, Nov-1996 |
---|
| 28 | // A prototype of the low energy neutron transport model. |
---|
[962] | 29 | // |
---|
| 30 | // 080718 As for secondary photons, if its mean value has a value of integer, |
---|
| 31 | // then a sampling of multiplicity that based on Poisson Distribution |
---|
| 32 | // is not carried out and the mean is used as a multiplicity. |
---|
| 33 | // modified by T. Koi. |
---|
| 34 | // 080721 Using ClearHistories() methodl for limiting the sum of secondary energies |
---|
| 35 | // modified by T. Koi. |
---|
| 36 | // 080901 bug fix of too many secnodaries production in nd reactinos by T. Koi |
---|
| 37 | // |
---|
[819] | 38 | #include "G4NeutronHPProduct.hh" |
---|
| 39 | #include "G4Poisson.hh" |
---|
| 40 | #include "G4Proton.hh" |
---|
| 41 | |
---|
| 42 | G4ReactionProductVector * G4NeutronHPProduct::Sample(G4double anEnergy) |
---|
| 43 | { |
---|
| 44 | if(theDist == 0) { return 0; } |
---|
| 45 | G4ReactionProductVector * result = new G4ReactionProductVector; |
---|
| 46 | G4double mean = theYield.GetY(anEnergy); |
---|
| 47 | G4int multi; |
---|
| 48 | multi = G4int(mean+0.0001); |
---|
[962] | 49 | //if(theMassCode==0) multi = G4Poisson(mean); // @@@@gammas. please X-check this |
---|
| 50 | //080718 |
---|
| 51 | if ( theMassCode == 0 ) |
---|
| 52 | { |
---|
| 53 | if ( G4int ( mean ) == mean ) |
---|
| 54 | { |
---|
| 55 | multi = (G4int) mean; |
---|
| 56 | } |
---|
| 57 | else |
---|
| 58 | { |
---|
| 59 | multi = G4Poisson ( mean ); |
---|
| 60 | } |
---|
| 61 | } |
---|
[819] | 62 | theDist->SetTarget(theTarget); |
---|
| 63 | theDist->SetNeutron(theNeutron); |
---|
| 64 | G4int i; |
---|
| 65 | // G4double eMax = GetTarget()->GetMass()+GetNeutron()->GetMass() |
---|
| 66 | // - theActualStateQValue; |
---|
| 67 | theCurrentMultiplicity = static_cast<G4int>(mean); |
---|
| 68 | G4ReactionProduct * tmp; |
---|
[962] | 69 | theDist->ClearHistories(); |
---|
[819] | 70 | for(i=0;i<multi;i++) |
---|
| 71 | { |
---|
| 72 | tmp = theDist->Sample(anEnergy, theMassCode, theMass); |
---|
| 73 | if(tmp != 0) { result->push_back(tmp); } |
---|
| 74 | } |
---|
| 75 | if(multi == 0) |
---|
| 76 | { |
---|
| 77 | tmp = theDist->Sample(anEnergy, theMassCode, theMass); |
---|
| 78 | delete tmp; |
---|
| 79 | } |
---|
[962] | 80 | /* |
---|
| 81 | //080901 TK Comment out, too many secondaries are produced in deuteron reactions |
---|
[819] | 82 | if(theTarget->GetMass()<2*GeV) // @@@ take care of residuals in all cases |
---|
| 83 | { |
---|
| 84 | tmp = theDist->Sample(anEnergy, theMassCode, theMass); |
---|
| 85 | tmp->SetDefinition(G4Proton::Proton()); |
---|
| 86 | if(tmp != 0) { result->push_back(tmp); } |
---|
| 87 | } |
---|
[962] | 88 | */ |
---|
[819] | 89 | return result; |
---|
| 90 | } |
---|