forked from QEDjl-project/QEDprocesses.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroundtruths.jl
25 lines (21 loc) · 891 Bytes
/
groundtruths.jl
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
POLS = [PolX(), PolY(), AllPol()]
SPINS = [SpinUp(), SpinDown(), AllSpin()]
function _groundtruth_is_physical(proc::ScatteringProcess, ::PerturbativeQED)
incoming_electrons = number_particles(proc, Incoming(), Electron())
incoming_positrons = number_particles(proc, Incoming(), Positron())
outgoing_electrons = number_particles(proc, Outgoing(), Electron())
outgoing_positrons = number_particles(proc, Outgoing(), Positron())
return incoming_electrons + outgoing_positrons ==
outgoing_electrons + incoming_positrons
end
function _groundtruth_spin_pols(particles)
return ntuple(
x -> is_fermion(particles[x]) ? AllSpin() : AllPolarization(), length(particles)
)
end
function _random_spin_pols(RNG, particles)
return ntuple(
x -> is_fermion(particles[x]) ? rand(RNG, SPINS) : rand(RNG, POLS),
length(particles),
)
end