forked from QEDjl-project/QEDprocesses.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess.jl
80 lines (67 loc) · 2.21 KB
/
process.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
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"""
Compton(
in_spin [= AllSpin()]
in_pol [= AllPol()]
out_spin [= AllSpin()]
out_pol [= AllPol()]
)
"""
struct Compton{InElectronSpin,InPhotonPol,OutElectronSpin,OutPhotonPol} <:
AbstractProcessDefinition where {
InElectronSpin<:AbstractSpin,
InPhotonPol<:AbstractPolarization,
OutElectronSpin<:AbstractSpin,
OutPhotonPol<:AbstractPolarization,
}
in_spin::InElectronSpin
in_pol::InPhotonPol
out_spin::OutElectronSpin
out_pol::OutPhotonPol
end
function Compton()
return Compton(AllSpin(), AllPol(), AllSpin(), AllPol())
end
function Compton(in_pol::AbstractPolarization)
return Compton(AllSpin(), in_pol, AllSpin(), AllPol())
end
function Compton(in_pol::AbstractPolarization, out_pol::AbstractPolarization)
return Compton(AllSpin(), in_pol, AllSpin(), out_pol)
end
_polarizations(proc::Compton) = (proc.in_pol, proc.out_pol)
_spins(proc::Compton) = (proc.in_spin, proc.out_spin)
_in_spin_and_pol(proc::Compton) = (proc.in_spin, proc.in_pol)
_out_spin_and_pol(proc::Compton) = (proc.out_spin, proc.out_pol)
function QEDbase.incoming_particles(::Compton)
return (Electron(), Photon())
end
function QEDbase.outgoing_particles(::Compton)
return (Electron(), Photon())
end
function QEDbase.incoming_spin_pols(proc::Compton)
return (proc.in_spin, proc.in_pol)
end
function QEDbase.outgoing_spin_pols(proc::Compton)
return (proc.out_spin, proc.out_pol)
end
function _spin_or_pol(process::Compton, ::Electron, ::Incoming)
return process.in_spin
end
function _spin_or_pol(process::Compton, ::Electron, ::Outgoing)
return process.out_spin
end
function _spin_or_pol(process::Compton, ::Photon, ::Incoming)
return process.in_pol
end
function _spin_or_pol(process::Compton, ::Photon, ::Outgoing)
return process.out_pol
end
function Base.show(io::IO, ::Compton)
print(io, "one-photon Compton scattering")
return nothing
end
function Base.show(io::IO, ::MIME"text/plain", proc::Compton)
println(io, "one-photon Compton scattering")
println(io, " incoming: electron ($(proc.in_spin)), photon ($(proc.in_pol))")
println(io, " outgoing: electron ($(proc.out_spin)), photon ($(proc.out_pol))")
return nothing
end