Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mott scattering #66

Merged
merged 24 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bfae403
Add files via upload
juniorpena Aug 22, 2022
a1b0c2f
Add files via upload
juniorpena Aug 22, 2022
83ce264
Add files via upload
juniorpena Aug 22, 2022
96f00f5
Add files via upload
juniorpena Aug 22, 2022
70eadb5
Update CMakeLists.txt
juniorpena Aug 22, 2022
86820c7
Update CMakeLists.txt
juniorpena Aug 22, 2022
3c38e14
Update KSIntCalculatorMott.h
juniorpena Aug 22, 2022
9448d42
Update KSIntCalculatorMottBuilder.h
juniorpena May 6, 2024
b52ada7
Update KSIntCalculatorMottBuilder.cxx
juniorpena May 6, 2024
26034d4
Update KSIntCalculatorMott.h
juniorpena May 6, 2024
341c15c
Update KSIntCalculatorMott.cxx
juniorpena May 6, 2024
335814e
Update Interactions.xml
juniorpena May 7, 2024
0865903
Update Kassiopeia/Bindings/Interactions/Include/KSIntCalculatorMottBu…
juniorpena Jun 10, 2024
317fcae
Update KSIntCalculatorMott.cxx
juniorpena Jun 10, 2024
0b8ebc5
Merge branch 'KATRIN-Experiment:main' into mott_scattering
juniorpena Jul 9, 2024
8112166
Update KSIntCalculatorMott.cxx
juniorpena Jul 16, 2024
9d9f668
Update KSIntCalculatorMott.cxx
juniorpena Jul 18, 2024
c66c2f6
Update KSIntCalculatorMott.cxx
juniorpena Sep 12, 2024
58d7ac0
Update KSIntCalculatorMottBuilder.h
juniorpena Sep 12, 2024
c338bf9
Update Kassiopeia/XML/Complete/Interactions.xml
juniorpena Sep 12, 2024
0cf5966
Merge branch 'KATRIN-Experiment:main' into mott_scattering
juniorpena Sep 16, 2024
9e94618
Update KSIntCalculatorMott.cxx
juniorpena Sep 16, 2024
8b42389
Update KSIntCalculatorMott.cxx
juniorpena Sep 19, 2024
937c642
Update KSIntCalculatorMott.cxx
juniorpena Sep 25, 2024
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
2 changes: 2 additions & 0 deletions Kassiopeia/Bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ set( BINDINGS_HEADER_FILES
Interactions/Include/KSIntCalculatorHydrogenBuilder.h
Interactions/Include/KSIntCalculatorIonBuilder.h
Interactions/Include/KSIntCalculatorArgonBuilder.h
Interactions/Include/KSIntCalculatorMottBuilder.h
Interactions/Include/KSIntCalculatorKESSBuilder.h
Interactions/Include/KSIntScatteringBuilder.h
Interactions/Include/KSIntSpinFlipBuilder.h
Expand Down Expand Up @@ -346,6 +347,7 @@ set( BINDINGS_SOURCE_FILES
Interactions/Source/KSIntCalculatorHydrogenBuilder.cxx
Interactions/Source/KSIntCalculatorIonBuilder.cxx
Interactions/Source/KSIntCalculatorArgonBuilder.cxx
Interactions/Source/KSIntCalculatorMottBuilder.cxx
Interactions/Source/KSIntCalculatorKESSBuilder.cxx
Interactions/Source/KSIntScatteringBuilder.cxx
Interactions/Source/KSIntSpinFlipBuilder.cxx
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#ifndef Kassiopeia_KSIntCalculatorMottBuilder_h_
#define Kassiopeia_KSIntCalculatorMottBuilder_h_

#include "KComplexElement.hh"
#include "KSIntCalculatorMott.h"

using namespace Kassiopeia;
namespace katrin
{

typedef KComplexElement<KSIntCalculatorMott> KSIntCalculatorMottBuilder;

template<> inline bool KSIntCalculatorMottBuilder::AddAttribute(KContainer* aContainer)
{
if (aContainer->GetName() == "name") {
aContainer->CopyTo(fObject, &KNamed::SetName);
return true;
}
if (aContainer->GetName() == "theta_min") {
aContainer->CopyTo(fObject, &KSIntCalculatorMott::SetThetaMin);

if ((fObject->GetThetaMin() <= 0.0)) {
initmsg(eError) << "\"" << fObject->GetThetaMin()
<< R"(" is an invalid lower bound for Mott scattering! Change to a value > 0)" << eom;

return false;
}
else {
return true;
}
}
if (aContainer->GetName() == "theta_max") {
aContainer->CopyTo(fObject, &KSIntCalculatorMott::SetThetaMax);
if ((fObject->GetThetaMax() > 180.0)) {
initmsg(eError) << "\"" << fObject->GetThetaMax()
<< R"(" is an invalid upper bound for Mott scattering! Change to a value < 180)" << eom;

return false;
}
else {
return true;
}
}
if (aContainer->GetName() == "nucleus") {
aContainer->CopyTo(fObject, &KSIntCalculatorMott::SetNucleus);

if ((fObject->GetNucleus().compare("He") != 0) && (fObject->GetNucleus().compare("Ne") != 0)) {
initmsg(eError) << "\"" << fObject->GetNucleus()
<< R"(" is not available for Mott scattering! Available gases: "He", "Ne")" << eom;

return false;
}
else {
return true;
}
}
return false;
}

} // namespace katrin

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "KSIntCalculatorMottBuilder.h"

#include "KSRootBuilder.h"

using namespace Kassiopeia;
using namespace std;

namespace katrin
{

template<> KSIntCalculatorMottBuilder::~KComplexElement() = default;

STATICINT sKSIntCalculatorMottStructure = KSIntCalculatorMottBuilder::Attribute<std::string>("name") +
KSIntCalculatorMottBuilder::Attribute<double>("theta_min") +
KSIntCalculatorMottBuilder::Attribute<double>("theta_max") +
KSIntCalculatorMottBuilder::Attribute<std::string>("nucleus");

STATICINT sToolboxKSIntCalculatorMott =
KSRootBuilder::ComplexElement<KSIntCalculatorMott>("ksint_calculator_mott");
} // namespace katrin
2 changes: 2 additions & 0 deletions Kassiopeia/Interactions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ set( INTERACTIONS_HEADER_BASENAMES
KSIntCalculatorIon.h
KSIntCalculatorTritium.h
KSIntCalculatorArgon.h
KSIntCalculatorMott.h

KSIntSurfaceSpecular.h
KSIntSurfaceUCN.h
Expand Down Expand Up @@ -78,6 +79,7 @@ set( INTERACTIONS_SOURCE_BASENAMES
KSIntCalculatorIon.cxx
KSIntCalculatorTritium.cxx
KSIntCalculatorArgon.cxx
KSIntCalculatorMott.cxx

KSIntSurfaceSpecular.cxx
KSIntSurfaceUCN.cxx
Expand Down
127 changes: 127 additions & 0 deletions Kassiopeia/Interactions/Include/KSIntCalculatorMott.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#ifndef Kassiopeia_KSIntCalculatorMott_h_
#define Kassiopeia_KSIntCalculatorMott_h_

#include "KField.h"
#include "KSIntCalculator.h"

/*
* KSintCalculatorMott.h
*
* Date: August 22, 2022
* Author: Junior Ivan Peña (juniorpe)
*/

namespace Kassiopeia
{

/*
* The xml configuration for using this calculator is as follows:
* <calculator_mott theta_min="[lower_bound]" theta_max="[upper_bound]"/>
* where [lower_bound] is the lower limit, in degrees, on the range of allowed scattering
* angles and [upper_bound] is the upper limit. A theta_min of 0 is not allowed since the
* Mott Cross Section has a singularity there.
*/
class KSIntCalculatorMott : public KSComponentTemplate<KSIntCalculatorMott, KSIntCalculator>
{
public:
KSIntCalculatorMott();
KSIntCalculatorMott(const KSIntCalculatorMott& aCopy);
KSIntCalculatorMott* Clone() const override;
~KSIntCalculatorMott() override;

public:
void CalculateCrossSection(const KSParticle& anInitialParticle, double& aCrossSection) override;
void ExecuteInteraction(const KSParticle& anInitialParticle, KSParticle& aFinalParticle,
KSParticleQueue& aSecondaries) override;

public:
;
K_SET_GET(double, ThetaMin); // radians
;
K_SET_GET(double, ThetaMax); // radians
;
K_SET_GET(std::string, Nucleus);

public:
/**
* \brief Returns scattering angle sampled from Mott Differential Cross Seciton for a given
* incoming electron energy. Sampling is done using using inverse transform sampling of
* Rutherford Differential Cross Section, then rejection sampling with a rescaled Ruth. Diff. X-Sec
*
* \parameter electron's initial kinetic energy
*
* \return Scatter angle
*/
double GetTheta(const double& anEnergy);

/**
* \brief Calculates energy loss after electron scatters using equation (1.51) in:
* C. Leroy and P.G. Rancoita, Principles of Radiation Interaction in Matter and Detection,
* 2nd Edition, World Scientific (Singapore) 2009.
*
* \parameters electron's initial kinetic energy, scattering angle
*
* \return Electron's energy loss
*/
double GetEnergyLoss(const double& anEnergy, const double& aTheta);
/**
* \parameter Electron's initial kinetic energy
*
* \return Electron's natural velocity beta = v/c
*/
double Beta(double const E0);
/**
* \brief Takes in the electron's initial energy and calculates the coefficients used in the
* RMott calculation for He corresponding to equation (25) in:
* M.J Boschini, C. Consolandi, M. Gervasi, et al., J. Radiat. Phys. Chem. 90 (2013) 36-66.
*
* \parameter Electron's initial kinetic energy
*
* \return Vector containing 5 calculated coeffecients of a
*/
std::vector<double> RMott_coeffs(double const E0);
/**
* \brief Returns the Mott Differential Cross Section(from equation (3) and (24) in: M.J Boschini,
* C. Consolandi, M. Gervasi, et al., J. Radiat. Phys. Chem. 90 (2013) 36-66.) Used for rejection
* sampling in GetTheta function
*
* \parameter Electron's initial kinetic energy and scatter angle
*
* \return Mott Differential Cross Section
*
*/
double MDCS(double theta, const double E0);
/**
* \brief Calculates the analytical integral result of the Mott Differential Cross Section(from
* equation (3) and (24) in: M.J Boschini, C. Consolandi, M. Gervasi, et al., J. Radiat. Phys. Chem. 90 (2013) 36-66.)
* within the bounds [fThetaMin, theta] for a given electron initial kinetic energy and some
* integral upper bound theta
*
* \parameter Electron's initial kinetic energy, integral upper bound theta
*
* \return Integral of Mott Differential Cross Section from fThetaMin to theta
*
*/
double MTCS(double theta, const double E0);
/**
* \brief Used for rejection sampling in GetTheta function
*
* \parameter Scatter Angle
*
* \return Rutherford Differential Cross Section normalized in range [fThetaMin, fThetaMax]
*
*/
double Normalized_RDCS(double theta);
/**
* \brief Used for inverse transform sampling for obtaining scatter angle in GetTheta function
*
* \return Inverse of normalized Rutherford Differential Cross Section in range [fThetaMin, fThetaMax]
*
*/
double Normalized_RTCSInverse(double x);

};

} // namespace Kassiopeia

#endif
Loading