diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 813f5c4..438bfc7 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -20,6 +20,7 @@ target_include_directories(edm4eic_utils install(FILES include/edm4eic/analysis_utils.h + include/edm4eic/unit_system.h include/edm4eic/vector_utils.h include/edm4eic/vector_utils_legacy.h DESTINATION include/edm4eic diff --git a/utils/include/edm4eic/unit_system.h b/utils/include/edm4eic/unit_system.h new file mode 100644 index 0000000..b06b3a9 --- /dev/null +++ b/utils/include/edm4eic/unit_system.h @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2023 Dmitry Kalinkin + +#pragma once + +namespace edm4eic { + + namespace unit { + + // + // This provides definition for a unique unit system for this EDM. It is + // neither Geant, nor TGeo. The DD4hep, by default, uses a system matching + // the TGeo one. + // + // +------------+---------------------|-----------------+ + // | Geant | TGeo | EDM4hep/EDM4eic | + // +------------+---------------------|-----------------+ + // | milimeter | centimeter | milimeter | + // | nanosecond | second | nanosecond | + // | MeV | GeV | GeV | + // +------------+---------------------|-----------------+ + // + + // distance + static constexpr double mm = 1.0; // millimeter + static constexpr double cm = 1e1 * mm; // centimeter + static constexpr double um = 1e-3 * mm; // micrometer + static constexpr double nm = 1e-6 * mm; // nanometer + static constexpr double m = 1e3 * mm; // meter + + // time + static constexpr double ns = 1.0; // nanosecond + static constexpr double s = 1e9 * ns; // second + static constexpr double ms = 1e6 * ns; // milisecond + static constexpr double us = 1e3 * ns; // microsecond + static constexpr double ps = 1e-3 * ns; // picosecond + + // energy + static constexpr double GeV = 1.0; // giga electron volt + static constexpr double MeV = 1e-3 * GeV; // mega electron volt + static constexpr double keV = 1e-6 * GeV; // kilo electron volt + static constexpr double eV = 1e-9 * GeV; // electron volt + + } + +}