// ElectronPairProduction ----------------------------------------------------- TEST(ElectronPairProduction, allBackgrounds) { // Test if interaction data files are loaded. ElectronPairProduction epp1(CMB); ElectronPairProduction epp2(IRB_Kneiske04); ElectronPairProduction epp3(IRB_Stecker05); ElectronPairProduction epp4(IRB_Franceschini08); ElectronPairProduction epp5(IRB_Finke10); ElectronPairProduction epp6(IRB_Dominguez11); ElectronPairProduction epp7(IRB_Gilmore12); }
void epp(double *x, double * c, int * iter_step, double * v, int n, double rho, double p, double c0) { if (rho <0) { printf("\n rho should be non-negative!"); exit(1); } if (p==1) { epp1(x, v, n, rho); *c=0; iter_step[0]=iter_step[1]=0; } else if (p==2) { epp2(x, v, n, rho); *c=0; iter_step[0]=iter_step[1]=0; } else if (p>=1e6) /* when p >=1e6, we treat it as infity*/ eppInf(x, c, iter_step, v, n, rho, c0); else eppO(x, c, iter_step, v, n, rho, p); }
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); } }