G4NeutronHPProduct.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // neutron_hp -- source file
00027 // J.P. Wellisch, Nov-1996
00028 // A prototype of the low energy neutron transport model.
00029 //
00030 // 080718 As for secondary photons, if its mean value has a value of integer, 
00031 //        then a sampling of multiplicity that based on Poisson Distribution 
00032 //        is not carried out and the mean is used as a multiplicity.
00033 //        modified by T. Koi.
00034 // 080721 Using ClearHistories() methodl for limiting the sum of secondary energies
00035 //        modified by T. Koi.
00036 // 080901 bug fix of too many secnodaries production in nd reactinos by T. Koi
00037 //
00038 #include "G4NeutronHPProduct.hh" 
00039 #include "G4Poisson.hh"
00040 #include "G4Proton.hh"
00041 
00042 G4ReactionProductVector * G4NeutronHPProduct::Sample(G4double anEnergy)
00043 {
00044   if(theDist == 0) { return 0; }
00045   G4ReactionProductVector * result = new G4ReactionProductVector;
00046   G4double mean = theYield.GetY(anEnergy);
00047   G4int multi;
00048   multi = G4int(mean+0.0001);
00049   //if(theMassCode==0) multi = G4Poisson(mean); // @@@@gammas. please X-check this
00050   //080718
00051   if ( theMassCode == 0 )
00052   { 
00053      if ( G4int ( mean ) == mean )
00054      {
00055         multi = (G4int) mean;
00056      }
00057      else
00058      {
00059         multi = G4Poisson ( mean ); 
00060      }
00061   }
00062   theDist->SetTarget(theTarget);
00063   theDist->SetNeutron(theNeutron);
00064   G4int i;
00065 //  G4double eMax = GetTarget()->GetMass()+GetNeutron()->GetMass()
00066 //                  - theActualStateQValue;
00067   theCurrentMultiplicity = static_cast<G4int>(mean);
00068   G4ReactionProduct * tmp;
00069   theDist->ClearHistories();
00070   for(i=0;i<multi;i++)
00071   {
00072     tmp = theDist->Sample(anEnergy, theMassCode, theMass);
00073     if(tmp != 0) { result->push_back(tmp); }
00074   }
00075   if(multi == 0) 
00076   {
00077     tmp = theDist->Sample(anEnergy, theMassCode, theMass);
00078     delete  tmp;
00079   }
00080 /*
00081 //080901 TK Comment out, too many secondaries are produced in deuteron reactions
00082   if(theTarget->GetMass()<2*GeV) // @@@ take care of residuals in all cases
00083   {
00084     tmp = theDist->Sample(anEnergy, theMassCode, theMass);
00085     tmp->SetDefinition(G4Proton::Proton());
00086     if(tmp != 0) { result->push_back(tmp); }
00087   }
00088 */
00089   return result;
00090 }

Generated on Mon May 27 17:49:04 2013 for Geant4 by  doxygen 1.4.7