Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add mass tolerance for geant4 mass differences.
  • Loading branch information
JamesMolson committed Feb 24, 2020
commit 94188c295cdbe708f1ddcd6a58a60e36347f16a1
13 changes: 12 additions & 1 deletion source/g4collimation/CollimationParticleGun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ void CollimationParticleGun::SetParticleDetails(double x, double y, double px, d
ParticleGun->SetParticleCharge(q*CLHEP::eplus);
}
const G4double mp = particle->GetPDGMass();
if(mp != mass)

if(fabs(mp - mass) > (1e-5*mass))
{
std::cout.precision(17);
std::cout << "GEANT4> Mass missmatch between Geant4 and SixTrack!" << std::endl;
Expand All @@ -92,6 +93,16 @@ void CollimationParticleGun::SetParticleDetails(double x, double y, double px, d
std::cout << "GEANT4> If the HION block is used, convert to GeV!" << std::endl;
exit(EXIT_FAILURE);
}
else
{
//scale mass
/*
* From FLUKA coupling:
ECBEAM = (ECBEAM/AMBEAM)*AM(IONID)
AMBEAM = AM(IONID)
*/
e = (e/mass)*mp;
}

//The kinetic energy (Total energy - rest mass)
ParticleGun->SetParticleEnergy(e - mp);
Expand Down