OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TestMuonDecay.cpp
Go to the documentation of this file.
1#include "Physics/MuonDecay.h"
2#include "Physics/Physics.h"
3#include "gtest/gtest.h"
4
5#include <cmath>
6
7namespace {
8
9 TEST(MuonDecayTest, MaxElectronEnergyIsHalfMuonMass) {
11 }
12
13 TEST(MuonDecayTest, MinElectronXIsPositiveAndSmall) {
14 const double xMin = Physics::MuonDecay::minElectronX();
15 EXPECT_GT(xMin, 0.0);
16 EXPECT_LT(xMin, 0.02); // m_e / (m_mu/2) ~ 0.0097
17 }
18
19 TEST(MuonDecayTest, MichelSpectrumIsNonNegativeInRange) {
20 const double xMin = Physics::MuonDecay::minElectronX();
21 constexpr int nSamples = 1000;
22 for (int i = 0; i <= nSamples; ++i) {
23 const double x = xMin + (1.0 - xMin) * static_cast<double>(i) / nSamples;
24 EXPECT_GE(Physics::MuonDecay::michelSpectrum(x), 0.0);
25 }
26 }
27
28 TEST(MuonDecayTest, MichelSpectrumPeaksAtXEqualsOne) {
29 const double fPeak = Physics::MuonDecay::michelSpectrum(1.0);
30 EXPECT_NEAR(fPeak, Physics::MuonDecay::michelUpperBound(), 1.0e-14);
31 }
32
33 TEST(MuonDecayTest, MichelSpectrumBelowUpperBound) {
34 const double xMin = Physics::MuonDecay::minElectronX();
35 const double upper = Physics::MuonDecay::michelUpperBound();
36 constexpr int nSamples = 10000;
37 for (int i = 0; i <= nSamples; ++i) {
38 const double x = xMin + (1.0 - xMin) * static_cast<double>(i) / nSamples;
39 EXPECT_LE(Physics::MuonDecay::michelSpectrum(x), upper + 1.0e-14);
40 }
41 }
42
43 TEST(MuonDecayTest, MichelSpectrumEndpoints) {
44 // f(0) = 0
45 EXPECT_DOUBLE_EQ(Physics::MuonDecay::michelSpectrum(0.0), 0.0);
46 // f(1) = 2*1*1*(3-2) = 2
47 EXPECT_DOUBLE_EQ(Physics::MuonDecay::michelSpectrum(1.0), 2.0);
48 }
49
50 TEST(MuonDecayTest, MichelUpperBoundIs2) {
51 EXPECT_DOUBLE_EQ(Physics::MuonDecay::michelUpperBound(), 2.0);
52 }
53
54} // namespace
TEST(IndexMapTest, RebuildsReferencePathModelFromOrderedRanges)
KOKKOS_INLINE_FUNCTION constexpr double michelUpperBound()
Upper bound of the Michel spectrum, attained at : .
KOKKOS_INLINE_FUNCTION constexpr double minElectronX()
Minimum reduced energy .
KOKKOS_INLINE_FUNCTION double michelSpectrum(double x)
KOKKOS_INLINE_FUNCTION constexpr double maxElectronEnergy()
Maximum electron energy in the muon rest frame [GeV]: .
constexpr double m_mu
The muon rest mass in GeV.
Definition Physics.h:129