Skip to content

Commit

Permalink
First description of the interface (#8)
Browse files Browse the repository at this point in the history
* First description of the interface
* added method that returns the preferred coordinate syste,
* fixed doc on interface

---------

Co-authored-by: Mikhail Mikhasenko <mikhail.mikhasenko@cern.ch>
  • Loading branch information
grasph and mmikhasenko authored Oct 2, 2024
1 parent 7c237b5 commit 8b2f2d2
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
67 changes: 67 additions & 0 deletions docs/src/10-interface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# [Interface](@id interface)

## Implementation

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.

### Option 1: position with cartesian coordinates

| Required Methods | Brief Description |
|--------------------------------------------------------------|-------------------------------------------------|
| `LorentzVectorBase.islorentzvector(::Type{MyLorentzVector})` | Declare that your type implements the interface |
| `LorentzVectorBase.coordinatesystem(::Type{MyLorentzVector}) = LorentzVectorBase.XYZE` | Declare the preferred coordinated system |
| `LorentzVectorBase.x(::Tupe{MyLorentzVector})` | x cartesian coordinate |
| `LorentzVectorBase.y(::Tupe{MyLorentzVector})` | y cartesian coordinate |
| `LorentzVectorBase.z(::Tupe{MyLorentzVector})` | z cartesian coordinate |
| `LorentzVectorBase.t(::Tupe{MyLorentzVector})` | t cartesian coordinate |
| | |


### Option 2: four-momentum with catesian coordinates

| Required Methods | Brief Description |
|--------------------------------------------------------------|-------------------------------------------------|
| `LorentzVectorBase.islorentzvector(::Type{MyLorentzVector})` | Declare that your type implements the interface |
| `LorentzVectorBase.coordinatesystem(::Type{MyLorentzVector}) = LorentzVectorBase.XYZE` | Declare the preferred coordinated system |
| `LorentzVectorBase.px(::Tupe{MyLorentzVector})` | x cartesian coordinate |
| `LorentzVectorBase.py(::Tupe{MyLorentzVector})` | y cartesian coordinate |
| `LorentzVectorBase.pz(::Tupe{MyLorentzVector})` | z cartesian coordinate |
| `LorentzVectorBase.pt(::Tupe{MyLorentzVector})` | t cartesian coordinate |
| | |

### Option 3 four-momentum with cylindrical coordinates

| Required Methods | Brief Description |
|--------------------------------------------------------------|-------------------------------------------------|
| `LorentzVectorBase.islorentzvector(::Type{MyLorentzVector})` | Declare that your type implements the interface |
| `LorentzVectorBase.coordinatesystem(::Type{MyLorentzVector})`| Declare the preferred coordinated system. Must return PtEtaPhiM, PtEtaPhiE, PtYPhiM, or PtYPhiE (from LorentzVectorBase).|
| `LorentzVectorBase.pt(::Tupe{MyLorentzVector})` | x cartesian coordinate |
| `LorentzVectorBase.phi(::Tupe{MyLorentzVector})` | z cartesian coordinate |

<br>
and *one of*

| | |
|---|---|
| `LorentzVectorBase.eta(::Tupe{MyLorentzVector})` | y cartesian coordinate |
| `LorentzVectorBase.rapidity(::Tupe{MyLorentzVector})` | y cartesian coordinate |

<br>
and *one of*

| | |
|-|-|
| `LorentzVectorBase.energy(::Tupe{MyLorentzVector})` | energy |
| `LorentzVectorBase.mass(::Tupe{MyLorentzVector})` | invariant mass |

The methods that returns the coordinates of the prefered system (returned by `coordinatesystem()`) must be implemented.

## Optional methods

| | |
|-|-|
| `LorentzVectorBase.mass2(::MyType{MyLorentzVector})` | mass to the square |
| `LorentzVectorBase.spatial_magnitude2(::MyType{MyLorentzVector})` | mass to the square |
| Any of the above method i.e, a method of option Y when methods of option X are provided ||

=======
1 change: 0 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ CurrentModule = LorentzVectorBase

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


0 comments on commit 8b2f2d2

Please sign in to comment.