Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4NeutronHPNBodyPhaseSpace Class Reference

#include <G4NeutronHPNBodyPhaseSpace.hh>

Inheritance diagram for G4NeutronHPNBodyPhaseSpace:
G4VNeutronHPEnergyAngular

Public Member Functions

 G4NeutronHPNBodyPhaseSpace ()
 
 ~G4NeutronHPNBodyPhaseSpace ()
 
void Init (G4double aMass, G4int aCount)
 
void Init (std::istream &aDataFile)
 
G4ReactionProductSample (G4double anEnergy, G4double massCode, G4double mass)
 
- Public Member Functions inherited from G4VNeutronHPEnergyAngular
 G4VNeutronHPEnergyAngular ()
 
virtual ~G4VNeutronHPEnergyAngular ()
 
void SetNeutron (G4ReactionProduct *aNeutron)
 
void SetTarget (G4ReactionProduct *aTarget)
 
G4ReactionProductGetTarget ()
 
G4ReactionProductGetNeutron ()
 
G4ReactionProductGetCMS ()
 
void SetQValue (G4double aValue)
 
virtual void ClearHistories ()
 

Additional Inherited Members

- Protected Member Functions inherited from G4VNeutronHPEnergyAngular
G4double GetQValue ()
 

Detailed Description

Definition at line 40 of file G4NeutronHPNBodyPhaseSpace.hh.

Constructor & Destructor Documentation

G4NeutronHPNBodyPhaseSpace::G4NeutronHPNBodyPhaseSpace ( )
inline

Definition at line 44 of file G4NeutronHPNBodyPhaseSpace.hh.

44 {}
G4NeutronHPNBodyPhaseSpace::~G4NeutronHPNBodyPhaseSpace ( )
inline

Definition at line 45 of file G4NeutronHPNBodyPhaseSpace.hh.

45 {}

Member Function Documentation

void G4NeutronHPNBodyPhaseSpace::Init ( G4double  aMass,
G4int  aCount 
)
inline

Definition at line 49 of file G4NeutronHPNBodyPhaseSpace.hh.

Referenced by G4NeutronHPInelasticBaseFS::BaseApply().

50  {
51  theTotalMass=aMass;
52  theTotalCount=aCount;
53  }
void G4NeutronHPNBodyPhaseSpace::Init ( std::istream &  aDataFile)
inlinevirtual

Implements G4VNeutronHPEnergyAngular.

Definition at line 55 of file G4NeutronHPNBodyPhaseSpace.hh.

References G4ParticleDefinition::GetPDGMass(), and G4Neutron::Neutron().

56  {
57  aDataFile >> theTotalMass >> theTotalCount;
58  theTotalMass *= G4Neutron::Neutron()->GetPDGMass();
59  }
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
G4double GetPDGMass() const
G4ReactionProduct * G4NeutronHPNBodyPhaseSpace::Sample ( G4double  anEnergy,
G4double  massCode,
G4double  mass 
)
virtual

Implements G4VNeutronHPEnergyAngular.

Definition at line 42 of file G4NeutronHPNBodyPhaseSpace.cc.

References G4Alpha::Alpha(), G4Deuteron::Deuteron(), G4Electron::Electron(), energy(), G4UniformRand, G4Gamma::Gamma(), G4ReactionProduct::GetMass(), G4VNeutronHPEnergyAngular::GetNeutron(), G4VNeutronHPEnergyAngular::GetTarget(), G4ReactionProduct::GetTotalMomentum(), G4He3::He3(), G4ReactionProduct::Lorentz(), G4INCL::Math::max(), G4Neutron::Neutron(), G4Positron::Positron(), G4Proton::Proton(), G4ReactionProduct::SetDefinition(), G4ReactionProduct::SetKineticEnergy(), G4ReactionProduct::SetMomentum(), G4Triton::Triton(), and python.hepunit::twopi.

Referenced by G4NeutronHPInelasticBaseFS::BaseApply().

43 {
44  G4ReactionProduct * result = new G4ReactionProduct;
45  G4int Z = static_cast<G4int>(massCode/1000);
46  G4int A = static_cast<G4int>(massCode-1000*Z);
47 
48  if(massCode==0)
49  {
50  result->SetDefinition(G4Gamma::Gamma());
51  }
52  else if(A==0)
53  {
55  if(Z==1) result->SetDefinition(G4Positron::Positron());
56  }
57  else if(A==1)
58  {
60  if(Z==1) result->SetDefinition(G4Proton::Proton());
61  }
62  else if(A==2)
63  {
65  }
66  else if(A==3)
67  {
68  result->SetDefinition(G4Triton::Triton());
69  if(Z==2) result->SetDefinition(G4He3::He3());
70  }
71  else if(A==4)
72  {
73  result->SetDefinition(G4Alpha::Alpha());
74  if(Z!=2) throw G4HadronicException(__FILE__, __LINE__, "Unknown ion case 1");
75  }
76  else
77  {
78  throw G4HadronicException(__FILE__, __LINE__, "G4NeutronHPNBodyPhaseSpace: Unknown ion case 2");
79  }
80 
81 // Get the energy from phase-space distribution
82  // in CMS
83  // P = Cn*std::sqrt(E')*(Emax-E')**(3*n/2-4)
84  G4double maxE = GetEmax(anEnergy, result->GetMass());
86  G4double max(0);
87  if(theTotalCount<=3)
88  {
89  max = maxE/2.;
90  }
91  else if(theTotalCount==4)
92  {
93  max = maxE/5.;
94  }
95  else if(theTotalCount==5)
96  {
97  max = maxE/8.;
98  }
99  else
100  {
101  throw G4HadronicException(__FILE__, __LINE__, "NeutronHP Phase-space distribution cannot cope with this number of particles");
102  }
103  G4double testit;
104  G4double rand0 = Prob(max, maxE, theTotalCount);
105  G4double rand;
106 
107  do
108  {
109  rand = rand0*G4UniformRand();
110  energy = maxE*G4UniformRand();
111  testit = Prob(energy, maxE, theTotalCount);
112  }
113  while(rand > testit);
114  result->SetKineticEnergy(energy);
115 
116 // now do random direction
117  G4double cosTh = 2.*G4UniformRand()-1.;
118  G4double phi = twopi*G4UniformRand();
119  G4double theta = std::acos(cosTh);
120  G4double sinth = std::sin(theta);
121  G4double mtot = result->GetTotalMomentum();
122  G4ThreeVector tempVector(mtot*sinth*std::cos(phi), mtot*sinth*std::sin(phi), mtot*std::cos(theta) );
123  result->SetMomentum(tempVector);
125  result->Lorentz(*result, -1.*aCMS);
126  return result;
127 }
G4double GetTotalMomentum() const
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetKineticEnergy(const G4double en)
void SetMomentum(const G4double x, const G4double y, const G4double z)
int G4int
Definition: G4Types.hh:78
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
#define G4UniformRand()
Definition: Randomize.hh:87
static G4Triton * Triton()
Definition: G4Triton.cc:95
static G4Proton * Proton()
Definition: G4Proton.cc:93
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
static G4Deuteron * Deuteron()
Definition: G4Deuteron.cc:94
static G4Positron * Positron()
Definition: G4Positron.cc:94
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void SetDefinition(G4ParticleDefinition *aParticleDefinition)
static G4Electron * Electron()
Definition: G4Electron.cc:94
static G4Alpha * Alpha()
Definition: G4Alpha.cc:89
double G4double
Definition: G4Types.hh:76
static G4He3 * He3()
Definition: G4He3.cc:94
G4double GetMass() const

The documentation for this class was generated from the following files: