Skip to content

Commit 4fa96cf

Browse files
authored
Interface specs update (#17)
- Removed the Algebra part - Changed spatial_mag2 to rho2 after discussion with Uwe - Add more explanation on the coordinate system support - Fix some typos
1 parent 89d5f22 commit 4fa96cf

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

docs/src/10-interface.md

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
# [Interface](@id interface)
22

3+
This section explains how the object can become a `LorentzVector`.
4+
5+
## Definition
6+
7+
We will call _`LorentzVector`-compliant_, a type that fulfills our interface described in this section. The package that provides such a type will be called _the provider_.
8+
9+
## Coordinate systems
10+
11+
The provider must specify a preferred coordinate system for its _`LorentzVector`-compliant_ type and provides accesors to the components in this system with standardized methods (specified below). In case the object natively supports several coordinate systems, the one for which the component access is the most efficient will be chosen as the _preferred coordinate system_. It has to be one of the supported coordinate system.
12+
13+
The `LorentzVectorBase` package complements the component accessors to cover all the supported coordinate systems. It uses the components in the _preferred coordinate_ system to implement the complementary accessors. The Julia dispatch mechanism is used to give the preference to the accessors provided with the objet.
14+
15+
📝 A `LorenztVector`-compliant type can include more data than the four-vector. E.g., a type describing an elementary particle can comply, while containing more data than the particle four-momentum.
16+
317
## Implementation
418

5-
This section explains how the object can become a `LorentzVector`. A type `MyLorentzVector` will comply to the `LorentzVector` interface if one of the following et of methods is implemented.
19+
A type `MyLorentzVector` will comply to the `LorentzVector` interface if one of the following set of methods is implemented.
620

721
### Option 1: position with cartesian coordinates
822

923
| Required Methods | Brief Description |
1024
|--------------------------------------------------------------|-------------------------------------------------|
1125
| `LorentzVectorBase.islorentzvector(::Type{MyLorentzVector})` | Declare that your type implements the interface |
12-
| `LorentzVectorBase.coordinatesystem(::Type{MyLorentzVector}) = LorentzVectorBase.XYZE` | Declare the preferred coordinated system |
26+
| `LorentzVectorBase.coordinatesystem(::Type{MyLorentzVector}) = LorentzVectorBase.XYZE` | Declare the preferred coordinate system |
1327
| `LorentzVectorBase.x(::Tupe{MyLorentzVector})` | x cartesian coordinate |
1428
| `LorentzVectorBase.y(::Tupe{MyLorentzVector})` | y cartesian coordinate |
1529
| `LorentzVectorBase.z(::Tupe{MyLorentzVector})` | z cartesian coordinate |
@@ -23,57 +37,43 @@ This section explains how the object can become a `LorentzVector`. A type `MyLor
2337
|--------------------------------------------------------------|-------------------------------------------------|
2438
| `LorentzVectorBase.islorentzvector(::Type{MyLorentzVector})` | Declare that your type implements the interface |
2539
| `LorentzVectorBase.coordinatesystem(::Type{MyLorentzVector}) = LorentzVectorBase.XYZE` | Declare the preferred coordinated system |
26-
| `LorentzVectorBase.px(::Tupe{MyLorentzVector})` | x cartesian coordinate |
27-
| `LorentzVectorBase.py(::Tupe{MyLorentzVector})` | y cartesian coordinate |
28-
| `LorentzVectorBase.pz(::Tupe{MyLorentzVector})` | z cartesian coordinate |
29-
| `LorentzVectorBase.pt(::Tupe{MyLorentzVector})` | t cartesian coordinate |
30-
| | |
40+
| `LorentzVectorBase.px(::Tupe{MyLorentzVector})` | momentum x-component |
41+
| `LorentzVectorBase.py(::Tupe{MyLorentzVector})` | momentum y-component |
42+
| `LorentzVectorBase.pz(::Tupe{MyLorentzVector})` | momentim z-component |
43+
| `LorentzVectorBase.energy(::Tupe{MyLorentzVector})` | energy |
3144

3245
### Option 3 four-momentum with cylindrical coordinates
3346

3447
| Required Methods | Brief Description |
3548
|--------------------------------------------------------------|-------------------------------------------------|
3649
| `LorentzVectorBase.islorentzvector(::Type{MyLorentzVector})` | Declare that your type implements the interface |
3750
| `LorentzVectorBase.coordinatesystem(::Type{MyLorentzVector})`| Declare the preferred coordinated system. Must return PtEtaPhiM, PtEtaPhiE, PtYPhiM, or PtYPhiE (from LorentzVectorBase).|
38-
| `LorentzVectorBase.pt(::Tupe{MyLorentzVector})` | x cartesian coordinate |
39-
| `LorentzVectorBase.phi(::Tupe{MyLorentzVector})` | z cartesian coordinate |
51+
| `LorentzVectorBase.pt(::Tupe{MyLorentzVector})` | transverse momemun |
52+
| `LorentzVectorBase.phi(::Tupe{MyLorentzVector})` | azimuthal angle |
4053

4154
<br>
4255
and *one of*
4356

44-
| | |
57+
| &nbsp; | &nbsp; |
4558
|---|---|
46-
| `LorentzVectorBase.eta(::Tupe{MyLorentzVector})` | y cartesian coordinate |
47-
| `LorentzVectorBase.rapidity(::Tupe{MyLorentzVector})` | y cartesian coordinate |
59+
| `LorentzVectorBase.eta(::Tupe{MyLorentzVector})` | pseudorapity |
60+
| `LorentzVectorBase.rapidity(::Tupe{MyLorentzVector})` | rapidity relative to the beam axis (z-axis) |
4861

4962
<br>
5063
and *one of*
5164

52-
| | |
65+
| &nbsp; | &nbsp; |
5366
|-|-|
5467
| `LorentzVectorBase.energy(::Tupe{MyLorentzVector})` | energy |
5568
| `LorentzVectorBase.mass(::Tupe{MyLorentzVector})` | invariant mass |
5669

57-
The methods that returns the coordinates of the prefered system (returned by `coordinatesystem()`) must be implemented.
70+
The methods that returns the coordinates of the preferred system (returned by `coordinate_system()`) must be implemented.
5871

5972
## Optional methods
6073

61-
| | |
74+
| &nbsp; | &nbsp; |
6275
|-|-|
6376
| `LorentzVectorBase.mass2(::MyType{MyLorentzVector})` | mass to the square |
64-
| `LorentzVectorBase.spatial_magnitude2(::MyType{MyLorentzVector})` | mass to the square |
77+
| `LorentzVectorBase.rho2(::MyType{MyLorentzVector})` | ρ² = \|**p**\|² |
6578
| Any of the above method i.e, a method of option Y when methods of option X are provided ||
6679

67-
## LorentzVectorBase
68-
69-
The type can *optionnally* be a subtype of the LorentzVectorBase.LorentzVectorBase to benefit from default implementations of lorentz vector algebra.
70-
71-
# Basic functions provided for subtypes of LorentzVectorBase
72-
73-
- Base.+(::LorentzVectorBase, ::LorentzVectorBase)
74-
- Base.-(::LorentzVectorBase, ::LorentzVectorBase)
75-
- LinearAlgebra.dot(::LorentzVectorBase, ::LorentzVectorBase)¹
76-
77-
---
78-
¹x⋅y = LinearAlgebra.dot(x,y)
79-

0 commit comments

Comments
 (0)