// File: PeterDenton[P]Nu-Pert/src/Examples.cpp
// Function: Example1()
void Example1()
{
	std::cout << "==== Example 1 ====" << std::endl;

	int alpha = 1;					// muon type neutrino
	int beta = 0;					// electron type neutrino
	double delta = 3 * M_PI / 2;	// The CP phase
	int exp_num = 0;				// 0 - DUNE, 1 - NOvA, 2 - T2K/T2HK
	double E = 2.5;					// neutrino energy in GeV
	int order = 0;					// Zeroth order in the perturbative expansion
	E *= -1;						// Negative energy for antineutrinos

	double Yrho, L;
	set_experimental_parameters(exp_num, &Yrho, &L); // Get matter density and baseline for the experiment

	double a = Yrho * E * Y_to_a;   // Y_to_a converts units
	double LE = L / E;
	double P = GF::Palphabeta(alpha, beta, a, LE, delta, order); // Calculate the transition probability using the general form described in the tables

	std::cout << std::setprecision(10); // Increases the number of decimal places to output
	std::cout << "P(nubar_mu->nubar_e) at zeroth order: ";
	std::cout << P << std::endl;

	order = 1; // First order in the perturbative expansion
	P = GF::Palphabeta(alpha, beta, a, LE, delta, order);
	std::cout << "P(nubar_mu->nubar_e) at first order:  ";
	std::cout << P << std::endl;

	order = 2; // Second order in the perturbative expansion
	P = Check::Palphabeta(alpha, beta, a, LE, delta, order);
	std::cout << "P(nubar_mu->nubar_e) at second order: ";
	std::cout << P << std::endl;
}

// Assembly:
subq $0x58, %rsp
movq 0x5da5(%rip), %rdi      # 0x16fd0
leaq 0x1b56(%rip), %rsi      # 0x12d88
callq 0x2150
movq %rax, %rdi
movq 0x5d7f(%rip), %rsi      # 0x16fc0
callq 0x2170
movl $0x1, 0x54(%rsp)
movl $0x0, 0x50(%rsp)
movsd 0x1b0a(%rip), %xmm0     # 0x12d68
movsd %xmm0, 0x48(%rsp)
movl $0x0, 0x44(%rsp)
movsd 0x1aec(%rip), %xmm0     # 0x12d60
movsd %xmm0, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
movsd 0x1206(%rip), %xmm0     # 0x12490
mulsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movl 0x44(%rsp), %edi
leaq 0x28(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x6f60
movsd 0x28(%rsp), %xmm0
mulsd 0x38(%rsp), %xmm0
leaq 0x1024(%rip), %rax      # 0x122e0
mulsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x20(%rsp), %xmm0
divsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x54(%rsp), %edi
movl 0x50(%rsp), %esi
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movl 0x34(%rsp), %edx
callq 0x8c40
movsd %xmm0, 0x8(%rsp)
movl $0xa, %edi
callq 0x11560
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %esi
movq 0x5cb6(%rip), %rdi      # 0x16fd0
callq 0x2200
movq 0x5caa(%rip), %rdi      # 0x16fd0
leaq 0x1a6f(%rip), %rsi      # 0x12d9c
callq 0x2150
movsd 0x8(%rsp), %xmm0
movq 0x5c91(%rip), %rdi      # 0x16fd0
callq 0x2280
movq %rax, %rdi
movq 0x5c72(%rip), %rsi      # 0x16fc0
callq 0x2170
movl $0x1, 0x34(%rsp)
movl 0x54(%rsp), %edi
movl 0x50(%rsp), %esi
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movl 0x34(%rsp), %edx
callq 0x8c40
movsd %xmm0, 0x8(%rsp)
movq 0x5c45(%rip), %rdi      # 0x16fd0
leaq 0x1a31(%rip), %rsi      # 0x12dc3
callq 0x2150
movsd 0x8(%rsp), %xmm0
movq 0x5c2c(%rip), %rdi      # 0x16fd0
callq 0x2280
movq %rax, %rdi
movq 0x5c0d(%rip), %rsi      # 0x16fc0
callq 0x2170
movl $0x2, 0x34(%rsp)
movl 0x54(%rsp), %edi
movl 0x50(%rsp), %esi
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movl 0x34(%rsp), %edx
callq 0x4140
movsd %xmm0, 0x8(%rsp)
movq 0x5be0(%rip), %rdi      # 0x16fd0
leaq 0x19f3(%rip), %rsi      # 0x12dea
callq 0x2150
movsd 0x8(%rsp), %xmm0
movq 0x5bc7(%rip), %rdi      # 0x16fd0
callq 0x2280
movq %rax, %rdi
movq 0x5ba8(%rip), %rsi      # 0x16fc0
callq 0x2170
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)