Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include <corsika/framework/process/IntLengthModifyingProcess.hpp>
#include <corsika/framework/core/PhysicalUnits.hpp>
#include <catch2/catch.hpp>
using namespace corsika;
struct DummyProcess {
template <typename TParticle>
GrammageType getInteractionLength(TParticle const&) {
return 100_g / 1_cm / 1_cm;
}
template <typename TArgument>
void doInteraction(TArgument& arg) {
arg = 3;
}
};
struct DummyParticle {
HEPEnergyType getEnergy() const { return 47_TeV; }
Code getPID() const { return Code::MuPlus; }
};
TEST_CASE("IntLengthModifyingProcess", "[process]") {
DummyProcess u;
auto const modifier = [](GrammageType orig, Code, HEPEnergyType) -> GrammageType {
return orig * 2;
};
IntLengthModifyingProcess mod{u, modifier};
SECTION("getInteractionLength") {
DummyParticle const p;
REQUIRE(mod.getInteractionLength(p) == 200_g / 1_cm / 1_cm);
}
SECTION("doInteraction") {
int k = 0;
mod.doInteraction(k);
REQUIRE(k == 3);
}
}