formalisation of common HEP units #292
Replies: 2 comments 5 replies
-
Well, we can't provide shorter unit names as an exception for HEP because the next request will be to provide using eV = units::isq::si::electronvolt; Alternatively, we have UDLs, references, and aliases that provide nice shorthand notations. I recommend using them to save typing.
Sure we can do it but for the long names only. Can you provide a PR?
There is no other way to specify an integral UDL. See here: https://en.cppreference.com/w/cpp/language/user_literal#Literal_operators. But a negative number can be easily obtained thanks to a unary
Sure, why not? The only question is if those should go to the To summarize I would like to encourage you to provide a PR with those changes. I think they should be defined in a new namespace/system/directory (i.e. |
Beta Was this translation helpful? Give feedback.
-
@RalphSteinhagen, BTW, talking about HEP:
|
Beta Was this translation helpful? Give feedback.
-
Not urgent nor a bug but some thought related to end-user usage and look-and-feel.
I saw that there are some basic definitions of units that are commonly used in particle physics like electronvolt and gigaelectronvolt. This probably gets many of us excited because this seems to imply that there are other HEP people out there that maybe keen in using this library to get some more unit-/type-safetly into their codebase.
While these are still incomplete and certainly possible to (re-(re-(..)))-define them in the various use codebases (i.e. they are all derived from SI units), I was wondering whether this could be formalised and an official part of the units library?
Most of these units are defined either for brevity because of being compound of (e.g. [eV/c] == [kg m/s]) or because being relatively small compared to other base SI-units (e.g. '1 eV' ~ '1.602e-19 J' -- or even '1 fb' = 1e-43 sqm).
On this line, some thoughts for discussion how this could be possibly improved:
electronvolt
and 'gigaelectronvolt' toeV
and 'GeV` respectively -- rationale: the long-form is very uncommon-- based on this, is the question on 'aliases' vs. 'references' vs. 'literals' decided? (N.B. I'd be in the aliases/literal camp)
N.B. energies can be negative -- why are there
unsigned long long
definitions?eV_per_c_sq
,eV_per_c2
, oreV_per_c
,eV_per_c
, orIMHO: this is not a massive set that would deserve its own library (as LA does) but would be very helpful to avoid common mistakes and different naming conventions (e.g. possibly with a
hep_
prefix).Hope I am not alone with these questions, thoughts, or particular HEP unit interest. Food for thought ...
Click to expand for code-snippet!
@mpusz N.B. I haven't made a PR out of this, because I wasn't sure about the focus and direction you want to go with your lib and because there are many style questions involved ...
Beta Was this translation helpful? Give feedback.
All reactions