|
1 |
| -# LorentzVectorBase |
2 |
| - |
3 |
| -Base interfaces for four-momenta in high-energy physics. |
| 1 | +# LorentzVectorBase.jl |
4 | 2 |
|
5 | 3 | [](https://JuliaHEP.github.io/LorentzVectorBase.jl/stable/)
|
6 | 4 | [](https://JuliaHEP.github.io/LorentzVectorBase.jl/dev/)
|
7 | 5 | [](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Test.yml?query=branch%3Amain)
|
8 | 6 | [](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Docs.yml?query=branch%3Amain)
|
9 | 7 | [](https://codecov.io/gh/JuliaHEP/LorentzVectorBase.jl)
|
10 | 8 |
|
11 |
| -# Code Formatting |
| 9 | +**LorentzVectorBase.jl** provides base interfaces for four-momenta in high-energy physics, facilitating standardized representations and operations on Lorentz vectors. |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +Install the package using Julia's package manager: |
| 14 | + |
| 15 | +```julia |
| 16 | +using Pkg |
| 17 | +Pkg.add("LorentzVectorBase") |
| 18 | +``` |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +This package defines abstract interfaces for Lorentz vectors. To utilize concrete implementations, consider packages like [LorentzVectorHEP.jl](https://github.com/JuliaHEP/LorentzVectorHEP.jl) or [FourVectors.jl](https://github.com/mmikhasenko/FourVectors.jl). |
| 23 | + |
| 24 | +## Example |
12 | 25 |
|
13 |
| -This package follows a standardized formatting configuration to ensure consistency across |
14 |
| -the codebase. We enforce these formatting guidelines by running checks on all pull requests |
15 |
| -through continuous integration (CI). |
| 26 | +Here is an example of how to define a custom Lorentz vector type and implement the required interface functions: |
16 | 27 |
|
17 |
| -To format your code locally and ensure it meets the required standards, you can run the |
18 |
| -following command in your terminal: |
| 28 | +```Julia |
| 29 | +struct CustomLVector |
| 30 | + x |
| 31 | + y |
| 32 | + z |
| 33 | + t |
| 34 | +end |
19 | 35 |
|
20 |
| -```bash |
| 36 | +LorentzVectorBase.coordinate_system(::CustomLVector) = LorentzVectorBase.XYZT() |
| 37 | +LorentzVectorBase.x(lv::CustomLVector) = lv.x |
| 38 | +LorentzVectorBase.y(lv::CustomLVector) = lv.y |
| 39 | +LorentzVectorBase.z(lv::CustomLVector) = lv.z |
| 40 | +LorentzVectorBase.t(lv::CustomLVector) = lv.t |
| 41 | + |
| 42 | + |
| 43 | +c = CustomLVector(1,2,3,4) |
| 44 | +@assert isapprox(LorentzVectorBase.spatial_magnitude(c), sqrt(1^2 + 2^2 + 3^2)) |
| 45 | +``` |
| 46 | + |
| 47 | +## Code Formatting |
| 48 | + |
| 49 | +To maintain code consistency, format your code with: |
| 50 | + |
| 51 | +```julia |
21 | 52 | julia --project=.formatting -e 'using Pkg; Pkg.instantiate(); include(".formatting/format_all.jl")'
|
22 | 53 | ```
|
23 | 54 |
|
24 |
| -This will apply the necessary formatting rules to your code before submission. |
| 55 | +This ensures adherence to the project's formatting standards. |
| 56 | + |
| 57 | +## License |
| 58 | + |
| 59 | +This project is licensed under the MIT License. |
0 commit comments