1
0
Fork 0
mirror of https://github.com/gwm17/Mask.git synced 2024-11-26 12:08:52 -05:00

Fixed bug in target thickness calc, where angle through target was incorrectly used for energy loss

This commit is contained in:
Gordon McCann 2021-02-13 17:35:29 -05:00
parent f511eec983
commit dc7f3923ed

View File

@ -40,25 +40,29 @@ bool Target::ContainsElement(int z, int a) {
/*Calculates energy loss for travelling all the way through the target*/ /*Calculates energy loss for travelling all the way through the target*/
double Target::getEnergyLossTotal(int zp, int ap, double startEnergy, double theta) { double Target::getEnergyLossTotal(int zp, int ap, double startEnergy, double theta) {
if(theta == PI/2.) return startEnergy; if(theta == PI/2.) return startEnergy;
else return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/fabs(cos(theta))); else if (theta > PI/2.) theta = PI - theta;
return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/fabs(cos(theta)));
} }
/*Calculates energy loss for travelling halfway through the target*/ /*Calculates energy loss for travelling halfway through the target*/
double Target::getEnergyLossHalf(int zp, int ap, double startEnergy, double theta) { double Target::getEnergyLossHalf(int zp, int ap, double startEnergy, double theta) {
if(theta == PI/2.) return startEnergy; if(theta == PI/2.) return startEnergy;
else return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/(2.0*fabs(cos(theta)))); else if (theta > PI/2.) theta = PI - theta;
return eloss.GetEnergyLoss(zp, ap, startEnergy, thickness/(2.0*fabs(cos(theta))));
} }
/*Calculates reverse energy loss for travelling all the way through the target*/ /*Calculates reverse energy loss for travelling all the way through the target*/
double Target::getReverseEnergyLossTotal(int zp, int ap, double finalEnergy, double theta) { double Target::getReverseEnergyLossTotal(int zp, int ap, double finalEnergy, double theta) {
if(theta == PI/2.) return finalEnergy; if(theta == PI/2.) return finalEnergy;
else return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/fabs(cos(theta))); else if (theta > PI/2.) theta = PI - theta;
return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/fabs(cos(theta)));
} }
/*Calculates reverse energy loss for travelling half way through the target*/ /*Calculates reverse energy loss for travelling half way through the target*/
double Target::getReverseEnergyLossHalf(int zp, int ap, double finalEnergy, double theta) { double Target::getReverseEnergyLossHalf(int zp, int ap, double finalEnergy, double theta) {
if(theta == PI/2.) return finalEnergy; if(theta == PI/2.) return finalEnergy;
else return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/(2.0*fabs(cos(theta)))); else if (theta > PI/2.) theta = PI - theta;
return eloss.GetReverseEnergyLoss(zp, ap, finalEnergy, thickness/(2.0*fabs(cos(theta))));
} }
/*Getter functions*/ /*Getter functions*/