OPAL (Object Oriented Parallel Accelerator Library)
2024.1
OPAL
|
#include <ScatteringPhysics.h>
Public Member Functions | |
ScatteringPhysics (const std::string &name, ElementBase *element, std::string &mat, bool enableRutherford, double lowEnergyThr) | |
~ScatteringPhysics () | |
virtual void | apply (PartBunchBase< double, 3 > *bunch, const std::pair< Vector_t, double > &boundingSphere) override |
virtual const std::string | getType () const override |
virtual void | print (Inform &os) override |
virtual bool | stillActive () override |
virtual double | getTime () override |
virtual std::string | getName () override |
virtual size_t | getParticlesInMat () override |
virtual unsigned | getRediffused () override |
virtual unsigned int | getNumEntered () override |
void | computeInteraction (PartBunchBase< double, 3 > *bunch) |
virtual bool | computeEnergyLoss (PartBunchBase< double, 3 > *bunch, Vector_t &P, const double deltat, bool includeFluctuations=true) const override |
![]() | |
ParticleMatterInteractionHandler (std::string name, ElementBase *elref) | |
virtual | ~ParticleMatterInteractionHandler () |
void | setFlagAllParticlesIn (bool p) |
bool | getFlagAllParticlesIn () const |
void | updateElement (ElementBase *newref) |
ElementBase * | getElement () |
Private Member Functions | |
void | configureMaterialParameters () |
The material of the collimator. More... | |
void | computeCoulombScattering (Vector_t &R, Vector_t &P, double dt) |
void | applyRotation (Vector_t &P, Vector_t &R, double xplane, double thetacou) |
void | applyRandomRotation (Vector_t &P, double theta0) |
void | copyFromBunch (PartBunchBase< double, 3 > *bunch, const std::pair< Vector_t, double > &boundingSphere) |
void | addBackToBunch (PartBunchBase< double, 3 > *bunch) |
void | addParticleBackToBunch (PartBunchBase< double, 3 > *bunch, const PART &particle, bool pdead=false) |
void | deleteParticleFromLocalVector () |
void | calcStat (double Eng) |
void | gatherStatistics () |
void | push () |
void | resetTimeStep () |
void | setTimeStepForLeavingParticles () |
Private Attributes | |
double | T_m |
double | dT_m |
double | mass_m |
double | charge_m |
gsl_rng * | rGen_m |
std::string | material_m |
double | Z_m |
double | A_m |
double | rho_m |
double | X0_m |
double | I_m |
double | A1_c |
double | A2_c |
double | A3_c |
double | A4_c |
double | A5_c |
double | B1_c |
double | B2_c |
double | B3_c |
double | B4_c |
double | B5_c |
unsigned int | bunchToMatStat_m |
unsigned int | stoppedPartStat_m |
unsigned int | rediffusedStat_m |
unsigned int | totalPartsInMat_m |
double | Eavg_m |
double | Emax_m |
double | Emin_m |
std::vector< PART > | locParts_m |
std::unique_ptr< LossDataSink > | lossDs_m |
bool | enableRutherford_m |
double | lowEnergyThr_m |
IpplTimings::TimerRef | DegraderApplyTimer_m |
IpplTimings::TimerRef | DegraderLoopTimer_m |
IpplTimings::TimerRef | DegraderDestroyTimer_m |
Additional Inherited Members | |
![]() | |
ElementBase * | element_ref_m |
bool | allParticleInMat_m |
if all particles are in matter stay inside the particle matter interaction More... | |
const std::string | name_m |
std::unique_ptr< InsideTester > | hitTester_m |
Definition at line 58 of file ScatteringPhysics.h.
ScatteringPhysics::ScatteringPhysics | ( | const std::string & | name, |
ElementBase * | element, | ||
std::string & | mat, | ||
bool | enableRutherford, | ||
double | lowEnergyThr | ||
) |
Definition at line 91 of file ScatteringPhysics.cpp.
References Options::asciidump, CCOLLIMATOR, configureMaterialParameters(), DEGRADER, DegraderApplyTimer_m, DegraderDestroyTimer_m, DegraderLoopTimer_m, ParticleMatterInteractionHandler::element_ref_m, FLEXIBLECOLLIMATOR, getName(), IpplTimings::getTimer(), ElementBase::getType(), ParticleMatterInteractionHandler::hitTester_m, lossDs_m, IpplInfo::myNode(), rGen_m, and Options::seed.
ScatteringPhysics::~ScatteringPhysics | ( | ) |
Definition at line 166 of file ScatteringPhysics.cpp.
References locParts_m, lossDs_m, and rGen_m.
|
private |
Definition at line 493 of file ScatteringPhysics.cpp.
References addParticleBackToBunch(), deleteParticleFromLocalVector(), ParticleMatterInteractionHandler::element_ref_m, ElementBase::getElementLength(), OpalData::getInstance(), ParticleMatterInteractionHandler::hitTester_m, locParts_m, and rediffusedStat_m.
Referenced by apply().
|
private |
Definition at line 522 of file ScatteringPhysics.cpp.
References PartBunchBase< T, Dim >::Bf, PartBunchBase< T, Dim >::Bin, PartBunchBase< T, Dim >::createWithID(), PartBunchBase< T, Dim >::dt, dT_m, PartBunchBase< T, Dim >::Ef, PartBunchBase< T, Dim >::getLocalNum(), PART::IDincol, PartBunchBase< T, Dim >::M, PART::Mincol, PartBunchBase< T, Dim >::P, PART::Pincol, PartBunchBase< T, Dim >::Q, PART::Qincol, PartBunchBase< T, Dim >::R, and PART::Rincol.
Referenced by addBackToBunch(), and computeInteraction().
|
overridevirtual |
Implements ParticleMatterInteractionHandler.
Definition at line 195 of file ScatteringPhysics.cpp.
References addBackToBunch(), ParticleMatterInteractionHandler::allParticleInMat_m, ALPHA, bunchToMatStat_m, charge_m, computeInteraction(), copyFromBunch(), DegraderApplyTimer_m, DegraderLoopTimer_m, DEUTERON, dT_m, Eavg_m, Emax_m, Emin_m, gatherStatistics(), PartBunchBase< T, Dim >::getdT(), PartBunchBase< T, Dim >::getM(), ParticleProperties::getParticleTypeString(), PartBunchBase< T, Dim >::getPType(), PartBunchBase< T, Dim >::getQ(), PartBunchBase< T, Dim >::getT(), H2P, HMINUS, mass_m, MUON, PROTON, push(), rediffusedStat_m, resetTimeStep(), setTimeStepForLeavingParticles(), IpplTimings::startTimer(), stoppedPartStat_m, IpplTimings::stopTimer(), T_m, and totalPartsInMat_m.
Definition at line 427 of file ScatteringPhysics.cpp.
References abs(), atan(), cos(), cross(), dot(), euclidean_norm(), rGen_m, sin(), sqrt(), Physics::two_pi, Attrib::Distribution::W, and X.
Referenced by computeCoulombScattering().
|
private |
Definition at line 411 of file ScatteringPhysics.cpp.
References atan2(), cos(), fmod(), Attrib::Distribution::R, sin(), and Physics::two_pi.
Referenced by computeCoulombScattering().
|
inlineprivate |
Definition at line 176 of file ScatteringPhysics.h.
Coulomb Scattering: Including Multiple Coulomb Scattering and large angle Rutherford Scattering. Using the distribution given in Classical Electrodynamics, by J. D. Jackson.
Definition at line 452 of file ScatteringPhysics.cpp.
References abs(), applyRandomRotation(), applyRotation(), Physics::c, charge_m, cos(), enableRutherford_m, euclidean_norm(), Util::getBeta(), log(), mass_m, Physics::pi, rGen_m, CoordinateSystemTrafo::rotateFrom(), CoordinateSystemTrafo::rotateTo(), sin(), sqrt(), CoordinateSystemTrafo::transformFrom(), Physics::two_pi, and X0_m.
Referenced by computeInteraction().
|
overridevirtual |
Energy Loss: using the Bethe-Bloch equation. In low-energy region use Andersen-Ziegler fitting (only for protons and alpha) Energy straggling: For relatively thick absorbers such that the number of collisions is large, the energy loss distribution is shown to be Gaussian in form. See Particle Physics Booklet, chapter 'Passage of particles through matter' or Review of Particle Physics, DOI: 10.1103/PhysRevD.86.010001, page 329 ff
Implements ParticleMatterInteractionHandler.
Definition at line 327 of file ScatteringPhysics.cpp.
References A1_c, A2_c, A3_c, A4_c, A5_c, A_m, ALPHA, Physics::amu, Physics::Avo, B1_c, B2_c, B3_c, B4_c, B5_c, Physics::c, charge_m, endl(), euclidean_norm(), Units::eV2keV, Util::getGamma(), PartBunchBase< T, Dim >::getPType(), Units::GeV2keV, I_m, INFOMSG, Units::keV2MeV, level4(), log(), Units::m2cm, Physics::m_e, Physics::m_p, mass_m, Units::MeV2keV, Physics::pi, pow(), PROTON, Physics::r_e, rGen_m, rho_m, sqrt(), Attrib::Legacy::Distribution::T, and Z_m.
Referenced by computeInteraction().
void ScatteringPhysics::computeInteraction | ( | PartBunchBase< double, 3 > * | bunch | ) |
Definition at line 270 of file ScatteringPhysics.cpp.
References addParticleBackToBunch(), computeCoulombScattering(), computeEnergyLoss(), deleteParticleFromLocalVector(), OpalData::getInstance(), ParticleMatterInteractionHandler::hitTester_m, locParts_m, lossDs_m, stoppedPartStat_m, and T_m.
Referenced by apply().
|
private |
The material of the collimator.
Definition at line 176 of file ScatteringPhysics.cpp.
References Physics::Material::A1, A1_c, Physics::Material::A2, A2_c, Physics::Material::A3, A3_c, Physics::Material::A4, A4_c, Physics::Material::A5, A5_c, A_m, Physics::Material::B1, B1_c, Physics::Material::B2, B2_c, Physics::Material::B3, B3_c, Physics::Material::B4, B4_c, Physics::Material::B5, B5_c, Physics::Material::getMaterial(), I_m, material_m, rho_m, X0_m, and Z_m.
Referenced by ScatteringPhysics().
|
private |
Definition at line 545 of file ScatteringPhysics.cpp.
References PartBunchBase< T, Dim >::Bf, PART::Bfincol, PartBunchBase< T, Dim >::Bin, PART::Binincol, bunchToMatStat_m, Physics::c, DegraderDestroyTimer_m, PartBunchBase< T, Dim >::destroy(), PartBunchBase< T, Dim >::dt, PART::DTincol, PartBunchBase< T, Dim >::Ef, PART::Efincol, ParticleMatterInteractionHandler::element_ref_m, ElementBase::getElementLength(), Util::getGamma(), OpalData::getInstance(), PartBunchBase< T, Dim >::getLocalNum(), ParticleMatterInteractionHandler::hitTester_m, PartBunchBase< T, Dim >::ID, PART::IDincol, OpalData::isInOPALTMode(), it, PART::label, PART::localID, locParts_m, PartBunchBase< T, Dim >::M, PART::Mincol, ne(), PartBunchBase< T, Dim >::P, PAssert_GE, PAssert_LE, PartBunchBase< T, Dim >::performDestroy(), PART::Pincol, PartBunchBase< T, Dim >::Q, PART::Qincol, PartBunchBase< T, Dim >::R, PART::Rincol, IpplTimings::startTimer(), and IpplTimings::stopTimer().
Referenced by apply().
|
private |
Definition at line 652 of file ScatteringPhysics.cpp.
References Eavg_m, Emax_m, Emin_m, and locParts_m.
Referenced by addBackToBunch(), and computeInteraction().
|
private |
Definition at line 726 of file ScatteringPhysics.cpp.
References allreduce(), bunchToMatStat_m, locParts_m, rediffusedStat_m, stoppedPartStat_m, and totalPartsInMat_m.
Referenced by apply().
|
inlineoverridevirtual |
Implements ParticleMatterInteractionHandler.
Definition at line 190 of file ScatteringPhysics.h.
References ParticleMatterInteractionHandler::element_ref_m, ElementBase::getName(), and ParticleMatterInteractionHandler::name_m.
Referenced by ScatteringPhysics().
|
inlineoverridevirtual |
Implements ParticleMatterInteractionHandler.
Definition at line 205 of file ScatteringPhysics.h.
References bunchToMatStat_m.
|
inlineoverridevirtual |
Implements ParticleMatterInteractionHandler.
Definition at line 195 of file ScatteringPhysics.h.
References totalPartsInMat_m.
|
inlineoverridevirtual |
Implements ParticleMatterInteractionHandler.
Definition at line 200 of file ScatteringPhysics.h.
References rediffusedStat_m.
|
inlineoverridevirtual |
Implements ParticleMatterInteractionHandler.
Definition at line 185 of file ScatteringPhysics.h.
References T_m.
|
inlineoverridevirtual |
Implements ParticleMatterInteractionHandler.
Definition at line 210 of file ScatteringPhysics.h.
Implements ParticleMatterInteractionHandler.
Definition at line 619 of file ScatteringPhysics.cpp.
References bunchToMatStat_m, ParticleMatterInteractionHandler::element_ref_m, endl(), Inform::flags(), ElementBase::getName(), level2(), material_m, ParticleMatterInteractionHandler::name_m, rediffusedStat_m, stoppedPartStat_m, OPALTimer::Timer::time(), Util::toStringWithThousandSep(), and totalPartsInMat_m.
|
private |
Definition at line 677 of file ScatteringPhysics.cpp.
References Physics::c, dT_m, Util::getGamma(), and locParts_m.
Referenced by apply().
|
private |
Definition at line 719 of file ScatteringPhysics.cpp.
References dT_m, and locParts_m.
Referenced by apply().
|
private |
Definition at line 693 of file ScatteringPhysics.cpp.
References Physics::c, dT_m, ParticleMatterInteractionHandler::element_ref_m, ElementBase::getElementLength(), Util::getGamma(), OpalData::getInstance(), locParts_m, PAssert_GE, PAssert_LE, and Attrib::Distribution::R.
Referenced by apply().
|
overridevirtual |
Implements ParticleMatterInteractionHandler.
Definition at line 642 of file ScatteringPhysics.cpp.
References totalPartsInMat_m.
|
private |
Definition at line 138 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 139 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 140 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 141 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 142 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 129 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 143 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 144 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 145 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 146 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 147 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 150 of file ScatteringPhysics.h.
Referenced by apply(), copyFromBunch(), gatherStatistics(), getNumEntered(), and print().
|
private |
Definition at line 122 of file ScatteringPhysics.h.
Referenced by apply(), computeCoulombScattering(), and computeEnergyLoss().
|
private |
Definition at line 170 of file ScatteringPhysics.h.
Referenced by apply(), and ScatteringPhysics().
|
private |
Definition at line 172 of file ScatteringPhysics.h.
Referenced by copyFromBunch(), and ScatteringPhysics().
|
private |
Definition at line 171 of file ScatteringPhysics.h.
Referenced by apply(), and ScatteringPhysics().
|
private |
Definition at line 119 of file ScatteringPhysics.h.
Referenced by addParticleBackToBunch(), apply(), push(), resetTimeStep(), and setTimeStepForLeavingParticles().
|
private |
Definition at line 159 of file ScatteringPhysics.h.
Referenced by apply(), calcStat(), and deleteParticleFromLocalVector().
|
private |
Definition at line 160 of file ScatteringPhysics.h.
Referenced by apply(), calcStat(), and deleteParticleFromLocalVector().
|
private |
Definition at line 161 of file ScatteringPhysics.h.
Referenced by apply(), calcStat(), and deleteParticleFromLocalVector().
|
private |
Definition at line 167 of file ScatteringPhysics.h.
Referenced by computeCoulombScattering().
|
private |
Definition at line 132 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 163 of file ScatteringPhysics.h.
Referenced by addBackToBunch(), computeInteraction(), copyFromBunch(), deleteParticleFromLocalVector(), gatherStatistics(), push(), resetTimeStep(), setTimeStepForLeavingParticles(), and ~ScatteringPhysics().
|
private |
Definition at line 165 of file ScatteringPhysics.h.
Referenced by computeInteraction(), ScatteringPhysics(), and ~ScatteringPhysics().
|
private |
Definition at line 168 of file ScatteringPhysics.h.
|
private |
Definition at line 121 of file ScatteringPhysics.h.
Referenced by apply(), computeCoulombScattering(), and computeEnergyLoss().
|
private |
Definition at line 127 of file ScatteringPhysics.h.
Referenced by configureMaterialParameters(), and print().
|
private |
Definition at line 154 of file ScatteringPhysics.h.
Referenced by addBackToBunch(), apply(), gatherStatistics(), getRediffused(), and print().
|
private |
Definition at line 124 of file ScatteringPhysics.h.
Referenced by applyRandomRotation(), computeCoulombScattering(), computeEnergyLoss(), ScatteringPhysics(), and ~ScatteringPhysics().
|
private |
Definition at line 130 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().
|
private |
Definition at line 152 of file ScatteringPhysics.h.
Referenced by apply(), computeInteraction(), gatherStatistics(), and print().
|
private |
Definition at line 118 of file ScatteringPhysics.h.
Referenced by apply(), computeInteraction(), and getTime().
|
private |
Definition at line 156 of file ScatteringPhysics.h.
Referenced by apply(), gatherStatistics(), getParticlesInMat(), print(), and stillActive().
|
private |
Definition at line 131 of file ScatteringPhysics.h.
Referenced by computeCoulombScattering(), and configureMaterialParameters().
|
private |
Definition at line 128 of file ScatteringPhysics.h.
Referenced by computeEnergyLoss(), and configureMaterialParameters().