Skip to content

Commit 8b2f2d2

Browse files
grasphmmikhasenko
andauthored
First description of the interface (#8)
* First description of the interface * added method that returns the preferred coordinate syste, * fixed doc on interface --------- Co-authored-by: Mikhail Mikhasenko <[email protected]>
1 parent 7c237b5 commit 8b2f2d2

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

docs/src/10-interface.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# [Interface](@id interface)
2+
3+
## Implementation
4+
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.
6+
7+
### Option 1: position with cartesian coordinates
8+
9+
| Required Methods | Brief Description |
10+
|--------------------------------------------------------------|-------------------------------------------------|
11+
| `LorentzVectorBase.islorentzvector(::Type{MyLorentzVector})` | Declare that your type implements the interface |
12+
| `LorentzVectorBase.coordinatesystem(::Type{MyLorentzVector}) = LorentzVectorBase.XYZE` | Declare the preferred coordinated system |
13+
| `LorentzVectorBase.x(::Tupe{MyLorentzVector})` | x cartesian coordinate |
14+
| `LorentzVectorBase.y(::Tupe{MyLorentzVector})` | y cartesian coordinate |
15+
| `LorentzVectorBase.z(::Tupe{MyLorentzVector})` | z cartesian coordinate |
16+
| `LorentzVectorBase.t(::Tupe{MyLorentzVector})` | t cartesian coordinate |
17+
| | |
18+
19+
20+
### Option 2: four-momentum with catesian coordinates
21+
22+
| Required Methods | Brief Description |
23+
|--------------------------------------------------------------|-------------------------------------------------|
24+
| `LorentzVectorBase.islorentzvector(::Type{MyLorentzVector})` | Declare that your type implements the interface |
25+
| `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+
| | |
31+
32+
### Option 3 four-momentum with cylindrical coordinates
33+
34+
| Required Methods | Brief Description |
35+
|--------------------------------------------------------------|-------------------------------------------------|
36+
| `LorentzVectorBase.islorentzvector(::Type{MyLorentzVector})` | Declare that your type implements the interface |
37+
| `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 |
40+
41+
<br>
42+
and *one of*
43+
44+
| | |
45+
|---|---|
46+
| `LorentzVectorBase.eta(::Tupe{MyLorentzVector})` | y cartesian coordinate |
47+
| `LorentzVectorBase.rapidity(::Tupe{MyLorentzVector})` | y cartesian coordinate |
48+
49+
<br>
50+
and *one of*
51+
52+
| | |
53+
|-|-|
54+
| `LorentzVectorBase.energy(::Tupe{MyLorentzVector})` | energy |
55+
| `LorentzVectorBase.mass(::Tupe{MyLorentzVector})` | invariant mass |
56+
57+
The methods that returns the coordinates of the prefered system (returned by `coordinatesystem()`) must be implemented.
58+
59+
## Optional methods
60+
61+
| | |
62+
|-|-|
63+
| `LorentzVectorBase.mass2(::MyType{MyLorentzVector})` | mass to the square |
64+
| `LorentzVectorBase.spatial_magnitude2(::MyType{MyLorentzVector})` | mass to the square |
65+
| Any of the above method i.e, a method of option Y when methods of option X are provided ||
66+
67+
=======

docs/src/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ CurrentModule = LorentzVectorBase
66

77
Documentation for [LorentzVectorBase](https://github.com/JuliaHEP/LorentzVectorBase.jl).
88

9-

0 commit comments

Comments
 (0)