From dff92c253a78801ef4f8795b054363848f76a502 Mon Sep 17 00:00:00 2001 From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu> Date: Fri, 21 Dec 2018 15:16:59 +0100 Subject: [PATCH] commented testCOMBoost --- Framework/Utilities/testCOMBoost.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Framework/Utilities/testCOMBoost.cc b/Framework/Utilities/testCOMBoost.cc index 353fdaee..782fcf90 100644 --- a/Framework/Utilities/testCOMBoost.cc +++ b/Framework/Utilities/testCOMBoost.cc @@ -39,33 +39,42 @@ TEST_CASE("boosts") { return E * E / cSquared - p.squaredNorm(); }; - MassType const projectileMass = 4_GeV / cSquared; - Vector<momentum_d> pProjectileLab{rootCS, {0_GeV / c, 100_GeV / c, 0_GeV / c}}; + // define projectile kinematics in lab frame + MassType const projectileMass = 1._GeV / cSquared; + Vector<momentum_d> pProjectileLab{rootCS, {0_GeV / c, 1_PeV / c, 0_GeV / c}}; EnergyType const eProjectileLab = energy(projectileMass, pProjectileLab); + // define target kinematics in lab frame MassType const targetMass = 1_GeV / cSquared; Vector<momentum_d> pTargetLab{rootCS, {0_Ns, 0_Ns, 0_Ns}}; EnergyType const eTargetLab = energy(targetMass, pTargetLab); + // define boost to com frame COMBoost boost(eProjectileLab, pProjectileLab, targetMass); + // boost projecticle auto const [eProjectileCoM, pProjectileCoM] = boost.toCoM(eProjectileLab, pProjectileLab); + + // boost target auto const [eTargetCoM, pTargetCoM] = boost.toCoM(eTargetLab, pTargetLab); + // sum of momenta in CoM, should be 0 auto const sumPCoM = pProjectileCoM + pTargetCoM; + CHECK(sumPCoM[2] / (1_GeV / c) == Approx(0).margin(absMargin)); + // mandelstam-s should be invariant under transformation CHECK(s(eProjectileLab + eTargetLab, pProjectileLab.GetComponents() + pTargetLab.GetComponents()) / (1_GeV / c) / (1_GeV / c) == Approx(s(eProjectileCoM + eTargetCoM, pProjectileCoM + pTargetCoM) / (1_GeV / c) / (1_GeV / c))); - CHECK(sumPCoM[2] / (1_GeV / c) == Approx(0).margin(absMargin)); - + // boost back... auto const [eProjectileBack, pProjectileBack] = boost.fromCoM(eProjectileCoM, pProjectileCoM); + // ...should yield original values before the boosts CHECK(eProjectileBack / eProjectileLab == Approx(1)); CHECK((pProjectileBack - pProjectileLab).norm() / (1_GeV / c) == Approx(0).margin(absMargin)); -- GitLab