コード例 #1
0
ファイル: testInteraction.cpp プロジェクト: cheiter/CRPropa3
TEST(ElectronPairProduction, energyDecreasing) {
    // Test if energy loss occurs for protons with energies from 1e15 - 1e23 eV
    Candidate c;
    c.setCurrentStep(2 * Mpc);
    c.current.setId(nucleusId(1, 1)); // proton

    ElectronPairProduction epp1(CMB);
    for (int i = 0; i < 80; i++) {
        double E = pow(10, 15 + i * 0.1) * eV;
        c.current.setEnergy(E);
        epp1.process(&c);
        EXPECT_LE(c.current.getEnergy(), E);
    }

    ElectronPairProduction epp2(IRB);
    for (int i = 0; i < 80; i++) {
        double E = pow(10, 15 + i * 0.1) * eV;
        c.current.setEnergy(E);
        epp2.process(&c);
        EXPECT_LE(c.current.getEnergy(), E);
    }
}