Skip to content

Commit

Permalink
Merge pull request #129 from llebanowski/main_AmBe_Cf
Browse files Browse the repository at this point in the history
Fix solid angle bug in AmBe and Cf generators
  • Loading branch information
tannerbk authored Apr 26, 2024
2 parents cffd522 + 7d9a21e commit 7d82469
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/gen/src/AmBeSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ AmBeSource::AmBeSource() {
double energy = massNeutron + neutronKE;
// info << "energy = " << energy*CLHEP::MeV << newline;
// Generate momentum direction uniformly in phi and cos(theta).
double phi = CLHEP::RandFlat::shoot(0., M_PI);
double phi = CLHEP::RandFlat::shoot(0., 2.0*M_PI);
double cosTheta = CLHEP::RandFlat::shoot(-1., 1.);
double sinTheta = sqrt(1. - cosTheta * cosTheta);

Expand Down Expand Up @@ -147,7 +147,7 @@ AmBeSource::AmBeSource() {
for (int nn = 0; nn < Ngamma; nn++) {
double energy = 4.43; // from the C12 first excited state
// Generate momentum direction uniformly in phi and cos(theta).
double phi = CLHEP::RandFlat::shoot(0., M_PI);
double phi = CLHEP::RandFlat::shoot(0., 2.0*M_PI);
double cosTheta = CLHEP::RandFlat::shoot(-1., 1.);
double sinTheta = sqrt(1. - cosTheta * cosTheta);
double px = energy * sinTheta * cos(phi);
Expand Down
4 changes: 2 additions & 2 deletions src/gen/src/CfSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ CfSource::CfSource(int newIsotope) : Isotope(newIsotope) {
double neutronKE = fGenerate->shoot() * (fhigh - flow) + flow;
double energy = massNeutron + neutronKE;
// Generate momentum direction uniformly in phi and cos(theta).
double phi = CLHEP::RandFlat::shoot(0., M_PI);
double phi = CLHEP::RandFlat::shoot(0., 2.0*M_PI);
double cosTheta = CLHEP::RandFlat::shoot(-1., 1.);
double sinTheta = sqrt(1. - cosTheta * cosTheta);
double neutronP2 = std::max(0., energy * energy - massNeutron * massNeutron);
Expand Down Expand Up @@ -181,7 +181,7 @@ CfSource::CfSource(int newIsotope) : Isotope(newIsotope) {
for (int nn = 0; nn < Ngamma; nn++) {
double energy = gGenerate->shoot() * (ghigh - glow) + glow;
// Generate momentum direction uniformly in phi and cos(theta).
double phi = CLHEP::RandFlat::shoot(0., M_PI);
double phi = CLHEP::RandFlat::shoot(0., 2.0*M_PI);
double cosTheta = CLHEP::RandFlat::shoot(-1., 1.);
double sinTheta = sqrt(1. - cosTheta * cosTheta);
double px = energy * sinTheta * cos(phi);
Expand Down

0 comments on commit 7d82469

Please sign in to comment.