OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ScatteringPhysics Class Reference

#include <ScatteringPhysics.h>

Inheritance diagram for ScatteringPhysics:
Inheritance graph
[legend]
Collaboration diagram for ScatteringPhysics:
Collaboration graph
[legend]

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
 
- Public Member Functions inherited from ParticleMatterInteractionHandler
 ParticleMatterInteractionHandler (std::string name, ElementBase *elref)
 
virtual ~ParticleMatterInteractionHandler ()
 
virtual void apply (PartBunchBase< double, 3 > *bunch, const std::pair< Vector_t, double > &boundingSphere)=0
 
virtual const std::string getType () const =0
 
virtual void print (Inform &os)=0
 
virtual bool stillActive ()=0
 
virtual double getTime ()=0
 
virtual std::string getName ()=0
 
virtual size_t getParticlesInMat ()=0
 
virtual unsigned getRediffused ()=0
 
virtual unsigned int getNumEntered ()=0
 
void setFlagAllParticlesIn (bool p)
 
bool getFlagAllParticlesIn () const
 
void updateElement (ElementBase *newref)
 
ElementBasegetElement ()
 
virtual bool computeEnergyLoss (PartBunchBase< double, 3 > *bunch, Vector_t &P, const double deltat, bool includeFluctuations=true) const =0
 

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< PARTlocParts_m
 
std::unique_ptr< LossDataSinklossDs_m
 
bool enableRutherford_m
 
double lowEnergyThr_m
 
IpplTimings::TimerRef DegraderApplyTimer_m
 
IpplTimings::TimerRef DegraderLoopTimer_m
 
IpplTimings::TimerRef DegraderDestroyTimer_m
 

Additional Inherited Members

- Protected Attributes inherited from ParticleMatterInteractionHandler
ElementBaseelement_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< InsideTesterhitTester_m
 

Detailed Description

Definition at line 58 of file ScatteringPhysics.h.

Constructor & Destructor Documentation

◆ ScatteringPhysics()

ScatteringPhysics::ScatteringPhysics ( const std::string &  name,
ElementBase element,
std::string &  mat,
bool  enableRutherford,
double  lowEnergyThr 
)

◆ ~ScatteringPhysics()

ScatteringPhysics::~ScatteringPhysics ( )

Definition at line 165 of file ScatteringPhysics.cpp.

References locParts_m, lossDs_m, and rGen_m.

Member Function Documentation

◆ addBackToBunch()

void ScatteringPhysics::addBackToBunch ( PartBunchBase< double, 3 > *  bunch)
private

◆ addParticleBackToBunch()

void ScatteringPhysics::addParticleBackToBunch ( PartBunchBase< double, 3 > *  bunch,
const PART particle,
bool  pdead = false 
)
private

◆ apply()

void ScatteringPhysics::apply ( PartBunchBase< double, 3 > *  bunch,
const std::pair< Vector_t, double > &  boundingSphere 
)
overridevirtual

◆ applyRandomRotation()

void ScatteringPhysics::applyRandomRotation ( Vector_t P,
double  theta0 
)
private

Definition at line 426 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().

Here is the call graph for this function:

◆ applyRotation()

void ScatteringPhysics::applyRotation ( Vector_t P,
Vector_t R,
double  xplane,
double  thetacou 
)
private

Definition at line 410 of file ScatteringPhysics.cpp.

References atan2(), cos(), fmod(), Attrib::Distribution::R, sin(), and Physics::two_pi.

Referenced by computeCoulombScattering().

Here is the call graph for this function:

◆ calcStat()

void ScatteringPhysics::calcStat ( double  Eng)
inlineprivate

Definition at line 176 of file ScatteringPhysics.h.

References Eavg_m, Emax_m, and Emin_m.

◆ computeCoulombScattering()

void ScatteringPhysics::computeCoulombScattering ( Vector_t R,
Vector_t P,
double  dt 
)
private

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 451 of file ScatteringPhysics.cpp.

References abs(), applyRandomRotation(), applyRotation(), Physics::c, charge_m, cos(), enableRutherford_m, euclidean_norm(), Util::getBeta(), log(), mass_m, Physics::pi, Attrib::Distribution::R, rGen_m, CoordinateSystemTrafo::rotateFrom(), CoordinateSystemTrafo::rotateTo(), sin(), sqrt(), CoordinateSystemTrafo::transformFrom(), Physics::two_pi, and X0_m.

Referenced by computeInteraction().

Here is the call graph for this function:

◆ computeEnergyLoss()

bool ScatteringPhysics::computeEnergyLoss ( PartBunchBase< double, 3 > *  bunch,
Vector_t P,
const double  deltat,
bool  includeFluctuations = true 
) const
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 326 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().

Here is the call graph for this function:

◆ computeInteraction()

void ScatteringPhysics::computeInteraction ( PartBunchBase< double, 3 > *  bunch)

◆ configureMaterialParameters()

void ScatteringPhysics::configureMaterialParameters ( )
private

◆ copyFromBunch()

void ScatteringPhysics::copyFromBunch ( PartBunchBase< double, 3 > *  bunch,
const std::pair< Vector_t, double > &  boundingSphere 
)
private

◆ deleteParticleFromLocalVector()

void ScatteringPhysics::deleteParticleFromLocalVector ( )
private

Definition at line 651 of file ScatteringPhysics.cpp.

References Eavg_m, Emax_m, Emin_m, and locParts_m.

Referenced by addBackToBunch(), and computeInteraction().

◆ gatherStatistics()

void ScatteringPhysics::gatherStatistics ( )
private

Definition at line 725 of file ScatteringPhysics.cpp.

References allreduce(), bunchToMatStat_m, locParts_m, rediffusedStat_m, stoppedPartStat_m, and totalPartsInMat_m.

Referenced by apply().

Here is the call graph for this function:

◆ getName()

std::string ScatteringPhysics::getName ( )
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().

Here is the call graph for this function:

◆ getNumEntered()

unsigned int ScatteringPhysics::getNumEntered ( )
inlineoverridevirtual

Implements ParticleMatterInteractionHandler.

Definition at line 205 of file ScatteringPhysics.h.

References bunchToMatStat_m.

◆ getParticlesInMat()

size_t ScatteringPhysics::getParticlesInMat ( )
inlineoverridevirtual

Implements ParticleMatterInteractionHandler.

Definition at line 195 of file ScatteringPhysics.h.

References totalPartsInMat_m.

◆ getRediffused()

unsigned int ScatteringPhysics::getRediffused ( )
inlineoverridevirtual

Implements ParticleMatterInteractionHandler.

Definition at line 200 of file ScatteringPhysics.h.

References rediffusedStat_m.

◆ getTime()

double ScatteringPhysics::getTime ( )
inlineoverridevirtual

Implements ParticleMatterInteractionHandler.

Definition at line 185 of file ScatteringPhysics.h.

References T_m.

◆ getType()

const std::string ScatteringPhysics::getType ( ) const
inlineoverridevirtual

Implements ParticleMatterInteractionHandler.

Definition at line 210 of file ScatteringPhysics.h.

◆ print()

void ScatteringPhysics::print ( Inform os)
overridevirtual

◆ push()

void ScatteringPhysics::push ( )
private

Definition at line 676 of file ScatteringPhysics.cpp.

References Physics::c, dT_m, Util::getGamma(), locParts_m, and Attrib::Distribution::R.

Referenced by apply().

Here is the call graph for this function:

◆ resetTimeStep()

void ScatteringPhysics::resetTimeStep ( )
private

Definition at line 718 of file ScatteringPhysics.cpp.

References dT_m, and locParts_m.

Referenced by apply().

◆ setTimeStepForLeavingParticles()

void ScatteringPhysics::setTimeStepForLeavingParticles ( )
private

◆ stillActive()

bool ScatteringPhysics::stillActive ( )
overridevirtual

Implements ParticleMatterInteractionHandler.

Definition at line 641 of file ScatteringPhysics.cpp.

References totalPartsInMat_m.

Member Data Documentation

◆ A1_c

double ScatteringPhysics::A1_c
private

Definition at line 138 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ A2_c

double ScatteringPhysics::A2_c
private

Definition at line 139 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ A3_c

double ScatteringPhysics::A3_c
private

Definition at line 140 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ A4_c

double ScatteringPhysics::A4_c
private

Definition at line 141 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ A5_c

double ScatteringPhysics::A5_c
private

Definition at line 142 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ A_m

double ScatteringPhysics::A_m
private

Definition at line 129 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ B1_c

double ScatteringPhysics::B1_c
private

Definition at line 143 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ B2_c

double ScatteringPhysics::B2_c
private

Definition at line 144 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ B3_c

double ScatteringPhysics::B3_c
private

Definition at line 145 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ B4_c

double ScatteringPhysics::B4_c
private

Definition at line 146 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ B5_c

double ScatteringPhysics::B5_c
private

Definition at line 147 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ bunchToMatStat_m

unsigned int ScatteringPhysics::bunchToMatStat_m
private

Definition at line 150 of file ScatteringPhysics.h.

Referenced by apply(), copyFromBunch(), gatherStatistics(), getNumEntered(), and print().

◆ charge_m

double ScatteringPhysics::charge_m
private

Definition at line 122 of file ScatteringPhysics.h.

Referenced by apply(), computeCoulombScattering(), and computeEnergyLoss().

◆ DegraderApplyTimer_m

IpplTimings::TimerRef ScatteringPhysics::DegraderApplyTimer_m
private

Definition at line 170 of file ScatteringPhysics.h.

Referenced by apply(), and ScatteringPhysics().

◆ DegraderDestroyTimer_m

IpplTimings::TimerRef ScatteringPhysics::DegraderDestroyTimer_m
private

Definition at line 172 of file ScatteringPhysics.h.

Referenced by copyFromBunch(), and ScatteringPhysics().

◆ DegraderLoopTimer_m

IpplTimings::TimerRef ScatteringPhysics::DegraderLoopTimer_m
private

Definition at line 171 of file ScatteringPhysics.h.

Referenced by apply(), and ScatteringPhysics().

◆ dT_m

double ScatteringPhysics::dT_m
private

◆ Eavg_m

double ScatteringPhysics::Eavg_m
private

Definition at line 159 of file ScatteringPhysics.h.

Referenced by apply(), calcStat(), and deleteParticleFromLocalVector().

◆ Emax_m

double ScatteringPhysics::Emax_m
private

Definition at line 160 of file ScatteringPhysics.h.

Referenced by apply(), calcStat(), and deleteParticleFromLocalVector().

◆ Emin_m

double ScatteringPhysics::Emin_m
private

Definition at line 161 of file ScatteringPhysics.h.

Referenced by apply(), calcStat(), and deleteParticleFromLocalVector().

◆ enableRutherford_m

bool ScatteringPhysics::enableRutherford_m
private

Definition at line 167 of file ScatteringPhysics.h.

Referenced by computeCoulombScattering().

◆ I_m

double ScatteringPhysics::I_m
private

Definition at line 132 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ locParts_m

std::vector<PART> ScatteringPhysics::locParts_m
private

◆ lossDs_m

std::unique_ptr<LossDataSink> ScatteringPhysics::lossDs_m
private

Definition at line 165 of file ScatteringPhysics.h.

Referenced by computeInteraction(), ScatteringPhysics(), and ~ScatteringPhysics().

◆ lowEnergyThr_m

double ScatteringPhysics::lowEnergyThr_m
private

Definition at line 168 of file ScatteringPhysics.h.

◆ mass_m

double ScatteringPhysics::mass_m
private

Definition at line 121 of file ScatteringPhysics.h.

Referenced by apply(), computeCoulombScattering(), and computeEnergyLoss().

◆ material_m

std::string ScatteringPhysics::material_m
private

Definition at line 127 of file ScatteringPhysics.h.

Referenced by configureMaterialParameters(), and print().

◆ rediffusedStat_m

unsigned int ScatteringPhysics::rediffusedStat_m
private

Definition at line 154 of file ScatteringPhysics.h.

Referenced by addBackToBunch(), apply(), gatherStatistics(), getRediffused(), and print().

◆ rGen_m

gsl_rng* ScatteringPhysics::rGen_m
private

◆ rho_m

double ScatteringPhysics::rho_m
private

Definition at line 130 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().

◆ stoppedPartStat_m

unsigned int ScatteringPhysics::stoppedPartStat_m
private

Definition at line 152 of file ScatteringPhysics.h.

Referenced by apply(), computeInteraction(), gatherStatistics(), and print().

◆ T_m

double ScatteringPhysics::T_m
private

Definition at line 118 of file ScatteringPhysics.h.

Referenced by apply(), computeInteraction(), and getTime().

◆ totalPartsInMat_m

unsigned int ScatteringPhysics::totalPartsInMat_m
private

Definition at line 156 of file ScatteringPhysics.h.

Referenced by apply(), gatherStatistics(), getParticlesInMat(), print(), and stillActive().

◆ X0_m

double ScatteringPhysics::X0_m
private

Definition at line 131 of file ScatteringPhysics.h.

Referenced by computeCoulombScattering(), and configureMaterialParameters().

◆ Z_m

double ScatteringPhysics::Z_m
private

Definition at line 128 of file ScatteringPhysics.h.

Referenced by computeEnergyLoss(), and configureMaterialParameters().


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